SlideShare a Scribd company logo
1 of 42
Migrating huge monolith to
microservices.
ANDRIY TRUBITSYN, SOLUTION ARCHITECT
November 11, 2017
How we did it in details.
SPEAKER
• SA at Microservice Accelerator in EPAM
• Passionate microservices
• Works in Java stack
• Likes Python
ANDRIY
TRUBITSYN
EPAM Systems, Solution
Architect
WHY SOMETIMES WE NEED MICROSERVICES
Fast Time to
Market
Independent
Development,
Deployment
Independent
Scalability
Resource
Utilization
Technology
Heterogeneity
https://martinfowler.com/articles/microservices.html
HOW MIGRATION IS USUALLY PRESENTED
Challenges
Challenges
THE BEGINNING
• 200+ developers
• 20 year old project with
continuous development
• Legacy technologies and
everything is custom
• 20 customer project editions
• Many development teams
without centralized
governance
CHALLENGES
Modules:
andrey@vm:~/project$ ls -l ./ | grep -c ^d
1710
Files:
andrey@vm:~/project$ find ./ -type f | wc -l
226875
“Legacy code. The phrase strikes disgust in the hearts of programmers. It conjures images of slogging through a murky swamp of tangled undergrowth with leaches beneath and
stinging flies above. It conjures odors of murk, slime, stagnancy, and offal. Although our first joy of programming may have been intense, the misery of dealing with legacy code
is often sufficient to extinguish that flame.”
― Michael C. Feathers, Working Effectively with Legacy Code
CHALLENGES
Size:
andrey@vm:~/project$ du -sh ./
4,8G ./
15:27:20 BUILD SUCCESSFUL
15:27:20
15:27:20 Total time: 2 hrs 15 mins 28.729 secs
HOW WE DEVELOPED
CA R1
Master
CB R2CB R1
CA R3CA R1
CB R3
Sync
Point A
Sync
Point B
Unstable
Code
HOW WE ENABLE FEATURES
M
F1
F0 R0F1
F1
MasterCustomer A Customer B
Step Time
A: Find a slot to publish 2-3w
A: Publish F1 to Master 1m
A: Stabilize Master 2-3w
B: Plans a slot 2-3w
B: Merge F1 to branch B 1m
B: Stabilize branch B 2-3w
Total 4-5m
OUR PLAN
Split up codebase to components1
Establish independent release/branching and versioning strategies2
Find component owners (experts) for architecture governance3
Establish intensive testing, code analysis and component certification4
Extract microservices5
Apply software product line concept6
1-4 STEPS
COMPILE DEPENDENCIES IN THE MONOLITH
COMPONENTIZATION
Frameworks
Components
Business
Components
Integration
Components
Schemas
Core
Utils,
Rules
Order
Manager
Offer
Manager
…
Payment
Systems
Insurance
services
…
Tool/Applicati
on
ETL
Admin UI
apps
…
DEPENDENCIES WE FIGHT AGAINST
Compile
Runtime
via IoC, DI
Binary
Dependencies
dependencies {
compile project(':00006740')
}
dependencies {
compile group: 'com...core', name: 'noname',
version: property('this.component.version')
}
<BeanPolicies>
<Policy id=“PolicyID">
<Bean impl=“com.ClassImpl">
<Property id=“id" val=“value"/>
<Reference bean=“name" id=“id"/>
</Bean>
</Policy>
</BeanPolicies>
DEPENDENCIES WE FIGHT AGAINST
Pricing
Core Functionality
XSD Schemas
Rules, Utils
UI
Payment Connectors
Adaptors
OFM OMSearch Server Client
Build Dependencies Graph
• Some unexpected dependencies
like Payment  Handlers.Land
• New dependencies appears all
the time from dev teams
• Hard to detect circle
dependencies (mixed types)
CYCLE DEPENDENCIES
Payment Component
Core Component
3
4
5
2
1
Depends on
Depends on
Depends on
• Business code in Core
component
• Utils code in business
component
• Core component has runtime
dependencies on customer
specific code
“MIXED” DEPENDENCIES
Customer A Customer B
Order
Management
• Hard to detect
• Hard to Fix
• Dependency on Customer
Binary
dependency
Run-Time
dependency
PRE-MICROSERVICES
EAR
WAR
Framework Components
(Core, Rules, Utils)
WAR JAR(EJB)
• No performance
degradation
• The same deployment
procedure
• Easy to find out
bounded context for
true microservices.
• Give us a better view
on future internal API
NEW BRANCHING STRATEGY
• Custom Code and Product code
are to be separated
• Git Lab approach for all teams
• Features can be enabled
immediately
• We persist to support 2 latest
releases of components
Component
Master Customer B
Branch
Customer A
Branch
Customer
Development
Branch
Customer
Development
Branch
NEW BRANCHING STRATEGY
V1.0.x
Release
branch
Feature
branch
Feature
branch
Master
branch
feature featurefeature feature
V1.0.0
feature
V2.0.0
feature
V2.0.x
Release
branch
V1.0.1
Hot Fix
OWNER TEAMS
• Each component (framework or business)
has its owner team
• Customer teams own their customer
components
• Owner teams reviews and merge all pull
requests into their components
• Owner teams consist of experts in specific
areas
• Virtual Owner Teams for framework
components.
RESPONSIBILITY PROBLEM
• It is not my piece of code
• I know who wrote this stuff, take this
piece away from me
• This is from another component, it is not
mine
"Oh that! Well Ray and Emil (they're no longer with the company) wrote that routine back when Jim (who left last
month) was trying a workaround for Irene's input processing code (she's in another department now, too). I don't
think it's used anywhere now, but I'm not really sure. Irene didn't really document it very clearly, so we figured we
would just leave well enough alone for now…"
COMPONENT CERTIFICATION
Jenkins
Artifactory
Build & Test &
Analyze
Deploy with other
components
Publish results
Pull/Push Artifacts
deploys
Push release candidate
Customer A
Integration Tests
Integration Test
Environment
Run customer tests
COMPONENT CERTIFICATION
// Certified components set, registration date: 12.12.2016,
// link: http://kb.mycompany.com/display/Component+Certification/45
dependencies {
confName group: 'com...product.config', name: 'name', version: 1.1.8
confName group: 'com...core', name: 'name', version: 1.11.22
confName group: 'com...base.util', name: 'name', version: 2.21.12
confName group: 'com...services', name: 'name', version: 1.67.34
confName group: 'com...catalogue', name: 'name', version: 2.0.1
}
CUSTOMER RELEASE STRATEGY
Core Releases
Core v1.0 Core v1.1 Core v1.2
Order Management Releases
OM v2.0 OM v2.1 OM v2.2
Offer Management Releases
OFM v1.3 OFM v1.5 OFM v1.6
Customer A Release
Core v1.0
Order Management v2.0
Offer Management v1.3
Customer B Release
Core v1.1
Order Management v2.2
Offer Management v1.5
• Several Environments per a component (+25 servers)
• New view and jobs (+200 new Jobs)
• Many repositories (+60)
• New user groups (+70)
• New tools integrations: Jenkins+BitBucket, Sonar+BitBicket
INFRASTRUCTURE CHANGES
• Teams are afraid of responsibility
• Teams are afraid to work on the common master
• Teams are afraid of any new change
• Automation tests are never enough
• Think about your hardware as early as possible
• Business involvement is very important
COMPONENTIZATION – LESSONS LEARNT
COMPONNETIZATION RESULTS
SECOND STEP: MICROSERVICES
GOALS 2018
PMC
AdServer
Desktop Web Mobile B2B
Security
Tracing
Logging
Monitors
Offer mgt
Configs
Pricing
Search Order mgt
Profile Payment
Customer A UI v3.1 Customer B UI v2.2
• The monolith is splitted
in the true microservices
• The product supports
multitenancy
• The product runs in the
private DC
• The company sells API
MICROSERVICES CHALLENGES
Internal API
Business
transaction
bounds
Distributed
Cache
God object
Technology
Stack
Data flow
Internal
communicati
on protocol
Common DB
?
COMPONENTS TRANSFORMATION
Frameworks
Components
Business
Components
Integration
Components
Library
Microservice
EXTRACTED MICROSERVICE
• New deployment unit
• LB configuration
• Microservices
intercommunication
???
Monolith Application
Rules Core
Utils Commons
Profile
Order
Management
Search
Offer
Management
Extracted service
Profile
Rules
Core
Utils
Commons
Load Balancer
INTERNAL API
Class A Class B
Container
Class A Class B
Container Container
Public API
Private API
Method call
• Protocol for internal API
• God Object and Data Flow • Internal API Versioning
BUSINESS TRANSACTION
Order
Management
Business
Logic
Core
...
Commons
Offer
Management
Business
Logic
Core
...
Commons
Search
Service
Business
Logic
Core
...
Commons
Correct separation
leads to proper
designed API
Order
Management
Business
Logic
Core...Commons
Offer
Management
Business
Logic
Search
Service
Business
Logic
Monolith Application
COMMON DATA BASE
Two different services use
common data
Monolith
Application
Offer
Management
Extracted service
Order
Management
Enforce requests to services
instead of DB requests
• God object (Blob)
• Map<Object,
List<Map<Object, Map>>>
• No one knows what is inside
PROBLEM WITH DATA FLOW
Monolith
Application
Core
Commons
Profile
Offer
Management
Extracted service
Profile
Rules
Commons
Utils
Core
DISTRIBUTED CACHE
Extracted service
Profile
Rules
Core
Monolith Application
Rules Core
Profile
Order
Management
Search
Offer
Management
Distributed Cache
Monolith Application
Rules Core
Profile
Order
Management
Search
Offer
Management
Cache
SUMMARY
Have a strong RnD team
Thoroughly think of migration plan
Do as small steps as possible
Do regression tests after each small step
Involve business and team leads in transformation process
Migrating huge monolith to microservices.
Q&A TIME
CONTACT ME
Andriy_Trubitsyn@epam.com
trubitsynandrey
andtrub

More Related Content

What's hot

Wrong Tool, Wrong Time: Re-Thinking Test Automation -- w/ State of Visual Tes...
Wrong Tool, Wrong Time: Re-Thinking Test Automation -- w/ State of Visual Tes...Wrong Tool, Wrong Time: Re-Thinking Test Automation -- w/ State of Visual Tes...
Wrong Tool, Wrong Time: Re-Thinking Test Automation -- w/ State of Visual Tes...
Applitools
 

What's hot (20)

When you get lost in api testing #ForumPHP
When you get lost in api testing #ForumPHPWhen you get lost in api testing #ForumPHP
When you get lost in api testing #ForumPHP
 
Continous Integration: A Case Study
Continous Integration: A Case StudyContinous Integration: A Case Study
Continous Integration: A Case Study
 
Programming languages and techniques for today’s embedded andIoT world
Programming languages and techniques for today’s embedded andIoT worldProgramming languages and techniques for today’s embedded andIoT world
Programming languages and techniques for today’s embedded andIoT world
 
Kku2011
Kku2011Kku2011
Kku2011
 
Wrong Tool, Wrong Time: Re-Thinking Test Automation -- w/ State of Visual Tes...
Wrong Tool, Wrong Time: Re-Thinking Test Automation -- w/ State of Visual Tes...Wrong Tool, Wrong Time: Re-Thinking Test Automation -- w/ State of Visual Tes...
Wrong Tool, Wrong Time: Re-Thinking Test Automation -- w/ State of Visual Tes...
 
ESLint Plugin for UI Tests
ESLint Plugin for UI TestsESLint Plugin for UI Tests
ESLint Plugin for UI Tests
 
Security As A Code :
Security As A Code : Security As A Code :
Security As A Code :
 
The State of Testing 2017
The State of Testing 2017The State of Testing 2017
The State of Testing 2017
 
Developing Brilliant and Powerful APIs in Ruby & Python
Developing Brilliant and Powerful APIs in Ruby & PythonDeveloping Brilliant and Powerful APIs in Ruby & Python
Developing Brilliant and Powerful APIs in Ruby & Python
 
Top 5 Features To Look for in a Codeless Automation Solution -- Presentation ...
Top 5 Features To Look for in a Codeless Automation Solution -- Presentation ...Top 5 Features To Look for in a Codeless Automation Solution -- Presentation ...
Top 5 Features To Look for in a Codeless Automation Solution -- Presentation ...
 
Use Automation to Assist -Not Replace- Manual Testing
Use Automation to Assist -Not Replace- Manual TestingUse Automation to Assist -Not Replace- Manual Testing
Use Automation to Assist -Not Replace- Manual Testing
 
Continuous integration
Continuous integration Continuous integration
Continuous integration
 
Software Craftsmanship - It's an Imperative
Software Craftsmanship - It's an ImperativeSoftware Craftsmanship - It's an Imperative
Software Craftsmanship - It's an Imperative
 
Tales from the Dark Side: Ori Bendet Selenium Conference India 2016
Tales from the Dark Side: Ori Bendet Selenium Conference India 2016Tales from the Dark Side: Ori Bendet Selenium Conference India 2016
Tales from the Dark Side: Ori Bendet Selenium Conference India 2016
 
An Introduction to Dependency Injection
An Introduction to Dependency InjectionAn Introduction to Dependency Injection
An Introduction to Dependency Injection
 
ATAGTR2017 Static and dynamic code analysis for mobile applications - Act ear...
ATAGTR2017 Static and dynamic code analysis for mobile applications - Act ear...ATAGTR2017 Static and dynamic code analysis for mobile applications - Act ear...
ATAGTR2017 Static and dynamic code analysis for mobile applications - Act ear...
 
Browser Vendors are Reshaping Testing - Are You Ready?
Browser Vendors are Reshaping Testing - Are You Ready?Browser Vendors are Reshaping Testing - Are You Ready?
Browser Vendors are Reshaping Testing - Are You Ready?
 
How to Become an Effective Tester by Reusing Tests
How to Become an Effective Tester by Reusing TestsHow to Become an Effective Tester by Reusing Tests
How to Become an Effective Tester by Reusing Tests
 
Testing for Logic App Solutions | Integration Monday
Testing for Logic App Solutions | Integration MondayTesting for Logic App Solutions | Integration Monday
Testing for Logic App Solutions | Integration Monday
 
ATAGTR2017 Wearable App Testing
ATAGTR2017 Wearable App TestingATAGTR2017 Wearable App Testing
ATAGTR2017 Wearable App Testing
 

Similar to Migrate to microservices

From 0 to DevOps in 80 Days [Webinar Replay]
From 0 to DevOps in 80 Days [Webinar Replay]From 0 to DevOps in 80 Days [Webinar Replay]
From 0 to DevOps in 80 Days [Webinar Replay]
Dynatrace
 

Similar to Migrate to microservices (20)

Application Lifecycle Management
Application Lifecycle ManagementApplication Lifecycle Management
Application Lifecycle Management
 
Software Architecture and Architectors: useless VS valuable
Software Architecture and Architectors: useless VS valuableSoftware Architecture and Architectors: useless VS valuable
Software Architecture and Architectors: useless VS valuable
 
70% Improvement in Service and Product Delivery on Implementing DevOps
70% Improvement in Service and Product Delivery on Implementing DevOps70% Improvement in Service and Product Delivery on Implementing DevOps
70% Improvement in Service and Product Delivery on Implementing DevOps
 
Docker12 factor
Docker12 factorDocker12 factor
Docker12 factor
 
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer ToolsDevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
DevOps on AWS: Deep Dive on Continuous Delivery and the AWS Developer Tools
 
From 0 to DevOps in 80 Days [Webinar Replay]
From 0 to DevOps in 80 Days [Webinar Replay]From 0 to DevOps in 80 Days [Webinar Replay]
From 0 to DevOps in 80 Days [Webinar Replay]
 
IBM Think 2020 Openshift on IBM Z and LinuxONE
IBM Think 2020 Openshift on IBM Z and LinuxONEIBM Think 2020 Openshift on IBM Z and LinuxONE
IBM Think 2020 Openshift on IBM Z and LinuxONE
 
XebiaLabs, CloudBees, Puppet Labs Webinar Slides - IT Automation for the Mode...
XebiaLabs, CloudBees, Puppet Labs Webinar Slides - IT Automation for the Mode...XebiaLabs, CloudBees, Puppet Labs Webinar Slides - IT Automation for the Mode...
XebiaLabs, CloudBees, Puppet Labs Webinar Slides - IT Automation for the Mode...
 
Architectural Decisions: Smoothly and Consistently
Architectural Decisions: Smoothly and ConsistentlyArchitectural Decisions: Smoothly and Consistently
Architectural Decisions: Smoothly and Consistently
 
Architectural Decisions: Smoothly and Consistently
Architectural Decisions: Smoothly and ConsistentlyArchitectural Decisions: Smoothly and Consistently
Architectural Decisions: Smoothly and Consistently
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous Integration
 
Optimize your CI/CD with GitLab and AWS
Optimize your CI/CD with GitLab and AWSOptimize your CI/CD with GitLab and AWS
Optimize your CI/CD with GitLab and AWS
 
Building cloud native microservices
Building cloud native microservicesBuilding cloud native microservices
Building cloud native microservices
 
Jumping from Continuous Integration to Continuous Delivery with Jenkins Enter...
Jumping from Continuous Integration to Continuous Delivery with Jenkins Enter...Jumping from Continuous Integration to Continuous Delivery with Jenkins Enter...
Jumping from Continuous Integration to Continuous Delivery with Jenkins Enter...
 
Md Zahir Uddin
Md Zahir UddinMd Zahir Uddin
Md Zahir Uddin
 
Accelerate User Driven Innovation [Webinar]
Accelerate User Driven Innovation [Webinar]Accelerate User Driven Innovation [Webinar]
Accelerate User Driven Innovation [Webinar]
 
The Future of DevOps and UrbanCode
The Future of DevOps and UrbanCodeThe Future of DevOps and UrbanCode
The Future of DevOps and UrbanCode
 
Automating Applications with Habitat - Sydney Cloud Native Meetup
Automating Applications with Habitat - Sydney Cloud Native MeetupAutomating Applications with Habitat - Sydney Cloud Native Meetup
Automating Applications with Habitat - Sydney Cloud Native Meetup
 
Accelerating DevOps at the SF DevOps MeetUp
Accelerating DevOps at the SF DevOps MeetUpAccelerating DevOps at the SF DevOps MeetUp
Accelerating DevOps at the SF DevOps MeetUp
 
Build Time Hacking
Build Time HackingBuild Time Hacking
Build Time Hacking
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

Migrate to microservices

  • 1. Migrating huge monolith to microservices. ANDRIY TRUBITSYN, SOLUTION ARCHITECT November 11, 2017 How we did it in details.
  • 2. SPEAKER • SA at Microservice Accelerator in EPAM • Passionate microservices • Works in Java stack • Likes Python ANDRIY TRUBITSYN EPAM Systems, Solution Architect
  • 3. WHY SOMETIMES WE NEED MICROSERVICES Fast Time to Market Independent Development, Deployment Independent Scalability Resource Utilization Technology Heterogeneity https://martinfowler.com/articles/microservices.html
  • 4. HOW MIGRATION IS USUALLY PRESENTED
  • 6. THE BEGINNING • 200+ developers • 20 year old project with continuous development • Legacy technologies and everything is custom • 20 customer project editions • Many development teams without centralized governance
  • 7. CHALLENGES Modules: andrey@vm:~/project$ ls -l ./ | grep -c ^d 1710 Files: andrey@vm:~/project$ find ./ -type f | wc -l 226875 “Legacy code. The phrase strikes disgust in the hearts of programmers. It conjures images of slogging through a murky swamp of tangled undergrowth with leaches beneath and stinging flies above. It conjures odors of murk, slime, stagnancy, and offal. Although our first joy of programming may have been intense, the misery of dealing with legacy code is often sufficient to extinguish that flame.” ― Michael C. Feathers, Working Effectively with Legacy Code
  • 8. CHALLENGES Size: andrey@vm:~/project$ du -sh ./ 4,8G ./ 15:27:20 BUILD SUCCESSFUL 15:27:20 15:27:20 Total time: 2 hrs 15 mins 28.729 secs
  • 9. HOW WE DEVELOPED CA R1 Master CB R2CB R1 CA R3CA R1 CB R3 Sync Point A Sync Point B Unstable Code
  • 10. HOW WE ENABLE FEATURES M F1 F0 R0F1 F1 MasterCustomer A Customer B Step Time A: Find a slot to publish 2-3w A: Publish F1 to Master 1m A: Stabilize Master 2-3w B: Plans a slot 2-3w B: Merge F1 to branch B 1m B: Stabilize branch B 2-3w Total 4-5m
  • 11. OUR PLAN Split up codebase to components1 Establish independent release/branching and versioning strategies2 Find component owners (experts) for architecture governance3 Establish intensive testing, code analysis and component certification4 Extract microservices5 Apply software product line concept6
  • 13. COMPILE DEPENDENCIES IN THE MONOLITH
  • 15. DEPENDENCIES WE FIGHT AGAINST Compile Runtime via IoC, DI Binary Dependencies dependencies { compile project(':00006740') } dependencies { compile group: 'com...core', name: 'noname', version: property('this.component.version') } <BeanPolicies> <Policy id=“PolicyID"> <Bean impl=“com.ClassImpl"> <Property id=“id" val=“value"/> <Reference bean=“name" id=“id"/> </Bean> </Policy> </BeanPolicies>
  • 16. DEPENDENCIES WE FIGHT AGAINST Pricing Core Functionality XSD Schemas Rules, Utils UI Payment Connectors Adaptors OFM OMSearch Server Client Build Dependencies Graph • Some unexpected dependencies like Payment  Handlers.Land • New dependencies appears all the time from dev teams • Hard to detect circle dependencies (mixed types)
  • 17. CYCLE DEPENDENCIES Payment Component Core Component 3 4 5 2 1 Depends on Depends on Depends on • Business code in Core component • Utils code in business component • Core component has runtime dependencies on customer specific code
  • 18. “MIXED” DEPENDENCIES Customer A Customer B Order Management • Hard to detect • Hard to Fix • Dependency on Customer Binary dependency Run-Time dependency
  • 19. PRE-MICROSERVICES EAR WAR Framework Components (Core, Rules, Utils) WAR JAR(EJB) • No performance degradation • The same deployment procedure • Easy to find out bounded context for true microservices. • Give us a better view on future internal API
  • 20. NEW BRANCHING STRATEGY • Custom Code and Product code are to be separated • Git Lab approach for all teams • Features can be enabled immediately • We persist to support 2 latest releases of components Component Master Customer B Branch Customer A Branch Customer Development Branch Customer Development Branch
  • 21. NEW BRANCHING STRATEGY V1.0.x Release branch Feature branch Feature branch Master branch feature featurefeature feature V1.0.0 feature V2.0.0 feature V2.0.x Release branch V1.0.1 Hot Fix
  • 22. OWNER TEAMS • Each component (framework or business) has its owner team • Customer teams own their customer components • Owner teams reviews and merge all pull requests into their components • Owner teams consist of experts in specific areas • Virtual Owner Teams for framework components.
  • 23. RESPONSIBILITY PROBLEM • It is not my piece of code • I know who wrote this stuff, take this piece away from me • This is from another component, it is not mine "Oh that! Well Ray and Emil (they're no longer with the company) wrote that routine back when Jim (who left last month) was trying a workaround for Irene's input processing code (she's in another department now, too). I don't think it's used anywhere now, but I'm not really sure. Irene didn't really document it very clearly, so we figured we would just leave well enough alone for now…"
  • 24. COMPONENT CERTIFICATION Jenkins Artifactory Build & Test & Analyze Deploy with other components Publish results Pull/Push Artifacts deploys Push release candidate Customer A Integration Tests Integration Test Environment Run customer tests
  • 25. COMPONENT CERTIFICATION // Certified components set, registration date: 12.12.2016, // link: http://kb.mycompany.com/display/Component+Certification/45 dependencies { confName group: 'com...product.config', name: 'name', version: 1.1.8 confName group: 'com...core', name: 'name', version: 1.11.22 confName group: 'com...base.util', name: 'name', version: 2.21.12 confName group: 'com...services', name: 'name', version: 1.67.34 confName group: 'com...catalogue', name: 'name', version: 2.0.1 }
  • 26. CUSTOMER RELEASE STRATEGY Core Releases Core v1.0 Core v1.1 Core v1.2 Order Management Releases OM v2.0 OM v2.1 OM v2.2 Offer Management Releases OFM v1.3 OFM v1.5 OFM v1.6 Customer A Release Core v1.0 Order Management v2.0 Offer Management v1.3 Customer B Release Core v1.1 Order Management v2.2 Offer Management v1.5
  • 27. • Several Environments per a component (+25 servers) • New view and jobs (+200 new Jobs) • Many repositories (+60) • New user groups (+70) • New tools integrations: Jenkins+BitBucket, Sonar+BitBicket INFRASTRUCTURE CHANGES
  • 28. • Teams are afraid of responsibility • Teams are afraid to work on the common master • Teams are afraid of any new change • Automation tests are never enough • Think about your hardware as early as possible • Business involvement is very important COMPONENTIZATION – LESSONS LEARNT
  • 31. GOALS 2018 PMC AdServer Desktop Web Mobile B2B Security Tracing Logging Monitors Offer mgt Configs Pricing Search Order mgt Profile Payment Customer A UI v3.1 Customer B UI v2.2 • The monolith is splitted in the true microservices • The product supports multitenancy • The product runs in the private DC • The company sells API
  • 32. MICROSERVICES CHALLENGES Internal API Business transaction bounds Distributed Cache God object Technology Stack Data flow Internal communicati on protocol Common DB ?
  • 34. EXTRACTED MICROSERVICE • New deployment unit • LB configuration • Microservices intercommunication ??? Monolith Application Rules Core Utils Commons Profile Order Management Search Offer Management Extracted service Profile Rules Core Utils Commons Load Balancer
  • 35. INTERNAL API Class A Class B Container Class A Class B Container Container Public API Private API Method call • Protocol for internal API • God Object and Data Flow • Internal API Versioning
  • 36. BUSINESS TRANSACTION Order Management Business Logic Core ... Commons Offer Management Business Logic Core ... Commons Search Service Business Logic Core ... Commons Correct separation leads to proper designed API Order Management Business Logic Core...Commons Offer Management Business Logic Search Service Business Logic Monolith Application
  • 37. COMMON DATA BASE Two different services use common data Monolith Application Offer Management Extracted service Order Management Enforce requests to services instead of DB requests
  • 38. • God object (Blob) • Map<Object, List<Map<Object, Map>>> • No one knows what is inside PROBLEM WITH DATA FLOW Monolith Application Core Commons Profile Offer Management Extracted service Profile Rules Commons Utils Core
  • 39. DISTRIBUTED CACHE Extracted service Profile Rules Core Monolith Application Rules Core Profile Order Management Search Offer Management Distributed Cache Monolith Application Rules Core Profile Order Management Search Offer Management Cache
  • 40. SUMMARY Have a strong RnD team Thoroughly think of migration plan Do as small steps as possible Do regression tests after each small step Involve business and team leads in transformation process
  • 41. Migrating huge monolith to microservices. Q&A TIME

Editor's Notes

  1. 1. Low Time to Market ( feature in 2 weeks ) 2. Independent Scalability ( after some number of instance a saturation point appears , performance reduces when number of instances increases ) 3. Resource Utilization ( 300 requests  300 applications ) 4. Technology Heterogeneity
  2. 1. Add microservices platform 2. Divide modules to services, 3. Extract microservice: code, than DB, etc. 4. Cross functional teams etc.
  3. What business wants: improve drastically time to market in any price. A small dedicated team in 7 people was formed to do this migration.
  4. 1710 modules with java, csp, xml, wsdl, etc.
  5. Master is always unstable ( sometime can not be built ) All releases go from customer branches Teams do not trust each others and takes care about themselves only Code difference sometimes critical Some teams works in full code copy and do their stuff and than provide a JAR library to other teams. This fails often on runtime.
  6. Files are moved New business logic with extraterrestrial rules New method signatures
  7. 1. Split up codebase – improve development script, drastically reduce build time 2. Establish independent release cycle and versioning – improve delivery speed 3. Find component owners (experts) for architecture governance – responsibility and code quality 4. Establish intensive testing, code analysis and component certification – code quality 5. Extract microservices – flexible customization, independent development, deployment and scalability 6. Adopt product line architecture concept – Benefits Product lines can help organizations overcome the problems caused by resource shortages. Organizations of all types and sizes have discovered that a product line strategy, when skillfully implemented, can produce many benefits—and ultimately give the organizations a competitive edge.
  8. 1. It not simple to understand what if change something how it influence the entire landscape. 2. Teams breaks each one features 3. Build is to long to test a small change Structure 101 and JArchitect
  9. Framework components were divided by meanings Business components were given by management Integration components come from 3rd party systems Tools and applications are obvious Customer code is separated as well
  10. We have limited resources to deal with the 3rd dependencies.
  11. Build a graph with own groovy scripts, Run them time to time to see the current picture ( graphviz for work, manually for presentatios)
  12. 3. Example: core code call custom business rules to do workflow. We extracted this call processing to custom code.
  13. Hard to detect - on runtime Hard to Fix – need to know business logic
  14. War in EAR – pre microservices. Why WAR - ?
  15. Short live Feature branches Continues code integration Release/Long live branches Continuous Integration brings multiple benefits to your organization: 1. Say goodbye to long and tense integrations 2. Increase visibility enabling greater communication 3. Catch issues early and nip them in the bud 4. Spend less time debugging and more time adding features 5. Build a solid foundation 6. Stop waiting to find out if your code’s going to work 7. Reduce integration problems allowing you to deliver software more rapidly
  16. This is from another component – yes – but you implement dependencies we can not solve
  17. We can not certify each release for all customers Certification per a customer Certification and release pages for certified components sets
  18. We can not certify every component for every customer: It is too long It is not necessary Too many combinations ( 25 customers * 15 components = 375 )
  19. Changes/features happens faster than we can adopt them - we are a small team, more people is useless Business involvement is very important - Everyone is busy doing features ( we tried to found a window for 3 months ) 3 points about teams, yes, main complications are with people
  20. Build time of a customer release decreased from 2 hours to 10 minutes Early code integration metrics : Feature Enablement in two weeks instead of 4-5 months Test coverage drastically increased - Teams start write good tests in order to other teams can not break their part Code quality increased (technical debt goes down, we turn Sonar rules) Teams started talking to each other (sometime to loud but they become productive) Time estimations became more exact ( 1+1 = 2 not 3, because they do not calculate integration )
  21. Talk enough about this slide
  22. Internal API Business transaction bounds Common DB Internal communication protocol Distributed Cache Data flow and God object
  23. Adopt Netflix OSS use Spring Boot, Spring Cloud Try Spinnaker
  24. We are happy with DB - DB are already splitted into schemas, we need to track
  25. Protocol for internal API (HTTP+JSON, Ptotobuf+zlib)
  26. Business transaction dictates us high level API Correct separation leads to proper designed API
  27. We are happy there is business context bounds in DB. For every business flow step there is a dedicated schema in DB.
  28. God object affects performance a lot.
  29. New deployment unit Proper cache configuration