Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Microservices: uma abordagem para arquitetura de aplicações (Devcamp 2015)

3,158 views

Published on

Microservices é um estilo arquitetural que têm revolucionado o desenvolvimento de aplicações através de pequenos serviços, desacoplados e com foco em executar uma tarefa específica comunicando-se através de Web APis ou mensagens assíncronas. Nesta palestra será apresentado como microservices é capaz de solucionar seus problemas no desenvolvimento de sistemas robustos e escaláveis. Serão abordadas as principais características deste paradigma, quais as vantagens e desvantagens em comparação a arquiteturas monolíticas, exemplos e situações de uso.

Published in: Software
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/qURD } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/qURD } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download doc Ebook here { https://soo.gd/qURD } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Microservices: uma abordagem para arquitetura de aplicações (Devcamp 2015)

  1. 1. Microservices Tiago Dolphine
  2. 2. Tiago Marchetti Dolphine tiagodolphine@gmail.com @tiagodolphine Sobre?
  3. 3. Agenda • O que é ? como surgiu? Porque? • Decompondo uma aplicação em microservices • Comunicação e integração • Estrutura básica • Desafios (micro?) • Case de arquitetura microservices
  4. 4. Vamos imaginar que estamos desenvolvendo uma loja virtual ...
  5. 5. Browser / Mobile App App Server/Container (Tomcat/Jetty) Framework (Spring/JavaEE) LB X Scaling DB Front End Framework Product Svc Order Svc Pricing Svc Stock Svc ORM (Hibernate) Aplicação Monolítica
  6. 6. Simplicidade em: • Desenvolver • Testar • Deploy • Escalar É natural pois é como aprendemos ! Aplicação Monolítica
  7. 7. Porém... • Crescimento do negócio • Aumento da complexidade do negócio
  8. 8. E para os desenvolvedores?
  9. 9. E para os desenvolvedores?
  10. 10. Enquanto isso em nossa loja virtual ... Aumento de vendas  Serviço de Pedidos  Gargalo
  11. 11. Vamos escalar nossa aplicação !
  12. 12. App Server/Container (Tomcat/Jetty) Framework (Spring/JavaEE) Front End Framework Product Svc Order Svc Pricing Svc Stock Svc ORM (Hibernate) App Server/Container (Tomcat/Jetty) Framework (Spring/JavaEE) Front End Framework Product Svc Order Svc Pricing Svc Stock Svc ORM (Hibernate) App Server/Container (Tomcat/Jetty) Framework (Spring/JavaEE) Front End Framework Product Svc Order Svc Pricing Svc Stock Svc ORM (Hibernate) App Server/Container (Tomcat/Jetty) Framework (Spring/JavaEE) Front End Framework Product Svc Order Svc Pricing Svc Stock Svc ORM (Hibernate) • Custos desnecessários (Cloud $$) • Subaproveitamento de recurso computacional Preciso escalar toda a aplicação !
  13. 13. http://microservices.io/articles/scalecube.html
  14. 14. Alguns pontos negativos • Redeploy de toda a aplicação para pequenas mudanças • Alto tempo de interrupções • Risco de falhas • Dificulta mudanças • Updates menos frequentes
  15. 15. A microservice architecture builds software as suites of collaborating services. (Martin Fowler)
  16. 16. O que é? Qual vantagem? • Conjunto de pequenos serviços • Foco em funcionalidade • Independência • Tecnologias heterogêneas e poliglotas • Escalabilidade em gargalos • DRY  Reuso de funcionalidades • Deploy independente (favorece CI/CD) • Equipes menores e focadas
  17. 17. Como definir um bom microservice? • Funcionalidades relacionados devem ficar juntas • Baixo acoplamento / Alta coesão • Estudar e delimitar o escopo do serviço • Modelar pensando em funcionalidades, não nos dados • Bounded Contexts (modelo interno e modelo exposto) • Módulos (app monólítica) candidatos a microservices O menor possível, porém grande o suficiente para representar o seu domínio
  18. 18. Como ficaria nossa loja virtual?
  19. 19. Browser / Mobile App LB Y Scaling DB Micro container framework Order Svc DB Stock Svc Front End DB Product Svc DB Pricing Svc
  20. 20. http://microservices.io/articles/scalecube.html
  21. 21. Integração e comunicação • Como um serviço se comunica com outro? Chamada à funções  Chamadas à APIs remotas • Síncrono: request/response • Assíncrono: request/callback
  22. 22. Orquestração vs coreografia Vamos pensar no processo de criação de um novo cliente Um serviço gerencia quando tomar ações Cada serviço sabe quando tomar ações diante de um evento
  23. 23. REST • Mecanismo síncrono • Recurso  É o foco do serviço • Desacoplamento do exposto para o armazenado • HTTP • Semântica e verbos (ex: GET, POST, PUT, DELETE) • Caching proxies • Load balancers • Ferramentas de monitoramento • Métodos de segurança
  24. 24. API Gateway API GW Web App Mobile App Customer Product Stock Pricing • Ponto único de entrada • Agregação de dados • API otimizada para diferentes clientes • Evita exposição de dados desnecessários • Tradução de protocolo • Cross domain e Same-origin policy
  25. 25. Mensageria • Mecanismo assíncrono (baseado em eventos) • Publish/Subscribe • Incentiva a coreografia e baixo acoplamento • Padrões para mensagens (AMQP, JMS...) • Message Broker (RabbitMQ, ActiveMQ, HornetQ...) • Aumenta complexidade
  26. 26. Híbrido Stock Pricing Email TopicOrderFrontEnd Product CustomerDB REST/HTTP Vamos pensar num fluxo de compra
  27. 27. Falhas são inevitáveis • Estar preparado para falhas • Assumir que as chamadas e serviços podem falhar • Rede é instável • Recuperação à falhas • Adotar este pensamento em tudo que for desenvolvido
  28. 28. Estrutura básica de um Microservice Recursos Serviço Modelo do Domínio Repositórios ORM / Framework Dados Gateway Recursos Serviço Modelo doDomínio Repositórios ORM/Framework Dados Gateway
  29. 29. Deploy • Instância • Serviços isolados • Sem conflito de recursos • Aloca todo recurso disponível • Virtual Machine • Facilidade de escalar  add mais VMs • Controle de CPU e memória • VM lenta de buildar e startar • Container • Rápido para buildar e startar • Não necessita startar todo SO, apenas o processo do serviço
  30. 30. E como ficam os times de desenvolvimento?
  31. 31. "Qualquer empresa que projeta um sistema, inevitavelmente produz um projeto cuja estrutura é uma cópia da estrutura de comunicação da organização“...
  32. 32. • Times multidisciplinares • Paraleliza mais facilmente o desenvolvimento • Cada time é responsável (dono) por cada microservice
  33. 33. Microservices no ifood...
  34. 34. Vamos a um exemplo de código ... com Spring boot https://github.com/tiagodolphine/microservices
  35. 35. Concluindo... • Maior complexidade! • Preciso de microservices para o meu problema? • Estar sempre ciente dos desafios que terei que enfrentar! • Descoberta de serviços • Operações transacionais • Testes • Monitoramento • Teorema CAP (consistency, availability, partition tolerance) • Dia a dia do desenvolvedor mais agitado e divertido 
  36. 36. Algumas referências • Microservices (Martin Fowler e James Lewis) • microservices.io (Chris Richardson) • Building "Bootiful" Microservices with Spring Boot (Josh Long) • Testing Strategies in a Microservice Architecture (Toby Clemson) • Building Microservices Designing Fine Grained Systems (Sam Newman) fev/2015
  37. 37. Tiago Marchetti Dolphine tiagodolphine@gmail.com @tiagodolphine Dúvidas ?
  38. 38. Algumas idéias de tecnologias • Micro container: Spring Boot, Play, DropWizard • Comunicação: • REST : Spring MVC, JAX-RS • Mensageria: Spring AMQP com RabbitMQ • Deploy: Container com Docker • Monitoramento: Logstash, Kibana, NewRelic, Consul • Service Discovery: Consul

×