- First Lets consider a scenario

- Our Application is deployed on 3 servers and to access our application we have a load balancer in front of it
- Lets call the current version of the application be v1

- Now a version of the application V2 has to be deployed, So lets see the possible deployment strategies
Recreate
- In this strategy we shutdown V1 then deploy V2 after V1 is shutdown.
- This technique will lead to downtime

- Pros:
- Easier to Setup
- Cons:
- High impact on the user as there is a downtime.
Rolling updates
- IN this strategy we slowly rollout version 2 of the application and after they are ready we replace version 1 instance
- We would have the following terms to understand
- Max Unavailable: Number of unavailable instances during rolling update
- Max Surge: How many additional instances to add to current instance count
- batch size: Number of instances to rollout

- Pros:
- Convienient for stateful application
- Easier to setup
- Cons:
- Rollout/Rollback takes time
Blue/Green
- In this deployment strategy version 2 (green) is deployed along with Version 1 exactly in the same number of instances
- After testing the new version (version 2 /green), all the traffic is switched from version 1 (blue) to version 2 (green)

- Pros:
- Instant rollout/rollback
- Cons:
- Expensive as it requires double the resources
Canary
- This deployment is about gradually shifting production traffic from version 1 to version 2. Usally the traffic split based on weight.

- Pros:
- Fast rollback
- Convienient for error rate and performance monitoring
- Cons:
- Slow Rollout
A/B testing
- In this deployment, susbset of users are selected and given the new functionality (version 2) under specific conditions
- Some conditions are
- By browser cookie
- Query Paramenters
- Geo localization
- Language

- Pros:
- Full control over traffic distribution
- Several versions in parallel
- Cons:
- Requires intelligent load balancer
- Hard to troubleshoot issues
Shadow
- In this deployment model the fork of version 1’s incoming are also sent to version 2.
- This is particularly use to test production load on new feature
- Version 2 some of the components can be mock services

- Pros:
- Performance testing of application with production traffic
- Cons:
- Expensive
- Not a true user test and some times can be misleading
