5. A proper deployment and testing strategy is paramount to any production deployment:
●
How to minimize the application downtime
●
How to manage and resolve incidents with minimal impact on users
●
How to address failed deployments in a reliable effective way (rollback)
●
How to minimize people and process errors to achieve predictable, repeatable
deployments (automated processes)
THE NEED
6. Multiple deployment strategies / patterns identified
●
Recreate deployment pattern
●
Rolling update deployment pattern
●
Blue-Green deployment pattern
●
Canary test deployment pattern
●
A/B test pattern
●
Shadow test pattern
DEPLOYMENT STRATEGIES / PATTERNS
7. Version 1 is terminated and Version 2 is rolled out.
RECREATE DEPLOYMENT PATTERN
8. Pros:
●
Simplicity. No need to manage more than one application version at a given time.
●
Can avoid backward compatibility challenges
Cons:
●
Involves a downtime during the update process.
●
Not suitable for mission critical applications
RECREATE DEPLOYMENT PATTERN
9. Version 2 is gradually rolled out and replaces Version 1.
ROLLING UPDATE DEPLOYMENT PATTERN
10. Pros:
●
No downtime – incrementally updates the deployment targets based on the “window
size (number of instances that you roll out)”
●
Reduced deployment risk – Easy to setup
●
Handling stateful application is comparatively easy.
Cons:
●
Slow rollback - If something goes wrong in the new replicas, redeployment is needed
for those new replicas
●
Backward compatibility - Because new code and old code live side by side, users
might be routed to either one of the versions arbitrarily. The new application version
can read and handle data that the old version stores
ROLLING UPDATE DEPLOYMENT PATTERN
11. Version 2 is release alongside Version 1. The traffic is switched to Version 2 after it is
fully tested.
Performs two identical deployments, where “blue” represents the “current”
application and the “green” represents the “new” application version, which is created
and tested. After the deployment succeeds, you can either keep the “blue”
environment or decommission it.
BLUE GREEN DEPLOYMENT PATTERN
13. Pros:
●
Zero downtime
●
Instant rollback – You can rollback at any moment by adjusting the Load Balancer to
by direct traffic back to the “blue” environment.
●
Environment separation can reduce the deployment risk.
Cons:
●
Cost and operational overhead by having a duplicate environment
●
Need to test Version 2 properly before the cut over
●
Handling stateful applications can be hard - If you plan to decomposition the current
version, it is required to allow appropriate connection (session) draining on existing
transactions and sessions. This allows requests processed by the current deployment
to be completed or terminated gracefully.
BLUE-GREEN DEPLOYMENT PATTERN
15. Version 2 is released to subset of users followed by a full roll-out.
Usually the traffic is split based on the weight. For example 70% of the requests will go
to Version 1 and 30% of the traffic will go to Version 2. Gradually you can increase the
Version 2 traffic until it is completed rolled out.
CANARYTEST DEPLOYMENT PATTERN
18. Pros:
●
Versions can be released for a subset of users. Can be a very effective feature when it
comes to feature releases.
●
Fast rollback
●
Zero downtime
●
Good strategy to detect problems in the new release
Cons:
●
Slow rollout
●
Backward compatibility and sticky sessions
CANARY DEPLOYMENT PATTERN
19. Version 2 is released under “specific
conditions” to a subset of users.
You route a subset of users based on
routing rules
It is a good technique for making
business decisions based on statistics
rather the deployment strategy.
Routing rules often include factors such
as
●
Query parameters, browser version, user
agent, geo location, language and
operating system
A/B TEST PATTERN
20. Pros:
●
Can run several versions in parallel for many conditions/ rules
Cons:
●
Requires an intelligent Load Balancer (Application Load Balancer) for intelligent
routing
●
Troubleshooting could be hard
A/B TEST PATTERN
21. Version 2 received real world traffic
without impacting user requests.
You deploy and run a new version
alongside the current version, but in
such a way that the new version is
hidden from the users
Shadow testing is fairly complex to set
up. Also, like blue/green deployments,
shadow deployments carry cost and
operational implications because the
setup requires running and managing
two environments in parallel.
SHADOW TEST PATTERN
22. Pros:
●
Can do production testing of the target application with the production traffic.
●
No rollout until the stability and performance of the application meets the
requirement
Cons:
●
Expensive as it requires double the resources
●
Complex to setup
●
Requires quite a few mocking service to test some critical use cases (such as
payment features, which can otherwise will lead to double payments)
SHADOW TEST PATTERN
24. BEST PRACTICES
Backward compatibility - Ensure that the database is compatible with all active
versions. You may use “Parallel Change Pattern” to implement this.
Following a proper CI/CD pipeline
Configuration management
Implementing a rollback strategy
Post deployment monitoring
25. REFERENCES
Introduction to Deployment Strategies - https:/
/harness.io/blog/continuous-
verification/blue-green-canary-deployment-strategies/
Application Deployment and Testing Strategies -
https:/
/cloud.google.com/architecture/application-deployment-and-testing-strate
gies
https:/
/martinfowler.com/tags/continuous%20delivery.html
Six Strategies for Application Deployment -
https:/
/thenewstack.io/deployment-strategies/
Four Deployment Strategies for Microservices Deployment -
https:/
/www.infoworld.com/article/3565750/4-deployment-strategies-for-resilient
-microservices.html