RAILSCLUB 2015
Microservices in Gett
Andrey Deryabin
Slide 2
Slide 2 text
Team Lead
@brainopia
@razum2um @nebolsin
@ssdany
Andrey Deryabin
Slide 3
Slide 3 text
Taxi
Beauty Home Services
Food Delivery
10 million users
32 cities
Slide 4
Slide 4 text
— James Hughes
“Microservice Architecture is an architectural
concept that aims to decouple a solution by
decomposing functionality into discrete
services”
Slide 5
Slide 5 text
— Sam Newman
“Microservices are small, autonomous
services that work together”
Slide 6
Slide 6 text
Teamwork
Communication
Shared Code
Fault Tolerance
Authentication/Authorization
Logging/Auditing
Testing
Configuring
Slide 7
Slide 7 text
Communication
HTTP REST JSON
Slide 8
Slide 8 text
Shared code
Slide 9
Slide 9 text
Don’t Repeat Yourself vs Service Isolation
Slide 10
Slide 10 text
git ‘https://link_to_repo.git' do
gem 'gett-config'
gem 'gett-env'
end
Slide 11
Slide 11 text
Authentication
Slide 12
Slide 12 text
Single sign-on
Integration with OKTA (authorization)
Two-Factor authentication
Requirements
Slide 13
Slide 13 text
Auth
Service
Slide 14
Slide 14 text
redirect 302 with SAML request
JWT
Auth
Service
Client
Service
SAML response
Slide 15
Slide 15 text
Versioning/Auditing
Slide 16
Slide 16 text
A
B
C
D
Slide 17
Slide 17 text
Distributed Transaction
Slide 18
Slide 18 text
Flat transaction
Nested Transaction
Slide 19
Slide 19 text
One Phase Commit
Two Phase Commit
Slide 20
Slide 20 text
Two phase commit
1. Voting Phase
• Coordinator sends a can_commit? request to all participants
• Each participant votes YES/NO to coordinator
2. Completion Phase
• Coordinator collects votes and makes the decision
• YES Participants wait for a commit! or abort! request.
Slide 21
Slide 21 text
A
B
C
D
Slide 22
Slide 22 text
A
B
C
D
check
check
check
Slide 23
Slide 23 text
A
B
C
D
check
check
check
Slide 24
Slide 24 text
A
B
C
D
check
check
check
Slide 25
Slide 25 text
A
B
C
D
check
check
check
confirmation
confirmation
confirmation
Slide 26
Slide 26 text
A
B
C
D
check
check
check
confirmation
confirmation
confirmation
Slide 27
Slide 27 text
A
B
C
D
check
check
check
confirmation
confirmation
confirmation
Slide 28
Slide 28 text
A
B
C
D
check
check
check
confirmation
confirmation
confirmation
Slide 29
Slide 29 text
Copy On Write
Slide 30
Slide 30 text
Fault Tolerance
Slide 31
Slide 31 text
Millions of API requests per day
Slide 32
Slide 32 text
Lots of servers
Slide 33
Slide 33 text
Hundreds of dependencies
Slide 34
Slide 34 text
— Mia Hamm
“Failure happens all the time. It happens
every day in practice. What makes you
better is how you react to it”
Slide 35
Slide 35 text
Release it!
Slide 36
Slide 36 text
Resilience patterns
Use Timeouts
Bulkheads
Fail Fast
Circuit Breaker
Failure/Error: post :create [...]
Lurker::ValidationError:
Request
- The property '#/' contains additional properties ["social_network"]
outside of the schema
when none are allowed in schema file:///.../lurker/api/v1/users-
POST.json.yml#
Response
- The property '#/user/last_sign_in_at' of type String did not match
the following type:
null in schema file:///.../lurker/api/v1/users-POST.json.yml#
Slide 49
Slide 49 text
Configuring when provisioning
Slide 50
Slide 50 text
Configuring on the fly (without restart/redeploy)
Distributed configuring
No syncronization lack
Slide 51
Slide 51 text
— zookeeper.apache.org
“ZooKeeper is a centralized service for
maintaining configuration information, naming,
providing distributed synchronization, and
providing group services”