Everything you need to know about Blue Green Deployments

Everything you need to know about Blue Green Deployments

Blue Green Deployment is a deployment pattern that reduces the downtime during deployment by running two identical production setups called - Blue and Green.

During deployment when we reboot the API servers there are chances that the incoming request fail because the server is unresponsive for a short period. Also, it might happen that the release had a major bug and we need a quick rollback.

How can we achieve both of them in one shot? The answer is Blue Green Deployment.

Implementation

Blue Green deployment is implemented by having a separate fleet of infrastructure for the old version - Blue and the new version - Green. The new infrastructure is identical to the old one.

The deployment flow

  1. the new deployment artifact is tested and kept ready to be deployed
  2. a parallel infrastructure is set up identical to the existing
  3. the new version is deployed on the new fleet - Green
  4. the correctness of the setup is validated
  5. the proxy is re-configured to now forward 100% of traffic from the Blue (old) setup to the Green (new) setup
  6. a final sanity test is run on the new fleet
  7. the blue fleet is now shut down

Pros of Blue Green Deployment

  1. rollbacks are just a config change and hence quick
  2. downtime during deployment is minimal
  3. deployment is just a flip of a switch
  4. disaster recovery is simple given we already have the automation to build a parallel setup
  5. deployments can now happen during the working hours
  6. debugging a failed deployment is simple as we have the infrastructure with the debug information handy

Possible challenges

  1. during the deployment, the infrastructure cost shoots 2x
  2. the stateful application would need to rebuild the state on new servers
  3. the database would have to be shared between the fleets
  4. any schema migration on the database needs to be backward and forward compatible
  5. the API responses have to be forward and backward compatible
  6. setting up this deployment strategy for the first time is difficult

When to use Blue Green Deployment?

  • when you need zero downtime deployment
  • your infrastructure can tolerate 100% traffic switch
  • you can bear the 2x cost of infrastructure during deployment

Points to remember

  • have a solid automation test suite to validate the correctness
  • ensure forward and backward compatibility of API and schema changes
  • infra cost will shoot up hence minimizing the time for which you are running 2x infra

Here's the video of my explaining this in-depth ?? do check it out

Deployments are a pain if we are unsure about our release changes. But sometimes even if we know our changes well, something weird could happen in the infra that would fail your deployment and put your infra in an inconsistent state.

So, is there a way to address this? What if we have a place to deploy our changes and validate them before they hit production; and have a quick way to roll back if something goes wrong?

This is the core idea behind a Blue-Green Deployment

In this video, we take an in-depth look into a blue-green deployment pattern, understand why we need them, what problem it addresses, learn how they are implemented, talk about its benefits and challenges, and conclude with some points to remember when you adopt this deployment pattern.

Outline:

  • 00:00 Agenda
  • 03:13 An introduction to Blue-Green Deployments
  • 06:36 Why do we need Blue-Green Deployments
  • 09:12 How Blue-Green Deployment is implemented?
  • 13:26 Pros of having a Blue-Green Deployment
  • 19:49 Challenges in having a Blue-Green Deployment
  • 25:36 When to use Blue Green Deployments
  • 26:39 Key points to remember while adopting Blue Green Deployment

You can also

Thank you so much for reading ?? If you found this helpful, do spread the word about it on social media; it would mean the world to me.

You can also follow me on your favourite social media LinkedIn, and Twitter.

Yours truly,

Arpit

arpitbhayani.me

Until next time, stay awesome :)

No alt text provided for this image

I teach a course on System Design where you'll learn how to intuitively design scalable systems. The course will help you

  • become a better engineer
  • ace your technical discussions
  • get you acquainted with a massive spectrum of topics ranging from Storage Engines, High-throughput systems, to super-clever algorithms behind them.

I have compressed my ~10 years of work experience into this course, and aim to accelerate your engineering growth 100x. To date, the course is trusted by 600+ engineers from 10 different countries and here you can find what they say about the course.

Together, we will build some of the most amazing systems and dissect them to understand the intricate details. You can find the week-by-week curriculum and topics, benefits, testimonials, and other information here https://arpitbhayani.me/masterclass.

Susmita Mitra

Lead Software Engineer and scrum master

2 年

arey mujhe baki ka cartoon dekhna tha

More about me: arpitbhayani.me Newsletter: arpitbhayani.me/newsletter Subscribe #AsliEngineering for such in-depth engineering concepts: https://www.youtube.com/c/ArpitBhayani Check out my System Design course: arpitbhayani.me/masterclass

回复

要查看或添加评论,请登录

Arpit Bhayani的更多文章

  • Engineer or Manager? How to Decide Your Path

    Engineer or Manager? How to Decide Your Path

    This edition of the newsletter contains one quick write-up that will help you grow faster in your career a video I…

    5 条评论
  • One Career Bet Worth Taking

    One Career Bet Worth Taking

    This edition of the newsletter contains one quick write-up that will help you grow faster in your career a video I…

    5 条评论
  • Leave your job with grace and gratitude

    Leave your job with grace and gratitude

    This edition of the newsletter contains one quick write-up that will help you grow faster in your career a video I…

    7 条评论
  • Turn Boring Projects into Opportunities

    Turn Boring Projects into Opportunities

    This edition of the newsletter contains one quick write-up that will help you grow faster in your career a video I…

    1 条评论
  • When is the right time to switch?

    When is the right time to switch?

    This edition of the newsletter contains one quick write-up that will help you grow faster in your career a video I…

    8 条评论
  • Ramping up faster in your new job

    Ramping up faster in your new job

    This edition of the newsletter contains one quick write-up that will help you grow faster in your career a video I…

    4 条评论
  • Back Your Disagreement with Data

    Back Your Disagreement with Data

    This edition of the newsletter contains one quick write-up that will help you grow faster in your career a video I…

    2 条评论
  • Doubt yourself every day

    Doubt yourself every day

    This edition of the newsletter contains one quick write-up that will help you grow faster in your career a video I…

    9 条评论
  • Not everything needs to be dumbed down

    Not everything needs to be dumbed down

    This edition of the newsletter contains one quick write-up that will help you grow faster in your career a video I…

    11 条评论
  • The best resource does not exist.

    The best resource does not exist.

    This edition of the newsletter contains two quick write-ups about The best resource is mythical Convergent Encryption I…

    4 条评论

社区洞察

其他会员也浏览了