Skip to content
  • Solutions
    • Cloud Solution
      • Cloud Data Migration
      • Application Modernization
      • Advanced Analytics
    • QA and Testing Solutions
      • Functional & Mobile Testing
      • Performance Testing
      • SOA Testing
      • Agile Testing
      • Web Testing
      • End-to-End Test Automation
    • Data and Analytics Solutions
      • Data Integration & Business Intelligence
      • Automated ETL Migration
      • Data Governance & Data Quality
    • Digital and Application Development Solutions
      • API development
      • Web & Mobile
      • Sharepoint
      • DevOps
  • Products
    • QualiDI
    • Hydrograph
    • ETL Converter
  • Why Bitwise
Menu
  • Solutions
    • Cloud Solution
      • Cloud Data Migration
      • Application Modernization
      • Advanced Analytics
    • QA and Testing Solutions
      • Functional & Mobile Testing
      • Performance Testing
      • SOA Testing
      • Agile Testing
      • Web Testing
      • End-to-End Test Automation
    • Data and Analytics Solutions
      • Data Integration & Business Intelligence
      • Automated ETL Migration
      • Data Governance & Data Quality
    • Digital and Application Development Solutions
      • API development
      • Web & Mobile
      • Sharepoint
      • DevOps
  • Products
    • QualiDI
    • Hydrograph
    • ETL Converter
  • Why Bitwise
Search
Close
  • Resources
    • Blogs
    • Solution summary
    • Case Study
    • Webinar
    • News & Events
    • Partners
Menu
  • Resources
    • Blogs
    • Solution summary
    • Case Study
    • Webinar
    • News & Events
    • Partners
Contact Us
  • Solutions

    Cloud Solution

    • Journey to the Cloud
    • Cloud Data Migration
    • Application Modernization
    Menu
    • Journey to the Cloud
    • Cloud Data Migration
    • Application Modernization

    Data and Analytics Solutions

    • Data Warehouse and Business Intelligence
    • Automated ETL Migration
    • Hadoop & NoSQL
    • Big Data Analytics and Data Science
    Menu
    • Data Warehouse and Business Intelligence
    • Automated ETL Migration
    • Hadoop & NoSQL
    • Big Data Analytics and Data Science

    Data Governance Solutions

    • Data Quality
    • Master Data Management
    • Data Security
    • Metadata Management
    Menu
    • Data Quality
    • Master Data Management
    • Data Security
    • Metadata Management

    QA Testing Solutions

    • Functional and Mobile Testing
    • Performance Testing
    • SOA Testing
    • API Automation Testing
    • Web Automation Testing
    Menu
    • Functional and Mobile Testing
    • Performance Testing
    • SOA Testing
    • API Automation Testing
    • Web Automation Testing

    Digital and Application Development Solutions

    • Enterprise Applications
    • Web and Mobile
    • SharePoint
    • DevOps
    Menu
    • Enterprise Applications
    • Web and Mobile
    • SharePoint
    • DevOps
    Explore More Solutions
    HOW WE ENGAGE
  • Products

    QualiDI

    Reduce ETL testing cycles and ensure data quality

    Hydrograph

    Engineered to accelerate ETL development in the big data ecosystem

    Test Data Management

    Generate realistic and reliable test data

    ETL Converter

    Convert any ETL to any ETL

    Hadoop Adaptor For Mainframe Data

    Convert Any Mainframe Data to Any Hadoop-Friendly Format

    Explore More Products
    HOW WE ENGAGE
  • Why Bitwise
Search
Close
  • Resources

    Blogs

    Bitwisers’ perspectives on the latest technology trends and happenings

    Case Studies

    Get a closer look at our customer stories and results

    News & Events

    See our latest event, news and conference information

    Solution Summary

    Explore our industry and domain-specific solutions

    Webinars

    Hone your skills and obtain new knowledge with our upcoming and on-demand webinars

    Partners

    Partnering with the top technology solution providers to drive business results

Contact Us
Search
Close
  • Resources

    Blogs

    Bitwisers’ perspectives on the latest technology trends and happenings

    Case Studies

    Get a closer look at our customer stories and results

    News & Events

    See our latest event, news and conference information

    Solution Summary

    Explore our industry and domain-specific solutions

    Webinars

    Hone your skills and obtain new knowledge with our upcoming and on-demand webinars

    Partners

    Partnering with the top technology solution providers to drive business results

Contact Us
  • Solution
    • Cloud Solution
      • Journey to the Cloud
      • Cloud Data Migration
      • Application Modernization
    • Data and Analytics Solutions
      • Data Warehouse and Business Intelligence
      • Automated ETL Migration
      • Hadoop & NoSQL
      • Big Data Analytics and data science
    • Data Governance Solutions
      • Data Quality
      • Master Data Management
      • Data Security
      • Metadata Management
    • QA and Testing Solutions
      • Functional and Mobile Testing
      • Performance Testing
      • SOA Testing
      • API Automation Testing
      • Web Automation Testing
    • Digital and Application Development Solutions
      • Enterprise Applications
      • Web and Mobile
      • SharePoint
      • DevOps
  • Products
    • Qualidi
    • Hydrograph
    • Test Data Management
  • Resources
    • Blogs
    • Case studies
    • News and events
    • Solution summary
    • Webinar
    • Partners
  • Why Bitwise
  • Contact Us
Menu
  • Solution
    • Cloud Solution
      • Journey to the Cloud
      • Cloud Data Migration
      • Application Modernization
    • Data and Analytics Solutions
      • Data Warehouse and Business Intelligence
      • Automated ETL Migration
      • Hadoop & NoSQL
      • Big Data Analytics and data science
    • Data Governance Solutions
      • Data Quality
      • Master Data Management
      • Data Security
      • Metadata Management
    • QA and Testing Solutions
      • Functional and Mobile Testing
      • Performance Testing
      • SOA Testing
      • API Automation Testing
      • Web Automation Testing
    • Digital and Application Development Solutions
      • Enterprise Applications
      • Web and Mobile
      • SharePoint
      • DevOps
  • Products
    • Qualidi
    • Hydrograph
    • Test Data Management
  • Resources
    • Blogs
    • Case studies
    • News and events
    • Solution summary
    • Webinar
    • Partners
  • Why Bitwise
  • Contact Us
Cloud Migration

Blue Green Deployment Strategy for Cloud based Services

Dominic Gonsalves
Blue Green Deployment Strategy for Cloud based Services
Share
Share on linkedin
Share on twitter
Share on whatsapp
Share on facebook
Share on telegram

The normal approach for the deployment of a service involves considerable downtime to cover tasks like deployment, health check and validation. There is also some complexity and time involved in rolling back the deployment in case of validation failure with the new version of the service.

In cloud-based services, a recommended strategy to do a deployment with ‘ZERO DOWNTIME’ is called the Blue Green deployment strategy. Using this strategy, we can achieve zero downtime during deployment and have minimal impact on consumers or end users.

Here we will assume you have familiarity with writing Spring Boot based apps and deploying on Pivotal Cloud Foundry (PCF) PaaS based cloud infrastructure.

Understanding Blue Green Deployment Strategy

This strategy requires we have two versions on the production environment. One is the version that is current and LIVE in Production (this we can call Blue version). Other is the new version which we plan to promote and make LIVE (this we can call Green version).

After deployment of the new version (Green) we will do some health checks and perform sanity tests to ensure this new version is safe to promote to LIVE traffic. Once the green version has been validated, we may choose to switch traffic to Green version. Now the Green version gets all the Live Traffic.

We can choose to keep the Blue version or discard it. At any point during the Blue Green deployment, if the Green version validation fails we can choose to roll back to the previous (Blue) version.

Challenges with Blue Green Deployment Strategy

One of the challenges with this strategy is making the application backward compatible as both the Blue and Green version would be running in parallel. Usually, if there is only application code change this should not be a big deal.

The real challenge comes when the new version of the application requires a database structure change like rename of column or dropping a column. One way to work around this is to design your database changes in a phased manner where the initial change will not modify existing object attributes but will add new ones.

Once everything has been tested a migration can be done. However, this ties the development strategy to the deployment and is one of the challenges that come with Blue Green deployment.

Implementations

Router Based

In router-based approach the traffic flow to the Live version of the service and the new version is controlled and switched via the Cloud Foundry (CF) router. We will try to understand it in a sequence of steps.

    1. Say we have a simple service that gives us the weather for a location. The current version of this service in production is v1. This is the Blue version. Now we want to promote a new version v1.1. This will be the Green version.

blue-green-Deployment-Weather-v1

    1. As you can see the weather API is accessible via the URL weather.demo.com. So any request coming for weather API is routed via the CF router to the current Live version of production (v1). The new version v1.1, though deployed, is not accessible yet via any URL. Now let us make the version accessible via a temporary URL. This can be done through Command Line Interface (CLI) command as below:

      $ cf push green –n weather-green.

      Now any request for weather API via the production URL weather.demo.com continues to be routed to the current production version while the new version will be accessible via the new temporary URL weather-green.demo.com

weather-green-v1

  1. Now the developers and testers can validate the new version via the temporary URL. If validation of the new version is successful, we can also bind the original URL (route) to the new version.

    $ cf map-route green demo.com -n weather

    weather-green-v1.1

    The router now load balances the requests for URL weather.demo.com between version v1 and v1.1 of the Weather API.

  2. After some time, if we are able to verify the new version is running without any problems, we can unmap the production URL from the Blue version (v1). We can also go ahead and unmap and then optionally remove the temporary route mapped to the new version.

    $ cf unmap-route blue example.com -n weather

    $ cf unmap-route green example.com -n weather-green

    weather-demo

    This way we have actually promoted a new version of weather API into production without any downtime.

Service Discovery Based

In service discovery-based approach we use a service registry where services will be registered. Let’s take for example Netflix Eureka service registry. So, consumers of the service will not directly invoke specified endpoint URLs but will lookup URLs for services they want to invoke from the registry and then invoke those URLs.

We first need to make the service instances Discoverable. We do this by enabling Discovery Client with the annotation @EnableDiscoveryClient on the Spring Boot app main class. Before that, we need to add below dependency into our Spring Boot project.

compile(‘org.springframework.cloud:spring-cloud-starter-netflix-eureka-client’)

spring-version

So when we need to switch traffic between Blue and Green instances it is done by registering of a new version of service with the same name and unregistering the old version (live version). So consumers continue to invoke the service in the same way relying on the service registry to provide it with the service URLs. It can be done in stages as below.

    1. Deploy the new version of the service without registering it in the service registry. This is the Green version. The Live version we will call Blue version. We perform validation tests on the Green version independently.

blue-version

    1. If the tests are good, we register the Green version of the service with the same app name. So now Live traffic goes to both blue and green instance.

blue-green-instance

  1. If everything seems normal, we unregister the Blue version and now live traffic goes only to Green instance.

green-instance

Canary Deployment

A variant of Blue Green deployment is the canary deployment (coarse grained canary). The main goal of this strategy is to minimize the impact to users due to rolling out an erroneous version of the application into production. This can be explained in steps as below.

  1. Install the application to a server instance where Live production traffic cannot be reached.
  2. After internal validation of the application, we can start to route a small subset of the LIVE traffic to the new version. This can be done at the Router. Say we want to only allow internal company users to first use it and then slowly to users in a city, state or country and so on.
  3. Anytime during this process, if a critical issue is identified we can roll back the new version.
  4. If all looks good, we can route all the traffic to the new version and decommission the old version or hold it for some time as a backup.

This is one way to achieve coarse grained canary deployments without any special setup.

Future Outlook

PCF Native Rolling App Update (Beta)

PCF 2.4 natively supports ZERO Downtime rolling deployment feature. This is however in Beta mode and you would need CLI v6.40 or later to use this feature. However, this is not a full feature Blue Green deployment process, rather it allows you to perform a rolling app deployment. Below are some of the commands that support this:

Deployment (Zero downtime): cf v3-zdt-push APP-NAME

Cancel deployment (No Zero downtime guarantee): cf v3-cancel-zdt-push APP-NAME

Restart (Zero downtime): cf v3-zdt-restart APP-NAME

However, before using these commands it must be noted that these are in beta phase and there are some limitations of the use. For more information, PCF documentation must be referred.

Native Fine Grained Canary (beta)

PCF is in the process of replacing its go router implementation with service mesh (Istio) based solution. This will allow for lots of new exciting capabilities including weighted routing. Weighted routing natively allows you to send percentage based traffic to the canary app.

We will look at these upcoming capabilities in a future article. For related information, check out our webinar.

RELATED WEBINAR

Modernizing legacy applications to run on Pivotal Cloud Foundry natively

Application modernization is an inevitable part of cloud-centric business transformation. Once you have set out on the path of application modernization, you have to choose a vendor for your target cloud platform.
Read More
RELATED WEBINAR

Modernizing legacy applications to run on Pivotal Cloud Foundry natively

Application modernization is an inevitable part of cloud-centric business transformation. Once you have set out on the path of application modernization, you have to choose a vendor for your target cloud platform.
Read More

Tags

Cloud PCF

Share

Share on linkedin
Share on twitter
Share on whatsapp
Share on facebook
Share on telegram

About Author

Dominic Gonsalves

Dominic Gonsalves

Dominic offers over 14 years of experience in the software industry with a focus on application development on cloud and multi-tier J2EE using various modern and traditional technologies. He has had a variety of leadership and development roles for the enhancements of different systems in the PCF cloud space as well as traditional multi-tier J2EE apps. He designs and develops applications and components for enterprise clients based on various design patterns and modern technology platforms using the best set of practices, processes, tools, and methodologies.
Never Miss a Bitwise Update!
Subscribe to our e-mail Newsletter and stay updated

You Might Also Like

Auto Scaling on PCF
Cloud Migration

Auto Scaling Applications on Pivotal Cloud Foundry

Read More
Dispute Management
Cloud Migration

Merchant Acquirers – Considerations for Cloud Migration

Read More
Snowflake load
Cloud Migration

Best File Formats for Loading Data into Snowflake on Cloud

Read More
Cloud Data Migration
Cloud Migration

Practical Challenges of Large-Scale Cloud Data Migrations

Read More
Data Warehouse to Cloud
Cloud Migration

5 Business Drivers for Migrating Your Data Warehouse to Cloud in 2021

Read More
Cloud Data Migration
Cloud Migration

Bringing Cloud into the Big Data and Analytics Discussion at TDWI Savannah

Read More
Never Miss Bitwise Updates!

    Products
    • QualiDI
    • Hydrograph
    • Test Data Management
    • ETL Converter
    • Hadoop Adaptor for Mainframe Data
    Menu
    • QualiDI
    • Hydrograph
    • Test Data Management
    • ETL Converter
    • Hadoop Adaptor for Mainframe Data
    Digital and Application Development Solutions
    • Enterprise Applications
    • Web and Mobile
    • SharePoint
    • DevOps
    Menu
    • Enterprise Applications
    • Web and Mobile
    • SharePoint
    • DevOps
    Data and Analytics Solutions
    • Data Warehouse and Business Intelligence
    • Automated ETL Migration
    • Hadoop & NoSQL
    • Big Data Analytics and Data Science
    Menu
    • Data Warehouse and Business Intelligence
    • Automated ETL Migration
    • Hadoop & NoSQL
    • Big Data Analytics and Data Science
    Cloud Solutions
    • Journey to the Cloud
    • Cloud Data Migration
    • Application Modernization
    Menu
    • Journey to the Cloud
    • Cloud Data Migration
    • Application Modernization
    QA and Testing Solutions
    • Functional and Mobile Testing
    • Performance Testing
    • SOA Testing Services
    • API Automation Testing
    • Web Automation Testing
    Menu
    • Functional and Mobile Testing
    • Performance Testing
    • SOA Testing Services
    • API Automation Testing
    • Web Automation Testing
    Data Governance Solutions
    • Data Quality
    • Master Data Management
    • Data Security
    • Metadata Management
    Menu
    • Data Quality
    • Master Data Management
    • Data Security
    • Metadata Management
    Company
    • About Us
    • Life@Bitwise
    • Current Openings
    • Contact Us
    Menu
    • About Us
    • Life@Bitwise
    • Current Openings
    • Contact Us
    Resources
    • Blogs
    • Case Studies
    • News and Events
    • Solution Summary
    • Webinars
    • Partners
    Menu
    • Blogs
    • Case Studies
    • News and Events
    • Solution Summary
    • Webinars
    • Partners
    bitwise footer
    Facebook
    Twitter
    Linkedin
    Youtube
    Certificates
    • tickCreated with Sketch. ISO 9001:2015
    • tickCreated with Sketch. ISO/IEC 27001:2013
    • tickCreated with Sketch. ICO Registered:ZA581909
    Cyber Essentials Badge
    Privacy Policy
    Site Map

    All Rights Reserved @ Bitwise 2021

    ^

    Download this case-study

      By continuing to use this website, you consent to the use of cookies in accordance with our Cookie Policy .

      Accept