In this meetup Pavel will talk about the strategies and roadmap that Deporvillage has used to migrate from a legacy monolith to microservices.
The talk will focus not only on certain technological aspects of the transition like software design patterns, architecture, monorepos, build pipelines, etc. But also challenges faced during the transition - technical, business and process
7. Why It Had to Go Away
● Ugly Monolith - The Company Grew Too Fast
● Too many WTF is this in the code base
● Hack Solutions.
● Solutions that worked with 10M revenue wouldn’t work for
100M
● Legacy Codebase - PHP for everything
● One single MySQL DB for all data - Transactional or otherwise
● Scale! Scale! Scale!
9. ● Another Monolith?
● E-Commerce Domain Microservices
● Leverage other programming languages - Golang,
Node.JS
● Independent Scalability
● Talent Acquisition & Retention
Because it is Cool? (sic)
14. Problems
&
Steps
Shipping Rate &
Timing Calculation
is a piece of Shit!
01
03
02
01
02
03
Order Flow into
ERP System
Transactional
Mails are
Incoherent
Shipping
Service
Order Service
Notification
Service
15. ● 1st Microservice
● Written in PHP
● Own Data Store - MongoDB
● Reuse logic from “Older scripts”
● New Platform CI/CD Pipeline - Containers
● Plugs into Checkout - Impact!
● Uses Queue to process non web info - Carrier Statuses
Shipping Service
16. ● Still Written in PHP
● Own Data Store - MongoDB
● Uses the Platform CI/CD Pipeline - Containers
● ERP/Warehouse uses this instead of Magento API for
order retrieval - Impact!
● Uses Queue to import orders from Magento - Scale
Order Service
17. ● Reuse a POC written in PHP
● Own Data Store - MongoDB
● The Platform CI/CD Pipeline is getting complex
● Sends Your order has been shipped email - Impact
● Uses Queues to Send Emails - Scale
● Uses different emailing channels for different types of
email - $$$
Notification Service
28. Data Sync
Magento
One of the Other
Microservice Data
Store
● Catalog Data
○ Stock
○ Price
○ Photos
○ Description
● Configuration Data
○ Settings
○ Exchange Rates
○ Categories
○ Tax Data
Message Queue
Workers
30. ● No - Not because Google, Facebook, Twitter use it.
● Atomic Pull Requests for cross-service feature requests
● Easy to adapt for devs coming from a Monolith Codebase
● Faster dev environment Setup
● Single Pipeline for CI/CD is simpler in the beginning
● Cross team pull requests are easier
Why Monorepo?
32. ● Standardized container types
○ api | app | worker | job
● Heavy use of docker-compose
○ --no-deps | depends
● Single docker network between Legacy & Platform in
local environment
● dev-entrypoints for dev specific bootstrapping/tweaks -
nodemon for e.g
● Application config is environment dependent
Containers - Docker
33. ● master gets deployed automatically to Staging.
● pull-requests are built and tested automatically
● unit tests are executed using the docker images directly -
custom entrypoint for docker run
● api/functional tests are not part of the CD pipeline
● We use bitbucket pipelines for CI/CD (docker based)
● We use gocd for running api/functional tests
● Slack for monitoring ci/cd events
Containers - CI/CD
34. ● K8S for all environments - test, staging, production
● Amazon EKS - Managed K8S Control Plane
● When tuned properly - horizontal pod autoscaler works
like a charm
● Use of Public & Private ingress controllers
● Pod health checks for monitoring
● Affinity parametres for distributing heavier
microservices onto different nodes
Containers - K8S
38. ● Improved Business KPIs - Avg. Page Load Time, Avg
Server Response Time, Conversion %
● Code Coverage - Non existent to >85%
● Modularity - Faster development of newer features
● Maintainability - Not a 10 year old hacked off php
codebase anymore
● Scalability - The platform scales to 8x traffic without
additional hardware (real stress tests)
Wins - A lot of Them!
40. ● Untangling Legacy codebase is messy!
● Requirements be like - Exactly like how it works
currently
● Delivery Forecasting is not easy, complexity of
deliverables changes in-transit
● Distributed Systems are massively complex than
monoliths - consistency, pipelines, logging, tracing
● Learning Curve - a lot of new things in the picture now
Challenges - Always, always!