{"id":71005,"date":"2023-02-06T09:07:47","date_gmt":"2023-02-06T09:07:47","guid":{"rendered":"https:\/\/www.cryptocabaret.com\/?p=71005"},"modified":"2023-02-06T09:07:47","modified_gmt":"2023-02-06T09:07:47","slug":"reinvent-your-release-strategy-with-an-api-gateway","status":"publish","type":"post","link":"https:\/\/www.cryptocabaret.com\/?p=71005","title":{"rendered":"Reinvent your release strategy with an API gateway"},"content":{"rendered":"<p><span class=\"field field--name-title field--type-string field--label-hidden\">Reinvent your release strategy with an API gateway<\/span><br \/>\n<span class=\"field field--name-uid field--type-entity-reference field--label-hidden\"><a title=\"View user profile.\" href=\"https:\/\/opensource.com\/users\/iambobur\" class=\"username\">iambobur<\/a><\/span><br \/>\n<span class=\"field field--name-created field--type-created field--label-hidden\">Mon, 02\/06\/2023 &#8211; 03:00<\/span><\/p>\n<div class=\"clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item\">\n<p>One benefit of moving to an API-based architecture is that you can iterate quickly and deploy new changes to our services. There is also the concept of traffic and routing established with an API gateway for the modernized part of the architecture. API gateway provides stages to allow you to have multiple deployed APIs behind the same gateway and is capable of in-place updates with no downtime. Using an API gateway enables you to leverage the service&#8217;s numerous API management features, such as<strong>\u00a0<\/strong>authentication, rate<strong> <\/strong>throttling, observability, multiple API versioning, and stage deployment management (deploying an API in multiple stages such as dev, test, stage, and prod).<\/p>\n<p>Open source API gateway (<a href=\"https:\/\/apisix.apache.org\/\" rel=\"noopener\" target=\"_blank\">Apache APISIX<\/a> and <a href=\"https:\/\/opensource.com\/article\/20\/3\/kubernetes-traefik\">Traefik<\/a>) and service mesh (<a href=\"https:\/\/www.redhat.com\/architect\/istio-CNI-plugin\" rel=\"noopener\" target=\"_blank\">Istio<\/a> and Linkerd) solutions are capable of doing traffic splitting and implementing functionalities like canary release and <a href=\"https:\/\/www.redhat.com\/en\/topics\/devops\/what-is-blue-green-deployment?intcmp=7013a000002qLH8AAM\" target=\"_blank\" rel=\"noopener\">blue green deployment<\/a>. With canary testing, you can make a critical examination of a new release of an API by selecting only a small portion of your user base.\u00a0<\/p>\n<h2>What is a canary release?<\/h2>\n<p>A canary release introduces a new version of the API and flows a small percentage of the traffic to the canary. In API gateways, traffic splitting makes it possible to gradually shift or migrate traffic from one version of a target service to another. For example, a new version, <code>v1.1<\/code>, of a service can be deployed alongside the original, <code>v1.0<\/code>. Traffic shifting enables you to canary test or release your new service by at first only routing a small percentage of user traffic, say <code>1%<\/code>, to <code>v1.1<\/code>, then shifting all of your traffic over time to the new service.<\/p>\n<article class=\"align-center media media--type-image media--view-mode-default\">\n<div class=\"field field--name-field-media-image field--type-image field--label-hidden field__item\">  <img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2023\/02\/ApiCanaryrelease.png\" width=\"1920\" height=\"1080\" alt=\"Image of the API Canary release.\"><\/div>\n<div class=\"field field--name-field-caption field--type-text-long field--label-hidden caption field__item\"><span class=\"caption__byline\">Image by: <\/span><\/p>\n<p>(Bobur Umurzokov, CC BY-SA 4.0)<\/p>\n<\/div>\n<\/article>\n<div class=\"embedded-resource-list callout-float-right\">\n<div class=\"field field--name-title field--type-string field--label-hidden field__item\">Explore the open source cloud<\/div>\n<div class=\"field field--name-links field--type-link field--label-hidden field__items\">\n<div class=\"field__item\"><a href=\"https:\/\/www.redhat.com\/en\/services\/training\/do092-developing-cloud-native-applications-microservices-architectures?intcmp=7013a000002gp8aAAA\">Free online course: Developing cloud-native applications with microservices<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/www.redhat.com\/en\/engage\/managed-cloud-services-s-202202210207?intcmp=7013a000002gp8aAAA\">eBook: Modernize your IT with managed cloud services<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/cloud.redhat.com\/products\/dedicated\/?intcmp=7013a000002gp8aAAA\">Try for 60 days: Red Hat OpenShift Dedicated<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/www.redhat.com\/en\/services\/training\/do080-deploying-containerized-applications-technical-overview?intcmp=7013a000002gp8aAAA\">Free online course: Containers, Kubernetes and Red Hat OpenShift<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/www.redhat.com\/en\/topics\/containers\/what-is-kubernetes?intcmp=7013a000002gp8aAAA\">What is Kubernetes?<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/www.redhat.com\/en\/topics\/edge-computing?intcmp=7013a000002gp8aAAA\">Understanding edge computing<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/www.redhat.com\/architect\/?intcmp=7013a000002gp8aAAA\">Latest articles for IT architects<\/a><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<p>This allows you to monitor the new service, look for technical problems, such as increased latency or error rates, and look for the desired business impact. This includes checking for an increase in key performance indicators like customer conversion ratio or the average shopping checkout value. Traffic splitting enables you to run A\/B or multivariate tests by dividing traffic destined for a target service between multiple versions of the service. For example, you can split traffic <code>50\/50<\/code> across your <code>v1.0<\/code> and <code>v1.1<\/code> of the target service and see which performs better over a specific period of time. Learn more about the traffic split feature in Apache APISIX Ingress Controller.<\/p>\n<p>When appropriate, canary releases are an excellent option, as the percentage of traffic exposed to the canary is highly controlled. The trade-off is that the system must have good monitoring in place to be able to quickly identify an issue and roll back if necessary (which can be automated). This guide shows you how to use <a href=\"https:\/\/github.com\/fluxcd\/flagger\/blob\/6c29c2118478a69207e2ff23a7afe6006f5518dc\/docs\/gitbook\/tutorials\/apisix-progressive-delivery.md\" rel=\"noopener\" target=\"_blank\">Apache APISIX and Flagger<\/a> to quickly implement a canary release solution.<\/p>\n<article class=\"align-center media media--type-image media--view-mode-default\">\n<div class=\"field field--name-field-media-image field--type-image field--label-hidden field__item\">  <img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2023\/02\/APITrafficsplitting.png\" width=\"2082\" height=\"900\" alt=\"Image showing API traffic splitting.\"><\/div>\n<div class=\"field field--name-field-caption field--type-text-long field--label-hidden caption field__item\"><span class=\"caption__byline\">Image by: <\/span><\/p>\n<p>(Bobur Umurzokov, CC BY-SA 4.0)<\/p>\n<\/div>\n<\/article>\n<h2>Traffic mirroring<\/h2>\n<p>In addition to using traffic splitting to run experiments, you can also use traffic mirroring to copy or duplicate traffic. You can send this to an additional location or a series of locations. Frequently with traffic mirroring, the results of the duplicated requests are not returned to the calling service or end user. Instead, the responses are evaluated out-of-band for correctness. For instance, it compares the results generated by a refactored and existing service.<\/p>\n<article class=\"align-center media media--type-image media--view-mode-default\">\n<div class=\"field field--name-field-media-image field--type-image field--label-hidden field__item\">  <img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2023\/02\/APItrafficMirroring.png\" width=\"1920\" height=\"1080\" alt=\"Image showing API traffic mirroring.\"><\/div>\n<div class=\"field field--name-field-caption field--type-text-long field--label-hidden caption field__item\"><span class=\"caption__byline\">Image by: <\/span><\/p>\n<p>(Bobur Umurzokov, CC BY-SA 4.0)<\/p>\n<\/div>\n<\/article>\n<p>Using traffic mirroring enables you to &#8220;dark release&#8221; services, where a user is kept in the dark about the new release, but you can internally observe for the required effect.<\/p>\n<p>Implementing traffic mirroring at the edge of systems has become increasingly popular over the years. APISIX offers the <a href=\"https:\/\/apisix.apache.org\/docs\/apisix\/plugins\/proxy-mirror\" rel=\"noopener\" target=\"_blank\">proxy-mirror<\/a> plugin to mirror client requests. It duplicates the real online traffic to the mirroring service and enables specific analysis of the online traffic or request content without interrupting the online service.<\/p>\n<h2>What is a blue green deployment?<\/h2>\n<p>Blue green deployment is usually implemented at a point in the architecture that uses a router, gateway, or load balancer. Behind this sits a complete blue environment and a green environment. The current blue environment represents the current live environment, and the green environment represents the next version of the stack. The green environment is checked prior to switching to live traffic. When it goes live, the traffic is flipped over from blue to green. The blue environment is now off, but if a problem is spotted the rollback is quick. The next change is to go from green to blue, oscillating from the first release onward.<\/p>\n<article class=\"align-center media media--type-image media--view-mode-default\">\n<div class=\"field field--name-field-media-image field--type-image field--label-hidden field__item\">  <img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2023\/02\/APIBLueGreen.png\" width=\"1920\" height=\"1080\" alt=\"Image showing Blue and Green release strategies.\"><\/div>\n<div class=\"field field--name-field-caption field--type-text-long field--label-hidden caption field__item\"><span class=\"caption__byline\">Image by: <\/span><\/p>\n<p>(Bobur Umurzokov, CC BY-SA 4.0)<\/p>\n<\/div>\n<\/article>\n<p>Blue green works well due to its simplicity, and it is one of the better deployment options for coupled services. It is also easier to manage persisting services, though you still need to be careful in the event of a rollback. It also requires double the number of resources to be able to run cold in parallel to the currently active environment.<\/p>\n<h2>Traffic management with Argo Rollouts<\/h2>\n<p>The strategies discussed add a lot of value, but the rollout itself is a task that you would not want to have to manage manually. This is where a tool such as <a href=\"https:\/\/argoproj.github.io\/argo-rollouts\/\" rel=\"noopener\" target=\"_blank\">Argo Rollouts<\/a> is valuable for demonstrating some of the concerns discussed.<\/p>\n<p>Using Argo, it is possible to define a <a href=\"https:\/\/argoproj.github.io\/argo-rollouts\/concepts\/\" rel=\"noopener\" target=\"_blank\">Rollout CRD<\/a> that represents the strategy you can take for rolling out a new canary of your API. A custom resource definition (CRD) allows Argo to extend the Kubernetes API to support rollout behavior. CRDs are a popular pattern with Kubernetes. They allow the user to interact with one API with the extension to support different features.<\/p>\n<p>You can use the Apache APISIX and Apache APISIX Ingress Controller for traffic management with Argo Rollouts. This <a href=\"https:\/\/argoproj.github.io\/argo-rollouts\/features\/traffic-management\/apisix\/\" rel=\"noopener\" target=\"_blank\">guide<\/a> shows you how to integrate <code>ApisixRoute<\/code> with Argo Rollouts using it as a weighted round-robin load balancer.<\/p>\n<h2>Summary<\/h2>\n<p>The ability to separate the deployment and release of service (and corresponding API) is a powerful technique, especially with the rise in the progressive delivery approach. A canary release service can make use of the API gateway traffic split and mirroring features, and provides a competitive advantage. This helps your business with both mitigating risk of a bad release and also understanding your customer&#8217;s requirements.<\/p>\n<hr>\n<p><em>This article was originally published on the\u00a0<a href=\"https:\/\/api7.ai\/blog\/api-release-strategies-with-api-gateway\" target=\"_blank\" rel=\"noopener\">API7.ai blog<\/a> and has been republished with permission.<\/em><\/p>\n<\/div>\n<div class=\"clearfix text-formatted field field--name-field-article-subhead field--type-text-long field--label-hidden field__item\">\n<p>The ability to separate the deployment and release of service (and corresponding API) is a powerful technique, especially with the rise in the progressive delivery approach.<\/p>\n<\/div>\n<div class=\"field field--name-field-lead-image field--type-entity-reference field--label-hidden field__item\">\n<article class=\"media media--type-image media--view-mode-caption\">\n<div class=\"field field--name-field-media-image field--type-image field--label-hidden field__item\">  <img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2023\/02\/gears_devops_learn_troubleshooting_lightbulb_tips_520.png\" width=\"520\" height=\"292\" alt=\"Tips and gears turning\" title=\"Tips and gears turning\"><\/div>\n<div class=\"field field--name-field-caption field--type-text-long field--label-hidden caption field__item\"><span class=\"caption__byline\">Image by: <\/span><\/p>\n<p>opensource.com<\/p>\n<\/div>\n<\/article>\n<\/div>\n<div class=\"field field--name-field-tags field--type-entity-reference field--label-hidden field__items\">\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/cicd\" hreflang=\"en\">CI\/CD<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/kubernetes\" hreflang=\"en\">Kubernetes<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/cloud\" hreflang=\"en\">Cloud<\/a><\/div>\n<\/p><\/div>\n<div class=\"hidden field field--name-field-listicle-title field--type-string field--label-hidden field__item\">What to read next<\/div>\n<div class=\"field field--name-field-default-license field--type-list-string field--label-hidden field__item\"><a rel=\"license\" href=\"http:\/\/creativecommons.org\/licenses\/by-sa\/4.0\/\"><br \/>\n        <img decoding=\"async\" alt=\"Creative Commons License\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2023\/02\/cc-by-sa-4-7.png\" title=\"This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.\"><\/a>This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.<\/div>\n<section class=\"field field--name-field-comments field--type-comment field--label-hidden comment-wrapper\">\n<div class=\"comments__count\">\n<div class=\"login\"><a href=\"https:\/\/opensource.com\/user\/register?absolute=1\">Register<\/a> or <a href=\"https:\/\/opensource.com\/user\/login?destination=\/feed&amp;absolute=1\">Login<\/a> to post a comment.<\/div>\n<\/p><\/div>\n<\/section>\n<p class=\"wpematico_credit\"><small>Powered by <a href=\"http:\/\/www.wpematico.com\" target=\"_blank\" rel=\"noopener\">WPeMatico<\/a><\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Reinvent your release strategy with an API gateway iambobur Mon, 02\/06\/2023 &#8211; 03:00 One benefit of moving to an API-based architecture is that you can iterate quickly and deploy new changes to our services. There is also the concept of traffic and routing established with an API gateway for the modernized part of the architecture. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":71006,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[307],"tags":[],"class_list":["post-71005","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-open-source"],"_links":{"self":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts\/71005","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=71005"}],"version-history":[{"count":0,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts\/71005\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/media\/71006"}],"wp:attachment":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=71005"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=71005"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=71005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}