wild microservices v2 (jeeconf edition)
TRANSCRIPT
SOA Principles1. standardized service contract
2. loose coupling
3. encapsulation
4. reusability
5. autonomy
6. statelessness
7. discoverability11
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
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
Размер имеет значение?
● Method/Function = Microservice?
● 10-300 LOC = Microservice?
● 1 week = Microservice?
● 1 developer = Microservice?
18
Размер не имеет значения*
● 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
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
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
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
Принцип LSD
- L языков программирования- S в среднем фреймворков на язык- D типов источников данных
complexity = L * S * D
29
Пример
- три языка программирования- два в среднем фреймворка на язык- семь типов источников данных
- legacy WS, mongo db- хранимые процедуры, JDBC-templates- elasticsearch, neo4j- мишкина база
complexity = 3 * 2 * 7 = 42 (!)30
39
Хочу бегемота!
Rent Service
Payment Service
Security Service Blockchain Service
Insurance Service
Какие есть варианты?
● Nginx/Haproxy + consul template
● Haproxy + bamboo (need marathon)
● Netflix Zuul (Java way!!!)
● Custom Servlet <- все с этого начинают!
50
Парадокс (де)централизации микросервисов
Чтобы эффективно работать с распределенными приложениями, нужно иметь очень хорошие
централизованные библиотеки/инструменты
Например: логирование, health-чеки, метрики, обработку программных ошибок
68
Парадокс (де)централизации микросервисов
Чтобы эффективно работать с распределенными приложениями, нужно иметь очень хорошие
централизованные библиотеки/инструменты
Но: не выносите бизнес-логику или доменные объекты
69
Code. Better. Together.
Примеры сегодняшнего дняhttps://github.com/lavcraft/wild-microservices-in-kiev
71
Высокие теории
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