[SURVEY RESULTS] The 2024 edition of State of Software Modernization market report is published!
GET IT here

Blue/Green Deployment for Legacy App Modernization

readtime
Last updated on
January 22, 2024

A QUICK SUMMARY – FOR THE BUSY ONES

Blue/Green deployment for legacy system modernization

In a legacy app modernization project, blue/green deployment is used to minimize risk and downtime.

TABLE OF CONTENTS

Blue/Green Deployment for Legacy App Modernization

Introduction

If you’re planning to modernize your legacy app, we bet you’re considering one or a few of the available approaches. The biggest question is: how to modernize the environment without breaching the system’s stability and security?

If you resonate with these challenges, it’s time to find out the Blue/Green deployment strategy that can help you upgrade your app with no harm to user experience.

Legacy app modernization challenges

For all businesses aiming to expand their products and offer, foster innovation, improve overall operations, and align technology with business strategies, the modernization of their legacy app becomes one of the top priorities.

High maintenance costs, and escalating system downtime are clear symptoms that the application requires modernization and a definite call for a transformative approach. Outdated technology not only hampers scalability but also stifles innovation, and restrains further product development.

This means that overcoming the challenge of modernizing legacy apps is not just a technical necessity but a strategic imperative for businesses aspiring to maintain competitive advantage and outstanding business results.

If you’re currently struggling with the challenges mentioned above, let’s delve into one of the top strategies that can help you to successfully get through this transformation.

What is Blue/Green deployment?

To put it simply, the Blue/Green deployment strategy is an application release model that involves the gradual transfer of user traffic from a former version of the application or microservice to a new release, while both of them are running parallelly in the production environment. 

The term “Blue” refers to the old version of the application, while “Green” to the new one. Right after the traffic is fully transferred from one environment to another, the Blue version can remain as a template for the next updates, or a backup, in case rollbacks are necessary.

Applying the Blue/Green deployment strategy helps to avoid downtime the traffic can be instantly switched to the Blue environment in case any issue or failure occurs. 

How does Blue/Green deployment work? 

To execute the Blue/Green deployment strategy successfully, it is essential to create two identical production environments equipped with a router, load balancer, or service mesh capable of redirecting traffic between them.

The typical steps of the Blue/Green deployment process are the following:

  1. Duplicating resources
  2. Deployment of the new (green) version
  3. Switching over the traffic (from blue to green)
  4. Monitoring of interactions and performance of the new version
  5. Rollback (in case of problems) or deployment (if there are no issues).

Take a look at the graphic below:


Blue/Green deployment during legacy app modernization - why to choose it?

Benefits of Blue/Green deployment

Before we proceed to blue/green development use cases, let’s mention a few major benefits of using this approach:

  • Preventing deployment downtime
  • Allowing for a large and scalable infrastructure setup
  • Ability to design and support two different versions of the application in production
  • Possibility of instant rollbacks (if an issue is detected in the green environment, you can quickly revert back to the blue environment, ensuring stability and continuous service.)
  • Reduced risk of losing data or testing in production
  • Testing in production-like environment
  • Controlled deployment process
  • Not compromising UX
  • Swift testing.

<span class="colorbox1" fs-test-element="box1"><p>One of the key benefits of blue/green deployment is the ability to minimize downtime during the deployment process. This is crucial for legacy applications, as they often support critical business processes. By having two identical environments (blue and green), you can switch traffic from the old (blue) environment to the new (green) environment without any downtime.</p></span>

Use cases of Blue/Green deployment

When this approach is the most helpful?

  • Rapid releases
    The Blue/Green deployment strategy is useful when working with a CI/CD framework, in which pushing the software into production is one of the main goals. It not only enables going live quickly, but also achieving it at a minimized risk. The software can be released anytime, without detailed scheduling, as it will not impact users by causing downtime.
  • Swift rollbacks
    In case there are any occurring failures, the Blue/Green deployment strategy always provides the solution for going back to a more stable version of the application and recreating whatever is needed. This mitigates the risk of critical errors and data loss, provides space for experimenting, and supports disaster recovery.
  • Testing in production
    Although both Blue and Green environments are nearly identical, there are always minor differences between them. In this way, data transfer may lead to bugs that cannot be revealed until the new version enters the production phase. A Blue/Green deployment strategy allows swift testing right in a production environment with no harm to user experience.
  • A/B testing
    When applying Blue/Green deployment, it is possible to send some part of the traffic (usually 50%) to the Blue version while the rest is sent to the new one. This enables performance monitoring and verifying whether the new platform works according to key metrics.
  • Load balancing
    The next potential use case is load balancing, meaning balancing traffic between Blue and Green production environments. This is possible as the two production environments operate on separate servers.

Blue/green deployment offers a safer, more controlled way to update and modernize legacy applications, reducing the risk of downtime and other deployment-related issues while enabling thorough testing and gradual rollout.

Blue/Green Deployment best practices in legacy app modernization

So what are the best practices for using the Blue/Green deployment strategy in legacy app modernization?

  • Database versioning
    Database versioning facilitates the monitoring of databases and the resolution of issues, such as missing or mismatched data. Best practices in this context involve implementing a separate database instance for developers to prevent collisions and incompatible changes, or the separation of code changes from schema changes.
  • Using scalable infrastructure
    By making sure that the infrastructure is scalable, you can reduce the relatively high cost of its setup. 
  • Chaos engineering
    Chaos engineering in a non-production environment helps to transfer risks into the production environment and supports experimenting. This allows testing the reliability of the application without ruining the user experience.
  • Careful management of databases
    Managing databases and ensuring that both environments have synchronized and accurate data are one of the biggest challenges and best practices of Blue/Green development. 
  • Leverage Feature Flags
    Using feature flags allows switching features on and off and maintaining higher control over single features. This allows for integrating customer feedback and further testing without disrupting the live environment.
  • Seamless switching
    There are a few practices that can help to ensure seamless switching between the two environments, such as environment monitoring, ensuring compatibility of two code versions, using load balancing, service meshes, and automation.

<span class="colorbox1" fs-test-element="box1"><p>Read also: Big Bang Migration vs Trickle Migration Approach in Legacy Modernization [Key Differences & Considerations]</p></span>

Challenges of the Blue/Green deployment

Although Blue/Green deployment comes with a number of benefits, there are also some drawbacks and concerns that need to be raised. They are for instance:

  • A need to invest time and effort. Setting up and maintaining two environments is typically risky, complex, and resource-consuming.
  • High costs of the infrastructure. Due to the requirement of maintaining two environments, it may be necessary to pay double for cloud infrastructure or equipment.
  • High costs of small update rollouts. The process doesn’t allow for modifying a single feature, so solving problems with a specific feature may require rolling back the entire release.
  • Coordination challenges. The need to control two environments and switchovers might require thoroughly-planned supervision.
  • Performance issues. Users may face them in a testing phase after switching the traffic to the new environment.
  • Transaction issues. They may be caused by moving payment functionalities from Blue to Green environments or the opposite way.
  • Data leakages. They may happen between the two environments in case the app depends on an external, third-party, or legacy service.
  • Not suitable for all applications. For instance, for those using a lot of states, such as databases.

What are the alternatives?

When modernizing legacy applications, several alternatives to the blue/green deployment strategy can be considered, each with its own set of advantages and considerations:

Canary releases

In a canary release, the new version of the application is rolled out to a small subset of users before a full deployment. This approach allows for monitoring the performance and stability of the new version in a real-world environment with actual users. If issues arise, the impact is limited and the new version can be rolled back quickly.

When to choose

Ideal for scenarios where you want to test the new version on a small, real-world user base to gauge performance and identify issues before a full rollout. It's particularly useful when dealing with large user bases or when introducing significant changes.

Feature flags (toggle-based deployments)

This approach involves incorporating toggles or switches in the application code that enable or disable certain features. This allows new features to be tested in the live production environment without exposing them to all users. Feature flags offer fine-grained control over who sees what features and can be used for A/B testing.

When to choose

Best suited for incremental development and when you need the flexibility to enable or disable features without redeploying the entire application. This approach is effective in environments that emphasize continuous integration and require the ability to quickly revert or update features based on user feedback or performance data.

Rolling updates

Rolling updates involve gradually replacing instances of the old version of the application with the new version. This is often done in a way that does not affect all users at the same time. It's particularly useful for distributed or microservices architectures where different services can be updated independently.

When to choose

Ideal for distributed systems or microservices architectures where you can update individual components or services without impacting the entire application. This approach is useful when you want to ensure continuous availability and minimize downtime during updates.

A/B testing

Similar to feature flags, A/B testing involves showing different versions of an application to different user groups and comparing the results. This method is often used to gauge user response to new features or changes rather than for deploying an entirely new version of the application.

When to choose

Suitable when the primary goal is to compare different versions of a feature or application to evaluate user engagement, performance, or other metrics. This approach is often used in user-centric applications where user feedback and behavior significantly influence development decisions.

Shadow deployment

In shadow deployment, the new version of the application runs in parallel with the old version, but it doesn't serve real users. Instead, real-world traffic is mirrored to the new version. This allows for extensive testing under real-world conditions without impacting users.

When to choose

Best when you need to test the new version under real traffic conditions without any user impact. This is particularly useful for complex applications where simulating real-world traffic in a test environment is challenging or when you need to ensure that the new version can handle live traffic without any issues.

Greenfield deployment

This involves building a new version of the application from scratch and switching users over once it's ready. This approach is often taken when the legacy application requires substantial changes or a complete rewrite.

When to choose

Appropriate when the legacy application requires a complete overhaul or when building a new application from scratch is more feasible than updating the existing one. This strategy is often adopted when the existing technology stack is outdated or when a completely new feature set is required.

Phase-based deployment

The application is updated in phases, with each phase targeting specific parts of the system or specific user groups. This approach can reduce risk by limiting the impact of changes and allowing for gradual adaptation to the new system.

When to choose

Ideal for large-scale applications where changes need to be rolled out in manageable segments. This approach reduces risk by limiting the scope of each deployment phase and is particularly useful in environments where gradual adaptation to new systems or features is necessary.

When to choose Blue/Green deployment?

Blue/green deployment is particularly suited for certain scenarios, and it's important to consider these when deciding if it's the right approach for your needs:

High availability and zero-downtime requirements

If your application requires high availability and cannot afford downtime during deployments, blue/green is ideal. It allows you to have two identical production environments, ensuring seamless user experiences as traffic is switched from the old version to the new one.

Risk-averse environments

In environments where minimizing risk is crucial, such as financial services or healthcare applications, blue/green deployment is beneficial. It provides a straightforward rollback mechanism if anything goes wrong with the new release, as you can quickly switch back to the old version without impacting users.

Large and complex applications

For large, complex applications where small changes can have significant and sometimes unpredictable impacts, blue/green deployments offer a safety net. It allows for full-scale testing in a production-like environment before making the switch, reducing the likelihood of unforeseen issues.

Rapid iteration and frequent releases

If your development cycle involves frequent releases or updates, blue/green deployment can be a good fit. It enables rapid and safe deployment of new versions without disrupting the user experience, which is ideal for agile development practices.

User Experience focused deployments

In scenarios where maintaining a consistent and high-quality user experience is paramount, blue/green deployment ensures that users are not affected by deployment activities. It's particularly useful for customer-facing applications where user satisfaction is a key concern.

Regulatory compliance and auditing

If your application falls under strict regulatory compliance requirements, blue/green deployment can facilitate auditing and compliance. It allows you to have a stable and verifiable environment (the inactive environment) ready for inspection at any time.

Case study: legacy fintech app modernization using blue/green deployment strategy

Let's analyze a blue/green deployment strategy on an example of a fintech application that needs modernization.

Let's consider an example to illustrate how this strategy might be employed in a fintech scenario:

Background

A fintech company operates a legacy banking application, which manages customer accounts, transactions, and offers financial planning tools. The app is built on outdated technology, lacks modern features like real-time transaction updates, and isn't optimized for mobile devices.

Goal

The goal is to modernize the app to improve performance, security, and user experience, adding features like biometric authentication, real-time notifications, and a modern, responsive UI.

Blue-Green deployment strategy

Preparation Phase:

  1. Blue Environment: The existing legacy application continues to operate as the 'Blue' environment.
  2. Green Environment: A new environment is created with the modernized version of the app. This includes upgraded backend infrastructure, enhanced security features tailored for financial transactions, and a new user interface.

Testing in the Green Environment:

  1. Extensive testing is conducted in the green environment. This includes load testing to ensure it can handle high volumes of financial transactions, security testing for data protection (critical in fintech), and user acceptance testing to ensure the new features meet client needs.
  2. Compliance checks are performed to ensure the green version adheres to financial regulations.

Live Traffic Switching:

  1. Once the green version is ready and tested, traffic gradually shifts from the blue to the green environment. This might be done by routing a small percentage of users to the new version and gradually increasing it.
  2. Financial transactions are closely monitored during this phase to ensure data integrity and security.

Monitoring and Rollback Plan:

  1. Continuous monitoring is crucial. Any issues, especially those related to financial transactions or compliance, are addressed immediately.
  2. In case of major issues, a rollback plan is ready to revert to the blue environment without disrupting user services.

Final Transition:

  1. After successful operation in the green environment and resolving any minor issues, the blue environment is decommissioned.
  2. The green environment becomes the new standard, offering a modern, secure, and efficient fintech experience.

Specifics for fintech industry

  • Security and Compliance: Given the sensitive nature of financial data, security and compliance with financial regulations are given top priority in every phase.
  • Transaction Integrity: Ensuring no transaction data is lost or corrupted during the transition is critical.
  • User Trust: Clear communication with users about the changes, especially regarding how their financial data is handled, is key to maintaining trust.

This example demonstrates the cautious yet efficient approach of blue-green deployment in fintech, allowing for a seamless transition with minimal downtime and maximum security.

<span class="colorbox1" fs-test-element="box1"><p>Need some help with the modernization process of your fintech system? Check out this ranking of top fintech software development companies.</p></span>

Next steps - your migration checklist

Now, grab a free checklist to start your legacy system migration with blue/green deployment strategy:

Frequently Asked Questions

No items found.

Our promise

Every year, Brainhub helps 750,000+ founders, leaders and software engineers make smart tech decisions. We earn that trust by openly sharing our insights based on practical software engineering experience.

Authors

Olga Gierszal
github
Software Engineering Editor

Software development enthusiast with 6 years of professional experience in the tech industry.

Read next

No items found...

Get smarter in engineering and leadership in less than 60 seconds.

Join 300+ founders and engineering leaders, and get a weekly newsletter that takes our CEO 5-6 hours to prepare.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.