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.

WILD microSERVICES v2 (JEEConf Edition)

Everyone has heard about microservices. Someone tries to implement them in practice. And only the bravests of us have already used them in production environment. But then why so many people hype around microservices, if the idea is not quite new? What are microservices? What is the difference between it and good old SOA approach? How can developers create modern enterprise applications in Java easily with the help of this approach?

Our guests should try to answer these questions and share their own experience related to live coding of imaginary startup ‘Hippos’.

The following topics will be covered:

What are microservices? Where is the theory, bro?
What kind of technologies should we choose? What have we chosen and why?
Why RPC is still competetive in REST-domination era?
How to pack and distribute microservices? How can SpringBoot and Docker help us to solve our problems?
Why is service discovery considered as one of the crucial components? How to cook Spring Cloud and what problems you may face in real life?
Security of microservices, API gateway and other.
Speakers will also cover other topics related to distributed system development.

WILD microSERVICES v2 (JEEConf Edition)

  1. 1. WILD microSERVICES 18+
  2. 2. @tolkv 2
  3. 3. @aatarasoff 3
  4. 4. WILD microSERVICES 18+
  5. 5. DISCLAIMER No warranty guarantee 5
  6. 6. Agenda 1. Theory 2. Practice 3. Q&A 6
  7. 7. 7
  8. 8. 8
  9. 9. 9
  10. 10. Ball of Mud 10
  11. 11. SOA Principles 1. standardized service contract 2. loose coupling 3. encapsulation 4. reusability 5. autonomy 6. statelessness 7. discoverability 11
  12. 12. 12
  13. 13. 13
  14. 14. Никто не любит “некрасивые” технологии поэтому они умирают
  15. 15. 15 Про тренды
  16. 16. In short, the microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages and use different data storage technologies. -- James Lewis and Martin Fowler Что такое микросервисы? 16
  17. 17. In short, the microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages and use different data storage technologies. -- James Lewis and Martin Fowler Что такое микросервисы? 17
  18. 18. Размер имеет значение? ● Method/Function = Microservice? ● 10-300 LOC = Microservice? ● 1 week = Microservice? ● 1 developer = Microservice? 18
  19. 19. Размер не имеет значения* ● Single Responsibility ● One capability ● Bounded context “In your organization, you should be thinking not in terms of data that is shared, but about the capabilities those contexts provide the rest of the domain.” – Sam Newman, Building Microservices *до разумных пределов конечно 19
  20. 20. Domain-Driven Design 20
  21. 21. In short, the microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages and use different data storage technologies. -- James Lewis and Martin Fowler Что такое микросервисы? 21
  22. 22. Process segregation 22
  23. 23. In short, the microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages and use different data storage technologies. -- James Lewis and Martin Fowler Что такое микросервисы? 23
  24. 24. Независимый деплой build test 24
  25. 25. In short, the microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages and use different data storage technologies. -- James Lewis and Martin Fowler Что такое микросервисы? 25
  26. 26. Language/technology segregation 26
  27. 27. Data segregation 27
  28. 28. Team segregation 28
  29. 29. Принцип LSD - L языков программирования - S в среднем фреймворков на язык - D типов источников данных complexity = L * S * D 29
  30. 30. Пример - три языка программирования - два в среднем фреймворка на язык - семь типов источников данных - legacy WS, mongo db - хранимые процедуры, JDBC-templates - elasticsearch, neo4j - мишкина база complexity = 3 * 2 * 7 = 42 (!) 30
  31. 31. Чем нельзя жертвовать? min (L * S * D) -> ? 31
  32. 32. Закон трёх букв min (L * S * D) -> max (D) 32
  33. 33. Почему Spring Boot/Spring Cloud? 33
  34. 34. А теперь попробуем 34
  35. 35. 35 Хочу бегемота!
  36. 36. Хочу бегемота! Rent Service 36
  37. 37. 37 Хочу бегемота! Rent Service Payment Service
  38. 38. 38 Хочу бегемота! Rent Service Payment Service Security Service Blockchain Service
  39. 39. 39 Хочу бегемота! Rent Service Payment Service Security Service Blockchain Service Insurance Service
  40. 40. Problem -> Many Services
  41. 41. Demo -> Bootstrapping
  42. 42. Problem -> Delivery value
  43. 43. Demo -> Build, Distr, Deploy
  44. 44. Problem -> Find them all
  45. 45. Service Discovery 45
  46. 46. Demo -> Time to Discover
  47. 47. Problem -> goto Production
  48. 48. Где мой порт? 48
  49. 49. 49
  50. 50. Какие есть варианты? ● Nginx/Haproxy + consul template ● Haproxy + bamboo (need marathon) ● Netflix Zuul (Java way!!!) ● Custom Servlet <- все с этого начинают! 50
  51. 51. Netflix Zuul 51
  52. 52. Demo -> Gateway Time
  53. 53. Problem -> Defend yourself
  54. 54. 54
  55. 55. Demo -> Hystrix the Saviour
  56. 56. Problem -> Find the Trace
  57. 57. 59
  58. 58. 60
  59. 59. Demo -> Sleuthing
  60. 60. Типичная микросервисная архитектура 62
  61. 61. 63
  62. 62. А что в этих ваших интернетах? 64
  63. 63. 65 DDDD (4D)
  64. 64. Выводы 66 ● Микросервисы - это просто
  65. 65. Выводы 67 ● Микросервисы - это просто ● Микросервисы - это сложно
  66. 66. Парадокс (де)централизации микросервисов Чтобы эффективно работать с распределенными приложениями, нужно иметь очень хорошие централизованные библиотеки/инструменты Например: логирование, health-чеки, метрики, обработку программных ошибок 68
  67. 67. Парадокс (де)централизации микросервисов Чтобы эффективно работать с распределенными приложениями, нужно иметь очень хорошие централизованные библиотеки/инструменты Но: не выносите бизнес-логику или доменные объекты 69
  68. 68. LSD вам в помощь min (L * S * D) -> max (D) 70
  69. 69. Code. Better. Together. Примеры сегодняшнего дня https://github.com/lavcraft/wild-microservices-in-kiev 71
  70. 70. Высокие теории Sam Newman “Building Microservices” Martin Fowler “Microservice TradeOff” “Microservices” “The Twelwe-Factor App” http://12factor.net Hystrix: managing failures in distributed systems - Tomasz Nurkiewicz https: //www.youtube.com/watch?v=JadVts_prtA 72
  71. 71. Спасибо! Готовы ответить на ваши вопросы @tolkv @aatarasoff 73

×