SlideShare a Scribd company logo
Микросервисы
огонь, вода, медные трубы 1
@tolkv
2
@lavcraft
3
@aatarasoff
@aatarasoff
DISCLAIMER
No warranty guarantee
4
5
6
“Microservices” - just a buzzword
7
“Microservices” - just a buzzword
8
Why?
● High abstraction level
9
Why?
● High abstraction level
● Popular word
10
Why?
● High abstraction level
● Popular word
● Sell itself
11
Why?
● High abstraction level
● Popular word
● Sell itself
● More talks
12
13
Not Gartner Curve
14
15
Not Gartner Curve
16
Not Gartner Curve
17
18
What is the architecture?
19
What is the architecture?
20
What is the architecture?
21
https://www.youtube.com/watch?v=_Kex5hwGE-w
22
Classic development
23
Big Ball of Mud
24
SOLID
Counter-Strike Cats
25
GOF
SOLID
GRASP
Counter-Strike Cats
26
12 April 1996
SOA is Born
https://www.gartner.com/doc/302868/service-oriented-architectures-
27
12 April 1996
SOA is Born
https://www.gartner.com/doc/302868/service-oriented-architectures-
28
SOA Principles
1. Standardized service contract
2. Loose coupling
3. Encapsulation
4. Reusability
5. Autonomy
6. Statelessness
7. Discoverability
29
Classic SOA
● centralized orchestration
● complicated (hi, SOAP)
● smart pipes (hi, ESB)
30
5 January 2009
SOA is Dead
http://apsblog.burtongroup.com/2009/01/soa-is-dead-long-live-services.html
31
What did you say?
32
SOA != SOAP (WS-*)
33
34
35
...and what about people?
2004 year
36
SOA was ahead of its time
37
38
SOA
So
A=F(Rq, FRq, NFRq,..........???............)
39
Microservices
40
A=F(Rq, FRq, NFRq,..........???............)
DevOps
OSS Domination
41
What is “microservices”?
42
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
43
Does size matter?
● Method/Function = Microservice?
● 10-300 LOC = Microservice?
● 1 week = Microservice?
● 1 developer = Microservice?
44
Size doesn’t matter*
● 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
*within reason
45
Domain-Driven Design
46
47
DDD
Dd
SOA
So
Microservices are new classes
48
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
49
Problem → So Many Teams
50
LSD Principle
- L programming languages
- S average framework count by language
- D data source types
complexity = L * S * D
51
Some LSD for you
- three programming languages
- two average framework count by language
- seven data source types
- legacy WS, mongo db
- OLTP, OLAP
- elasticsearch, neo4j
- Mishka’s database %)
complexity = 3 * 2 * 7 = 42 (!)
52
What can’t be sacrificed?
min (L * S * D) → ?
53
min (L * S * D) → max (D)
54
L = Java 18+
S = Spring Boot
D = ∞
55
java
Ja
spring boot
Sb
56
LSD principle
Ls
DDD
Dd
SOA
So
Data Isolation Patterns
57
N services → 1 DB
Isolated by Schema/Tables
58
N services → N DB
Distributed Transactions are Painfull
59
M services → 1 DB
L services → L DB
M + L = N, M << L
60
Event Sourcing / CQRS / SAGAS
http://gotocon.com/dl/goto-chicago-2015/slides/CaitieMcCaffrey_ApplyingTheSagaPattern.pdf
61
java
Ja
spring boot
Sb
62
Data Isolation
Di
LSD principle
Ls
DDD
Dd
SAGAS
Sa
SOA
So
Problem -> Many Services
63
git clone <cool_service_repo>
64
git clone <template_repo>
65
lazybones/start.spring.io/yeoman
66
lazybones create api 1.0.1 service_name
67
~home > lazybones create api 0.0.1 rent-service
Creating project from template api 0.0.1 in 'rent-service'
Define value for 'group' [by.javaday]:
Define value for 'version' [0.0.1]:
srv1
├──srv2
└──srv3
logging
sleuth
Define value for 'dependencies' [logging,sleuth]:
Project created for rent-service!
68
lazybones
Lz
yoman
Yo
start.spring.io
Ss
java
Ja
spring boot
Sb
groovy
Gy
69
Data Isolation
Di
LSD principle
Ls
DDD
Dd
SAGAS
Sa
SOA
So
Problem → DRY off
70
TServerTransport serverTransport = new TServerSocket(
new InetSocketAddress(InetAddress.
getLocalHost(), port));
TProcessor processor = new TInsuranceService.
Processor<>(
//business value here
);
server = new TSimpleServer(
new TServer.Args(serverTransport).processor
(processor));
server.serve();
71
TSocket transport = new TSocket(host, port);
transport.open();
TBinaryProtocol tBinaryProtocol = new TBinaryProtocol
(transport);
TInsuranceService.Client client =
new TInsuranceService.Client(tBinaryProtocol);
perform(client); //business value here
transport.close(); 72
@ThriftController
public class InsuranceController implements
TInsuranceService.Iface {
@Override
public void someMethod(TInsurance insurance){
//business value here
}
}
73
@ThriftClient(serviceId = "insurance-service")
TInsuranceService.Client client;
...
perform(client); //business value here
...
74
smart libs
starters
launchers
shared libs
utils
helpers
75
smart libs/shared libs
76
documentation → smart documentation
77
Not smart
= This is main documentation
This document describes how to be the most fundamental and important
document in the world of documents
...
COPY-PASTE documentation from another document
...
78
Not so smart
= This is main documentation
This document describes how to be the most fundamental and important document
in the world of documents
include::https://raw.github.com/asciidoctor/asciidoctor/master/Gemfile[]
include::../other.adoc[]
include::/home/tolkv/git/docs-0/superdoc.adoc[]
79
Really smart
= This is main documentation
This document describes how to be the most fundamental and important document
in the world of documents
include::https://raw.github.com/asciidoctor/asciidoctor/master/Gemfile[]
include::gradle://gradle-advanced:service-with-deps:1.0/deps.adoc[]
include::gradle://:service/doc.adoc[]
80
Payment Service[jar,doc] Insurance Service [jar,doc]
One Point of View
[UberDoc.zip]
Rent Service[jar,doc] Other Service [jar,doc]
Information Aggregation
81
Centralization Paradox
To work effectively with distributed applications, you need
to have a very good centralized libraries and tools.
For example: logging, health-checking, metrics,
exception handling, documentation autogeneration
82
Centralization Paradox
To work effectively with distributed applications, you need
to have a very good centralized libraries and tools.
But: don’t do this with you business logic or domain model
83
lazybones
Lz
yoman
Yo
start.spring.io
Ss
java
Ja
thrift
Th
spring boot
Sb
gradle
Gr
asciidoctor
Ad
groovy
Gy
84
Data Isolation
Di
Centralization
paradox
Cp
LSD principle
Ls
DDD
Dd
SAGAS
Sa
Smart Docs
Sd
Smart Libs
Sl
SOA
So
Delivery Story
85
war/ear
86
executable fatJar
87
88
Not Gartner Curve
docker/rkt/packer
89
./gradlew deployViaSSH
90
./gradlew deployViaSSH
Consistency
High Availability
91
./gradlew deployToArtifactory
ansible -i [stage,dev,test] -t deploy
Predefined Configuration
92
Magic
Private PAAS
93
mesos/kubernetes/∞
94
How we run cluster
95
More spice!
96
More spice!
97
More spice!
98
Mesos lets us treat a cluster as one
big computer
WEB
WASTED
CACHE
WASTED WASTED
HADOOP
99
Mesos lets us treat a cluster as one
big computer
WEB
WASTED
CACHE
WASTED WASTED
HADOOP
WASTED
WEB
CACHE
HADOOP FREE FREE
100
lazybones
Lz
yoman
Yo
start.spring.io
Ss
python
Py
java
Ja
spring boot
Sb
gradle
Gr
asciidoctor
Ad
docker
Dr
mesos
Ms
marathon
Ma
chronos
Ch
aurora
Au
Kubernetes
Kb
groovy
Gy
101
Data Isolation
Di
Centralization
paradox
Cp
LSD principle
Ls
DDD
Dd
SAGAS
Sa
Smart Docs
Sd
Dynamic Sharing
Ds
Smart Libs
Sl
SOA
So
ansible
An
thrift
Th
Artifactory
Ar
Problem → Find them All
102
insert into settings_table values (key, endpoint)
103
update template → services.location
kill -s HUP nginx
104
eureka/consul/etcd/zookeper
105
106
Service Client
Registry-aware
HTTP Client
Service Registry
Service Instance 1
Service Instance N
Service Instance ...
Load balance request
Client side discovery
107
Service Client
Service Registry
Service Instance 1
Service Instance N
Service Instance ...
Load balance request
Router/Proxy
Server side discovery
Problem → Defend yourself
108
109
110
Circuit Breaker
hystrix/apache camel/akka
111
112
Хочу бегемота!
Rent Service
Payment Service
Security Service Blockchain Service
Insurance Service
5мс
113
Хочу бегемота!
Rent Service
Payment Service
Security Service Blockchain Service
Insurance Service
300мс
114
Хочу бегемота!
Rent Service
Payment Service
Security Service Blockchain Service
Insurance Service
300мс
115
Хочу бегемота!
Rent Service
Payment Service
Security Service Blockchain Service
Insurance Service
300мс
116
Хочу бегемота!
Rent Service
Payment Service
Security Service Blockchain Service
Insurance Service
300мс
117
Хочу бегемота!
Rent Service
Payment Service
Security Service Blockchain Service
Insurance Service
300мс
Open
118
Хочу бегемота!
Rent Service
Payment Service
Security Service Blockchain Service
Insurance Service
300мс
Half-Open
119
Хочу бегемота!
Rent Service
Payment Service
Security Service Blockchain Service
Insurance Service
5мс
Half-Open
120
Хочу бегемота!
Rent Service
Payment Service
Security Service Blockchain Service
Insurance Service
5мс
121
Problem → Follow the Trace
122
No Trace
123
X-Request-Id = X-Request-Id ?: new ID
Good Old ServletFilter
124
spring-cloud-sleuth/open zipkin
125
126
RentService
PaymentService
SecurityServiceBlockchainService
TraceId = X
SpanId = A
No TraceId
No SpanId
TraceId = X
SpanId = A
TraceId = X
SpanId = A
TraceId = X
SpanId = B
TraceId = X
SpanId = B
TraceId = X
SpanId = C
TraceId = X
SpanId = C
TraceId = X
SpanId = D
TraceId = X
SpanId = D
TraceId = X
SpanId = E
TraceId = X
SpanId = E
TraceId = X
SpanId = F
TraceId = X
SpanId = G
127
128
129
RentService
PaymentService
SpanId = B
Client Send
SpanId = B
Server Received
SpanId = B
Client Received
SpanId = B
Server Send
TraceId = X
SpanId = A
TraceId = X
SpanId = C
yoman
Yo
start.spring.io
Ss
python
Py
lazybones
Lz
java
Ja
spring boot
Sb
gradle
Gr
asciidoctor
Ad
thrift
Th
docker
Dr
mesos
Ms
marathon
Ma
chronos
Ch
aurora
Au
Artifactory
Ar
Kubernetes
Kb
eureka
Eu
consul
Cl
etcd
Ed
zookeeper
Zk
hystrix
Hx
sleuth
Sl
zipkin
Zn
groovy
Gy
130
Data Isolation
Di
Centralization
paradox
Cp
LSD principle
Ls
DDD
Dd
SAGAS
Sa
Smart Docs
Sd
Dynamic Sharing
Ds
Smart Libs
Sl
SOA
So
ansible
An
1. Архитектура функция от множества
переменных
2. Всё новое - хорошо забытое старое
3. Микросервисы как iPhone
4. Микросервисы - новые классы
5. Каждой задаче - свой инструмент
Запомните это
131
1. SOA принципы живы
2. Принцип LSD
3. Изоляция данных делает жизнь приятнее
4. В сложных ситуациях Event
Sourcing/CQRS/SAGAS
5. Парадокс централизации
6. Планируй ресурсы динамически
Придерживайтесь принципов
132
Links
Spring Thrift Starter:
https://github.com/aatarasoff/spring-thrift-starter
Тоже, но для grpc:
https://github.com/lavcraft/grpc-spring-boot-starter
Какие-то примеры:
https://github.com/lavcraft/wild-microservices-in-kiev
Gradle doc plugin blueprint: https://github.com/aatarasoff/documentation-plugin-
demo
133
Спасибо! Готовы ответить на ваши вопросы
@tolkv
@aatarasoff
134
@lavcraft
@aatarasoff
Post Scriptum
135
Event Sourcing / CQRS / SAGA
http://gotocon.com/dl/goto-chicago-2015/slides/CaitieMcCaffrey_ApplyingTheSagaPattern.pdf
136
137
138
Saga guarantee
● T1 -> T2 -> T3 -> … -> Tn
● T1 -> T2 -> … Tn -> Cn … -> C2 -> C1
139
140
141
142

More Related Content

PDF
WILD microSERVICES v2
PDF
Docker In Bank Unrated
PDF
ELK Wrestling (Leeds DevOps)
PPTX
Deploying services: automation with docker and ansible
PDF
Continuous Delivery with Jenkins: Lessons Learned
PDF
Дикие микросервисы на JUG Екатеринбург
PDF
Service Discovery. Spring Cloud Internals
PDF
The Future of Cloud Innovation, featuring Adrian Cockcroft
WILD microSERVICES v2
Docker In Bank Unrated
ELK Wrestling (Leeds DevOps)
Deploying services: automation with docker and ansible
Continuous Delivery with Jenkins: Lessons Learned
Дикие микросервисы на JUG Екатеринбург
Service Discovery. Spring Cloud Internals
The Future of Cloud Innovation, featuring Adrian Cockcroft

Similar to Java Day Minsk 2016 Keynote about Microservices in real world (20)

PDF
Кирилл Толкачев. Микросервисы: огонь, вода и девопс
PDF
Developing Microservices Directly in AKS/Kubernetes
PDF
Cloud-native .NET Microservices mit Kubernetes
PDF
Lessons from Building Large-Scale, Multi-Cloud, SaaS Software at Databricks
PDF
Cloud Native Applications on OpenShift
PDF
Why we don’t use the Term DevOps: the Journey to a Product Mindset - DevOpsCo...
PPTX
Azure + DataStax Enterprise (DSE) Powers Office365 Per User Store
PDF
RightScale Roadtrip Boston: Accelerate to Cloud
PDF
Journey to cloud engineering
ODP
Why Sun for Drupal?
PPT
Viridians on Rails
PPTX
The New MariaDB Offering: MariaDB 10, MaxScale and More
PDF
Developing the Stratoscale System at Scale - Muli Ben-Yehuda, Stratoscale - D...
PPTX
OSCON 2013 - The Hitchiker’s Guide to Open Source Cloud Computing
PDF
Machine learning services with SQL Server 2017
PDF
DevOps LA Meetup Intro to Habitat
PDF
Simpler, faster, cheaper Enterprise Apps using only Spring Boot on GCP
PDF
Level up your SQL and Azure, by using Rubrik
PDF
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
PDF
PHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
Кирилл Толкачев. Микросервисы: огонь, вода и девопс
Developing Microservices Directly in AKS/Kubernetes
Cloud-native .NET Microservices mit Kubernetes
Lessons from Building Large-Scale, Multi-Cloud, SaaS Software at Databricks
Cloud Native Applications on OpenShift
Why we don’t use the Term DevOps: the Journey to a Product Mindset - DevOpsCo...
Azure + DataStax Enterprise (DSE) Powers Office365 Per User Store
RightScale Roadtrip Boston: Accelerate to Cloud
Journey to cloud engineering
Why Sun for Drupal?
Viridians on Rails
The New MariaDB Offering: MariaDB 10, MaxScale and More
Developing the Stratoscale System at Scale - Muli Ben-Yehuda, Stratoscale - D...
OSCON 2013 - The Hitchiker’s Guide to Open Source Cloud Computing
Machine learning services with SQL Server 2017
DevOps LA Meetup Intro to Habitat
Simpler, faster, cheaper Enterprise Apps using only Spring Boot on GCP
Level up your SQL and Azure, by using Rubrik
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
PHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
Ad

More from Кирилл Толкачёв (12)

PDF
Curse of spring boot test [VRN]
PDF
Wild microservices and imaginary DevOps
PDF
Jenkins Imperative Pipeline vs Declarative Pipeline
PDF
Spring Boot Ripper
PDF
Gradle in Enterprise, Is it possible?
PDF
Curse of spring boot test
PDF
Spring Boot Test horror
PDF
Jenkins в docker in mesos in ...
PDF
CD with Jenkins. Lessons Learned
PDF
Эволюционный дизайн. Joker Students Day 2016
PDF
Release management with Gradle #JokerConf2016
PDF
Joker 2015 Wild microSERVICES
Curse of spring boot test [VRN]
Wild microservices and imaginary DevOps
Jenkins Imperative Pipeline vs Declarative Pipeline
Spring Boot Ripper
Gradle in Enterprise, Is it possible?
Curse of spring boot test
Spring Boot Test horror
Jenkins в docker in mesos in ...
CD with Jenkins. Lessons Learned
Эволюционный дизайн. Joker Students Day 2016
Release management with Gradle #JokerConf2016
Joker 2015 Wild microSERVICES
Ad

Recently uploaded (20)

PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
cuic standard and advanced reporting.pdf
PPTX
Cloud computing and distributed systems.
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Electronic commerce courselecture one. Pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
Approach and Philosophy of On baking technology
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
cuic standard and advanced reporting.pdf
Cloud computing and distributed systems.
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Electronic commerce courselecture one. Pdf
Per capita expenditure prediction using model stacking based on satellite ima...
The Rise and Fall of 3GPP – Time for a Sabbatical?
Understanding_Digital_Forensics_Presentation.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Machine learning based COVID-19 study performance prediction
Approach and Philosophy of On baking technology
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Review of recent advances in non-invasive hemoglobin estimation
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Empathic Computing: Creating Shared Understanding
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Chapter 3 Spatial Domain Image Processing.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf

Java Day Minsk 2016 Keynote about Microservices in real world