Top 5 Most-Used Deployment Strategies in Software Engineering
Inside the issue, Strategies, benefits, drawbacks and when to use each one.
The DevOps Guide to maintaining High Availability and Fault Tolerance(sponsored)
Running Kubernetes at scale can be a headache piecing together load balancers and replicating complex config files. ngrok makes it super simple to balance traffic between two (or many, many) Kubernetes cluster with just one trick (just kidding).
Check out ngrok's guide to multi-cluster load balancing and you'll be up and running in less than 5 minutes, we swear. It's so fast, we speed ran it in a 60 second video in the docs. Give it a whirl.
Hi—this is Kisan from The Cloud Handbook. Each week I share about Cloud, DevOps, System Design deep dives and technologies around it. If you are enjoying my newsletter please share it with your friends and colleagues. I will really appreciate it.
Deploying software is one of the most critical phases in the software development lifecycle. The strategy you choose can mean the difference between a best user experience and a catastrophic outage.
In this week issue of The Cloud Handbook, we'll explore the most widely-used deployment strategies, their benefits, drawbacks, and when to use each one.
Let’s get started!
Rolling Deployment
Rolling deployment is the gradual replacement of old application instances with new ones. Instead of updating all servers at once, you update them one by one or in small batches.
How it works:
The deployment process starts by taking one server out of the load balancer, updating it with the new version, running health checks, and then putting it back into rotation. This process continues until all servers are updated.
Benefits:
Zero downtime during deployment
Immediate rollback capability by stopping the process
Lower resource requirements compared to blue-green deployments
Easy to implement with most orchestration tools
Drawbacks:
Slower deployment process
Mixed versions running simultaneously during deployment
Database migrations can be complex
Requires careful handling of breaking changes
Best for: Applications that can handle temporary version inconsistencies and have good backward compatibility.
Blue-Green Deployment
Blue-green deployment maintains two identical production environments. At any time, only one environment serves live traffic while the other remains idle.
How it works:
Deploy the new version to the idle environment (let's call it "green"), run all tests and verifications, then switch traffic from the current environment ("blue") to the new one. The blue environment becomes the new idle environment.
Benefits:
Instant rollback by switching traffic back
Zero downtime deployment
Full testing possible before switching
Clean separation between versions
Drawbacks:
Requires double the infrastructure resources
Database synchronization challenges
More complex configuration management
Higher costs due to duplicate environments
Best for: Critical applications where instant rollback is essential and infrastructure costs are not a primary concern.
Canary Deployment
Canary deployment involves releasing the new version to a small subset of users before rolling it out to everyone. This strategy gets its name from the "canary in a coal mine" concept.
How it works:
Deploy the new version alongside the old version, but route only a small percentage of traffic (typically 5-10%) to the new version. Monitor metrics, user feedback, and system performance. Gradually increase traffic to the new version if everything looks good.
Benefits:
Early detection of issues with minimal user impact
Real-world testing with actual user traffic
Gradual confidence building
Easy to halt deployment if problems arise
Drawbacks:
Requires sophisticated traffic routing
Complex monitoring and alerting setup
Longer deployment timeline
Need for feature flags or routing logic
Best for: Consumer-facing applications where user experience is critical and you want to minimize risk.
A/B Testing Deployment
Similar to canary deployment, A/B testing involves running multiple versions simultaneously, but the focus is on comparing different features or user experiences rather than just new vs. old.
How it works:
Deploy different versions to different user segments, collect metrics on user behavior, conversion rates, and other KPIs, then decide which version to keep based on data.
Benefits:
Data-driven decision making
Ability to test multiple variants
Reduced risk of negative user impact
Valuable insights into user preferences
Drawbacks:
Requires robust analytics infrastructure
Complex traffic management
May confuse users with inconsistent experiences
Requires careful experiment design
Best for: Applications where user experience optimization is crucial and you have the infrastructure to support sophisticated testing.
Recreate Deployment
Recreate deployment is the simplest strategy where you shut down the old version completely before starting the new one.
How it works:
Stop all running instances of the current version, deploy the new version, and start the new instances.
Benefits:
Simple to implement and understand
No version conflicts
Minimal resource requirements
Clean state transitions
Drawbacks:
Downtime during deployment
Risk of extended outages if deployment fails
No immediate rollback capability
User experience disruption
Best for: Internal tools, development environments, or applications where brief downtime is acceptable.
Shadow Deployment
Shadow deployment involves running the new version alongside the production version, sending a copy of live traffic to both, but only serving responses from the production version to users.
How it works:
Duplicate incoming requests and send them to both the production and shadow environments. Monitor the shadow environment's performance and behavior without affecting users.
Benefits:
Test with real production traffic
No user impact during testing
Comprehensive performance validation
Safe way to test at scale
Drawbacks:
Double the resource consumption
Complex traffic mirroring setup
Potential data consistency issues
Requires careful handling of side effects
Best for: Critical systems where you need high confidence in new versions before exposing them to users.
Choosing the Right Strategy
The best deployment strategy depends on several factors:
Consider your tolerance for downtime: If zero downtime is critical, avoid recreate deployments. Blue-green or rolling deployments are better choices.
Evaluate your infrastructure capacity: Blue-green and shadow deployments require significant additional resources. If cost is a concern, consider rolling or canary deployments.
Assess your rollback requirements: How quickly do you need to rollback if issues arise? Blue-green offers the fastest rollback, while rolling deployments require more time.
Think about your user base: Consumer applications often benefit from canary deployments to minimize user impact, while internal tools might tolerate recreate deployments.
Consider your team's expertise: Some strategies require more sophisticated tooling and monitoring. Start with simpler approaches if your team is new to advanced deployment practices.
Best Practices Across All Strategies
To learn more about State of DevOps and more about software delivery performance, read 2024 State of DevOps Report from Google here.
Regardless of which deployment strategy you choose, certain practices will improve your success rate:
Implement comprehensive monitoring and alerting to quickly detect issues during and after deployment.
Use automated rollback mechanisms to minimize manual intervention during crisis situations.
Maintain detailed deployment logs for troubleshooting and audit purposes.
Practice your deployment process in staging environments that mirror production.
Have a clear communication plan for notifying stakeholders about deployments and any issues.
Invest in good testing practices including unit tests, integration tests, and automated acceptance tests.
Conclusion
Modern deployment strategies have evolved far beyond the simple "upload and pray" approaches of the past. Each strategy offers different trade-offs between safety, speed, cost, and complexity. The key is understanding your specific requirements and constraints, then choosing the strategy that best aligns with your needs.
The goal isn't to use the most advanced deployment strategy, but to use the one that best serves your users while fitting within your operational capabilities. Start with what works for your current situation, and evolve your approach as your needs and capabilities grow.
Learning Resources
https://docs.aws.amazon.com/whitepapers/latest/introduction-devops-aws/deployment-strategies.html
https://learn.microsoft.com/en-us/azure/app-service/deploy-best-practices
https://learn.microsoft.com/en-us/azure/well-architected/operational-excellence/safe-deployments
https://www.gitclear.com/research/google_dora_2024_summary_ai_impact
https://cloud.google.com/blog/products/devops-sre/announcing-the-2024-dora-report
Liked this article? Feel free to drop ❤️ and restack with your friends.
If you have any feedbacks or questions 💬, comment below. See you in the next one.
Get in Touch
You can find me on Twitter, Linkedin.
If you want to work with me or want to sponsor the newsletter, please email me at kisan.codes@gmail.com.
Do bank applications follows re create deployment strategy, because we see scheduled downtimes issue ?