Enterprise Micro-Service Architecture - CI - CD Orchestration Under Micro-Service

Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Enterprise Micro-service

Architecture - CI/CD
orchestration under Micro-
service
Dao Hong Duc
I. Microservice as a pattern
A. What are Microservices and common misunderstandings in design.
B. Common pattern in designing Microservices-with tech-stack example

Glossary
I. Problems with Microservice
A. From technical standpoint
B. From management/organizational standpoint

I. Overview of CI/CD under divided system


A. What is CI/CD and common technologies
B. CI/CD orchestration under Micro-service

I. Enterprise Microservice-Case Study of Netflix


A. Netflix Microservice Architecture
B. How Netflix changed after the migration to Microservice
C. Migrating an application from Monolith to Microservices on the Cloud - First-hand
experience
Microservice as a pattern

How can Microservice be defined?

● Microservices are an architectural and organizational approach to software development where


software is composed of small independent services that communicate over well-defined APIs.
These services are owned by small, self-contained teams.
● Microservices architectures make applications easier to scale and faster to develop, enabling
innovation and accelerating time-to-market for new features.
● With a microservices architecture, an application is built as independent components that run
each application process as a service.

Source: https://aws.amazon.com/microservices/#:~:text=Microservices%20are%20an%20architectural%20and,small%2C%20self%2Dcontained%20teams.
Microservice as a pattern

Common misconception

- Even if the application is broken down into


micro components, each component should
be hosted on a separated hardware.
- Each component should only capture a single
process of the business.
- A single development team works and
maintains all services.

Source: https://viblo.asia/p/tim-hieu-ve-microservice-Do754PD45M6
Problems with Microservice

Technical drawbacks:

● Increase system complexity leads to difficulties in maintenance and feature extension


● Due to separation of services into isolated hardware and communication via a network channel,
this will introduce network latency/ package transfer rate between them.
● Since each component own an isolated database, this would require more effort to synchronize
data.
● Introduce many monitoring channels and require a overseer channel to keep track of all
components.
● More CI/CD pipeline to extend and maintain.
Problems with Microservice

Management drawbacks:

● The increase in number of development teams mean that more sub managers are required for each
team.
● Complication will arise in communication between teams, this potentially makes it harder to
develop feature that require connection between components.
● Make the process of rotating developer between development teams due to high ownership.
● Create blockage if one team’s work depend on one another.
Overview of CI/CD under divided system

What is CI/CD and its purpose?

● CI/CD stands for Continuous Integration/


Continuous Delivery which is a automated
software deployment pipeline that enable quick
delivery of new feature to clients.
● CI/CD reduce both cost and time to get new code
from a commit into production, encompassing the
build, test (including integration tests, unit tests,
and regression tests), and deploy phases, as well
as infrastructure provisioning.
● As applications grow larger, the features of
CI/CD can help decrease development
complexity.
Overview of CI/CD under divided system

CI/CD fundamentals

● A single source repository


● Frequent check-ins to main branch
● Automated builds
● Self-testing builds
● Frequent iterations
● Stable testing environments
● Maximum visibility
● Predictable deployments anytime
Overview of CI/CD under divided system

CI/CD orchestration under Micro-service

● Each component should be hosted into its own code repository which is equipped with its own
CI/CD pipeline.
● Smaller software component enable PR environment which is extremely helpful to UAT new
feature before marking it as production ready.
● Each pipeline must have a production deployment strategy. (e.g: blue/green swap, Recreate
deployment, Canary, etc..)
● Each pipeline must has its own alarm system and alarm channel.
● Host CI/CD runner on multiple hardware and separate them for each component if possible.
Overview of CI/CD under divided system

Popular CI/CD technologies:

Open-source:
Commercial:
Microservice as a pattern

Common technical design for Microservice

- Traffics from clients to services must be load-controlled and


distributed depending on certain criteria (latency, service
availability, account tier, etc..). Tech: aws load-balancer, nginx
controller, etc..
- Components are connected via APIs which each component
expose. Tech: nginx, aws api-gateway,route53, akamai, zuul
- Each component has to be monitored with heath-checks and
analyzed with operation logs. Tech: splunk, newrelic, aws
cloudwatch
- Since each component should be independently operational
within its own context, it has to be packaged/ containerized.
Tech: docker, aws elasticbeanstalk, aws fargate, aws ec2,
firebase.
- For event-driven system, a stream of events must be
established. Tech: aws SQS, kafka, rabbitmq

Source: https://medium.com/@madhukaudantha/microservice-architecture-and-design-patterns-for-microservices-
e0e5013fd58a
Enterprise Microservice-Case Study of Netflix

Netflix architect diagram

Source: https://www.geeksforgeeks.org/system-design-netflix-a-complete-architecture/
Enterprise Microservice-Case Study of Netflix

Netflix changed a from DVD rental business to 100B dollar business, overtaking major streaming
platforms.

Number of subscribers Revenue worldwide 2022


Microservice as a pattern

How to plan your migration from Monolith to Microservices safely (personal experience)

I. Deep analysis of current system:


A. Identify existing business subdomains and set a functionality boundaries.
B. Identify applying technologies and how they can be replaced.
C. Identify from the least dependent components to vital components which are highly interconnected.
D. Analyze database schema and have a detailed plan how to distribute it into smaller shards.
II. Design your Microservice architecture
A. Design network routing between services. Auto scaling of services should also be considered.
B. Design network routing between client and services. Load balancing should also be considered.
C. Design public interfacing network.
III. Build CI/CD pipelines for each component
A. Each pipeline should be equipped with blue/green swap mechanics in case something goes wrong.
B. Automate infrastructure bootstrapping.
C. Set up pipeline alarm channel.
IV. Plan development phase
A. Balancing between system migration and developing new feature.
B. Apply sticky canaries testing and fully switch out the component when ready.
C. Always on the ready to revert in case of emergency
V. Post-deployment and monitoring
A. Run integration tests of the old system against the new one to ensure quality/fullness.
B. Each migrated component must be tracked and have alarms installed.
C. (Optional) Regularly have failure tests against the system ( Netflix named it Chaos Monkey)
Thank you for listening

Q&A

You might also like