<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Yu-Han Lin on Medium]]></title>
        <description><![CDATA[Stories by Yu-Han Lin on Medium]]></description>
        <link>https://medium.com/@guesslin?source=rss-114c7ec181cf------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Eje6v6ZX2dnCV4Jy.jpg</url>
            <title>Stories by Yu-Han Lin on Medium</title>
            <link>https://medium.com/@guesslin?source=rss-114c7ec181cf------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 11:28:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@guesslin/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Preventing Systemic Failure: Bulkheads in Microservice Architectures]]></title>
            <link>https://medium.com/glasnostic/preventing-systemic-failure-bulkheads-in-microservice-architectures-c443c787978d?source=rss-114c7ec181cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/c443c787978d</guid>
            <category><![CDATA[patterns]]></category>
            <category><![CDATA[istio]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[operations]]></category>
            <dc:creator><![CDATA[Yu-Han Lin]]></dc:creator>
            <pubDate>Tue, 14 May 2019 00:00:00 GMT</pubDate>
            <atom:updated>2019-05-17T06:41:39.343Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_eYrbfGDY48JHc6W.jpg" /><figcaption>Oosterscheldekering storm surge bulkheads (Image credit: delta.nl)</figcaption></figure><p>More microservices and a proliferation of applications lead to more complex interactions between applications and ultimately to less control for operators. Such large-scale, dynamic service landscapes are great for <a href="https://glasnostic.com/blog/what-is-organic-architecture">business agility</a>, but they exhibit emergent behaviors that are difficult to manage and secure. These behaviors are inherently complex and non-linear phenomena that typically occur on a large scale and without “warning.” They are the result of aggregate service interactions and must be managed if the business is not to lose its agility.</p><p>One popular strategy of containing complex emergent behaviors is to implement the bulkhead operational pattern where possible.</p><blockquote><em>Patterns in microservice architectures usually address either developer or operator concerns. While developer concerns focus on design and deployment, operator concerns emphasize performance, security, availability and scalability-things that matter to those who r </em>un<em> software vs. </em>develop<em> it.</em></blockquote><h3>What are Bulkheads?</h3><p>So, what’s with the name? The bulkhead pattern gets its name from naval ship design. In a ship (or submarine), a bulkhead is a dividing wall or barrier between other compartments. This means that, for example, if a section of the ship hits a rock (or is hit by a torpedo), the particular portion that experiences the breach may fill with water, but it is partitioned in a way that damage is limited to that section and doesn’t ultimately sink the ship.</p><p>As a pattern in microservice architectures, a bulkhead manifests itself as a firewall or some form of network segmentation or gateway. The most significant benefit of a bulkhead is that it helps to contain failures, attacks or performance degradations from spreading to other portions of the system because they are essentially partitioned.</p><h3>The Shortcomings of Bulkheads</h3><p>Of course, there are situations where you might want to “open a hatch” (the doors that separate bulkheads) to allow communications between two otherwise partitioned services. Why? Perhaps you have a scenario where during normal operations you don’t want Services A and B located in different availability zones to communicate with each other. But, what if Service A becomes unavailable and you want to temporarily failover to Service B? This can be challenging to achieve with firewalls, gateways, or segmentation software as they would have to be deployed ahead of time and combined with special-purpose rate limiters or additional tools that can automate their required temporary configuration adjustments. The more sustainable approach is to use smarter, more adaptive <em>policies</em> around when and how services can communicate with each other.</p><h3>The Developer Perspective</h3><p>As previously mentioned, there are two perspectives to consider when it comes to the implementation of patterns in microservice architectures. In this section, we’ll look at the bulkhead pattern from the perspective of the developer and the typical software they might employ to implement it.</p><p>Let’s take a scenario where an enterprise has begun executing on a microservices strategy where two separate teams are developing their own set of microservices. In the beginning, it is decided that there is no reason they should communicate with each other. However, as development progresses and business requirements change, it is decided that the applications will need to communicate with each other. This communication should be minimal and done in a controlled manner as to avoid any undesirable side effects by “opening the hatch” to the other application. So, before the deployment of the applications to production, the teams agree to rate limits and under what circumstances communication between the applications should be allowed to occur. Implementing a bulkhead between the applications is the likely pattern of choice to use in this scenario.</p><h4>Support in Kubernetes</h4><p>Seeing that containers are the most popular choice for deploying microservices, developers will naturally start with investigating what sorts of capabilities are native to Kubernetes that might help them implement a bulkhead pattern.</p><p>To implement bulkheads in Kubernetes, its <a href="https://kubernetes.io/docs/concepts/services-networking/network-policies/"><em>network policies</em></a> functionality can be leveraged. Setting network policies for ingress traffic has been stable since Kubernetes 1.7, with egress rules added in 1.8. However, network policies in Kubernetes don’t work “out-of-the-box” and the network provider must support it. (You can find the list of providers who support them, <a href="https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy/#before-you-begin">here</a>.) Now, using the scenario previously described above, let’s examine how implementing a bulkhead might be accomplished.</p><p>First, let’s specify that the pods of the first app are selected by the <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/">pod selector</a> app=app1 and the pods of the second application are selected by using app=app2. Next, we need to establish a policy for each application to allow only traffic from the same application. This will automatically disallow traffic coming from the other application (see Figure 1).</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fjsfiddle.net%2Fguesslin%2FwLev106q%2Fembedded%2Fresult%2F&amp;src=https%3A%2F%2Fjsfiddle.net%2Fguesslin%2FwLev106q%2Fembedded%2Fresult%2F&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/94bf6a1d23f6aee66cd7cc7212f9a869/href">https://medium.com/media/94bf6a1d23f6aee66cd7cc7212f9a869/href</a></iframe><p>The next step is to apply a network policy for each traffic flow between the applications that we want to whitelist. Let’s say, for example, that the search and the web services of <em>app2</em> both need to access the users service of <em>app1</em>, because they share the same user data (see Figure 2).</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fjsfiddle.net%2Fguesslin%2F1tLns0x9%2Fembedded%2Fresult%2F&amp;src=https%3A%2F%2Fjsfiddle.net%2Fguesslin%2F1tLns0x9%2Fembedded%2Fresult%2F&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/e05728456dded3d8b7b9bdf70861a9d2/href">https://medium.com/media/e05728456dded3d8b7b9bdf70861a9d2/href</a></iframe><p>As you can see, network policies are being enforced on the connection level. In our example, this means the <em>search</em> and <em>web</em> service are permitted to initiate a connection to the <em>users</em> service, but not the other way around. It is also worth noting that although we have allowed traffic to the <em>users</em> service, no rate limiting is possible by just using Kubernetes network policies. So, although we have locked down the directional flow of traffic, we have at the same time given uncontrolled access to app2, who can potentially crash app1. In the next section you’ll see how this problem will manifest itself again with Istio. For more information about how network policies work in Kubernetes, we recommend reading <a href="https://ahmet.im/blog/kubernetes-network-policy/">“Securing Kubernetes Cluster Networking — The Unofficial Guide to Kubernetes Network Policies”</a> by Ahmet Alp Balkan.</p><h4>Support in Linkerd</h4><p><a href="https://linkerd.io/">Linkerd</a> is an open source project sponsored by Buoyant and arguably “the original” Service Mesh. Initially written in Scala like Twitter’s Finagle, from which it evolved, it has since merged with the lightweight Conduit project and relaunched as Linkerd 2.0.</p><p>Both <a href="https://linkerd.io/1/features/">Linkerd v1</a> and <a href="https://linkerd.io/1/features/">Linkerd v2</a> focus more on routing than on security or enforcing additional policies and as such do not support the creation of bulkheads. In fact, rate limiting is not supported in either version, although there is a <a href="https://github.com/linkerd/linkerd/issues/2159">plugin</a> available for Linkerd v1 and <a href="https://github.com/linkerd/linkerd/issues/1006">a request</a> to have this feature mainlined in a future release.</p><h4>Support in Istio</h4><p><a href="https://istio.io/">Istio</a> is arguably the most popular service mesh at the moment. Therefore developers often look to see how they can leverage it to implement developer or operational patterns such as bulkheads.</p><p>To add rate limiting to Istio, <a href="https://istio.io/docs/tasks/policy-enforcement/enabling-policy/">policy enforcement</a> needs to be enabled in conjunction with Redis and <a href="https://istio.io/docs/reference/config/policy-and-telemetry/adapters/redisquota/">an adapter</a> so that quotas can be stored. If just the testing of configurations is required, the <a href="https://istio.io/docs/reference/config/policy-and-telemetry/adapters/memquota/">memquota</a> adapter can be used. Next, for Istio to apply rate limiting, a VirtualService definition needs to be added for each service that will be participating. Finally, <a href="https://istio.io/docs/tasks/policy-enforcement/rate-limiting/">rate limiting</a> can now be applied to the traffic segments.</p><p>Figure 3 shows an example of an Istio configuration that limits a <em>web</em> service to issue no more than 500 requests per second against a <em>users</em> service and a <em>search</em> service to issue no more than 200 requests per second. If any of these services exceeds their allowed budget of request per second, Istio’s <a href="https://glasnostic.com/blog/microservices-architecture-patterns-service-mesh-glossary#Data-Plane">data plane</a> will simply return with an HTTP status code 429 (“Too Many Requests”) instead of proxying the request to the service.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fjsfiddle.net%2Fguesslin%2F692sua14%2Fembedded%2Fresult%2F&amp;src=https%3A%2F%2Fjsfiddle.net%2Fguesslin%2F692sua14%2Fembedded%2Fresult%2F&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/ff5555628f8d74e795011bd66001c154/href">https://medium.com/media/ff5555628f8d74e795011bd66001c154/href</a></iframe><h3>Two Perspectives on the Bulkhead</h3><p>As we saw in our scenario where two development teams are developing their own siloed applications, which are allowed to communicate with each other under very specific circumstances, their primary concern has been, “Will my application run as designed?” Although they have obviously given some thought to traffic limits, they have not anticipated the potential problems they’ll run into when these two applications are deployed to production, nor the possible side effects, when they start to interact with <em>other</em> services and applications.</p><p>If we look at the same scenario from the perspective of the operators, they are going to be more concerned with, “Will any of the services that comprise these two applications potentially cause the entire <a href="https://glasnostic.com/blog/microservices-architecture-patterns-service-mesh-glossary#Service-Landscape"><em>service landscape</em></a> to fail?” As well as, “How can I in real-time prevent this scenario from happening, while at the same time not have to rely on static deployment descriptors?” Operators also need the ability to create independent bulkheads that won’t interfere with other pre-existing and potentially overlapping policies. In a nutshell, operations teams want the ability to <em>layer</em> policies around the bulkhead to protect the surrounding architecture.</p><h3>Glasnostic’s Operational Perspective</h3><p>Glasnostic is a control plane in the form of a virtual router that is built from the ground up to support operational patterns. It is analogous to a sound engineer’s mixing board. As such, it is designed around the concept of grouping service interactions logically in channels, with each channel acting as a point of control for the interactions it applies to. Glasnostic supports the creation of any number of channels, for arbitrary sets of interactions. Once a channel is defined, operations teams can then control its underlying interactions by applying policies and operations. Channels are also independent of each other and thus can be layered arbitrarily.</p><blockquote>Glasnostic is a control plane for operations teams that controls the complex interactions among microservice applications in order to detect and remediate issues, prevent cascading failures and avert security breaches.</blockquote><p>Let’s look at two examples of bulkheads from the operational perspective. First, we’ll implement the same example as we did in the developers perspective.</p><p>Based on this example we’re then looking at a scenario where the shared <em>users</em> service is putting too much load on the existing <a href="https://en.wikipedia.org/wiki/Master_data_management"><em>master data management</em></a> system used by the whole enterprise.</p><h4>Example 1: Simple Bulkhead</h4><p>In this first example, we’ll look at our earlier scenario from above, where two microservice applications are generally segmented from each other, but the teams want to allow a limited number of requests from the <em>web</em> and <em>search</em> services of <em>app2</em> to be able to reach the shared <em>users</em> service of <em>app1</em>.</p><p>Unlike Istio, which requires lengthy and tediously complex YAML configurations to implement such rate limiting, Glasnostic users need to create only two simple channels:</p><ul><li>One channel covering the traffic from <em>web</em> services to <em>users</em> services with a limit of 500 requests per second and</li><li>Another channel covering the traffic from <em>search</em> services to <em>users</em> services with a limit of 200 requests per second.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xTnnrxV1XpVu4-lW.png" /><figcaption><strong><em>Figure 4</em></strong><em>: Simple bulkhead operational pattern (1) involving two channels “App2 web → users rate limit” (2) and “App2 search → users rate limit” (3) set to limit requests to 500 and 200 requests per second, respectively.</em></figcaption></figure><h4>Example 2: Layered Bulkheads</h4><p>In this next example, let’s say that the development teams did not take into account the load (more than 100 concurrent requests) that their shared users service would eventually put on an upstream master data management system, which happens to be critical for the operation of the entire service landscape.</p><p>To remediate the situation, the operations group quickly creates a bulkhead channel that captures requests from all <em>users</em> services to the <em>master-data</em> services and applies <a href="https://glasnostic.com/blog/preventing-systemic-failure-backpressure">backpressure</a> by setting a concurrency limit of 20 concurrent requests. It also informs the relevant development teams of the newly created bulkhead so they can explore alternative designs that can help avoid the load issue in the future.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*z6m89C6e30ISjRDC.png" /><figcaption><strong><em>Figure 5</em></strong><em>: Bulkhead pattern with additional “Master Data Bulkhead” channel (2) exerting backpressure against the previous pair of channels (1).</em></figcaption></figure><h3>Summary</h3><p>Connecting microservice applications in a larger service landscape leads to complex interaction behaviors that present a fundamentally new challenge to operations teams. One popular strategy to contain these behaviors is to strategically insert bulkheads into the landscape. Bulkheads should support access limits between otherwise separated groups of services so that services can fail over in a controlled fashion.</p><p>Bulkheads can be implemented in a way that focuses on either the concerns of developers or the concerns of operations teams. The key difference between these two implementations is that developers are more concerned with whether or not their application will run as designed, while the operations team is more concerned with whether or not they can effectively secure and scale the services when they begin to interact with additional services in an organic manner.</p><p>While Kubernetes and Linkerd provide very limited to no support for bulkheads, Istio can be coerced to implement bulkheads if configured correctly. Bulkheads become significantly easier in Glasnostic, in particular with the operational perspective in mind. This is because, unlike service meshes, Glasnostic takes a layered approach to policy definition that enables rate limiting in conjunction with the bulkhead operational pattern.</p><p><em>Originally published at </em><a href="https://glasnostic.com/blog/preventing-systemic-failure-bulkheads"><em>https://glasnostic.com</em></a><em> on May 14, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c443c787978d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/glasnostic/preventing-systemic-failure-bulkheads-in-microservice-architectures-c443c787978d">Preventing Systemic Failure: Bulkheads in Microservice Architectures</a> was originally published in <a href="https://medium.com/glasnostic">Glasnostic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Preventing Systemic Failure: Circuit Breaking — What it is and How it Works, Part 2]]></title>
            <link>https://medium.com/glasnostic/preventing-systemic-failure-circuit-breaking-what-it-is-and-how-it-works-part-2-2f4c93504be2?source=rss-114c7ec181cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f4c93504be2</guid>
            <category><![CDATA[operations]]></category>
            <category><![CDATA[service-mesh]]></category>
            <category><![CDATA[circuit-breaker]]></category>
            <category><![CDATA[microservices]]></category>
            <dc:creator><![CDATA[Yu-Han Lin]]></dc:creator>
            <pubDate>Thu, 28 Mar 2019 03:53:14 GMT</pubDate>
            <atom:updated>2019-04-03T21:33:05.364Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*h1XpmYF_F1EVSela.jpg" /><figcaption>Circuit breaking a parking structure in 2018</figcaption></figure><h3>Preventing Systemic Failure: Circuit Breaking — What it is and How it Works, Part 2</h3><p><em>This is the second of a two-part series on circuit breaking. In </em><a href="https://glasnostic.com/blog/preventing-systemic-failure-circuit-breaking-part-1"><em>part one</em></a><em>, we covered the pattern and how it is approached differently by developers and operators. In this post, we’ll explore its typical use cases and how it is implemented in modern service middleware.</em></p><h3>Typical Microservice Use Cases</h3><p>Developers and operators typically use circuit breaking for different purposes. Being primarily concerned with protecting their code, developers look to circuit breaking as a way to compensate for upstream failures. Operators, on the other hand, are responsible for the stability and availability of the entire service landscape and thus use circuit breaking primarily to monitor and remediate.</p><h4>Developers: Compensating for Upstream Failures</h4><p>Besides merely “breaking the circuit” and moving on, developers care about mainly three benefits of circuit breakers. First, because circuit breakers allow developers to deal with service failures, clients can adapt to changes in service availability dynamically over time and in a graceful manner. Secondly, circuit breakers that share their state across a service architecture provide network effects that can significantly improve responsiveness in the face of failures. Third, circuit breakers coupled with intelligent routing and load balancing can be used to automatically substitute healthy service instances for failed ones, thus promoting self-healing.</p><h4>Operators: Monitoring and Remediation</h4><p>Circuit breakers are a great way for operations teams to spot trouble before it cascades into bigger problems. When a circuit breaker is tripped, operators might decide to divert some or most traffic away from a service while the responsible engineering team investigates the relevant logs and metrics. Because of its usefulness in relieving systems of acute stress, diverting traffic or <em>load shedding</em>, this represents the most popular use of circuit breaking among operators.</p><p>Another, closely related, variant is to define circuit breakers as predetermined breaking points in the architecture. Ideally, such breakers would be set up in places which are known to bear loads in direct proportion to critical systems. Such breakers work in essence as canaries in the architecture that, again, lead to remediation through load shedding.</p><h4>Advanced Circuit Breaking</h4><p>As circuit breakers evolved from client-side libraries to middleware, shared-state breakers and platforms, their definition also became increasingly diverse. The developer and operational use cases of circuit breaking diverged and its definitions involved an increasing number of parameters. Circuit breaking as provided today by cloud traffic controllers such as Glasnostic can be applied to traffic links that have been defined by arbitrary sets of endpoints, and combined with a number of complementary patterns such as timeouts, backpressure or brownouts. These combinations of patterns are then refined over time in conjunction with a number of parameters such as rate of requests, concurrency, bandwidth or latency.</p><h3>Circuit Breaking with Hystrix</h3><p><a href="https://github.com/Netflix/Hystrix">Netflix’ Hystrix</a> was the first service middleware dedicated exclusively to circuit breaking. When it was released to the public in 2012 to provide microservice architectures with “greater tolerance of latency and failure,” it was already being used extensively at Netflix for over a year. Hystrix continued to serve as a fundamental part of the Netflix’ service middleware until it entered maintenance mode in late 2018, marking, according to the <a href="https://github.com/Netflix/Hystrix">project</a>, a “shift [in focus] towards more adaptive implementations that react to an application’s real-time performance rather than pre-configured settings.”</p><p>Hystrix is a Java library that developers can use to wrap service calls with circuit breaking logic. It is based on thresholds and can fail calls immediately and perform fallback logic as shown in <a href="https://glasnostic.com/blog/preventing-systemic-failure-circuit-breaking-part-1#figure-1">part 1</a>. Besides providing timeouts and concurrency limits, it can also publish metrics to monitoring tools. Finally, when used in conjunction with the <a href="https://github.com/Netflix/archaius">Archaius</a> library, it can also support dynamic configuration changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*g7JIF_5lkRoeC8bP.png" /><figcaption><strong><em>Figure 1</em></strong><em>. Hystrix </em><a href="https://github.com/Netflix-Skunkworks/hystrix-dashboard"><em>dashboard</em></a><em> showing call volumes, various interaction metrics and breaker status. Circles represent call volumes and sparklines show how volumes over the past 2 minutes.</em></figcaption></figure><p>Although Hystrix supported refinements such as combining circuit breaking with timeouts and concurrency pools, it proved ultimately not flexible enough for the increasingly dynamic interaction behaviors in modern organic architectures. The ability to set thresholds and client-side concurrency pools gives service developers sufficient control to isolate their code from upstream failures, but ceases to be useful where systemic, operational concerns gain importance. As such, the decline of Hystrix is a direct consequence of the limitation of circuit breaking as a developer pattern.</p><h3>Circuit Breaking in Service Meshes</h3><h4>Istio</h4><p><a href="https://glasnostic.com/blog/kubernetes-service-mesh-what-is-istio">Istio</a> is a service mesh that supports circuit breaking based on connection pool, requests per connection, and failure detection parameters. It does this with the help of so-called “destination rules”, which tell each Envoy sidecar proxy which policy to apply to traffic, and how. This step happens after routing has occurred, which is not always ideal. Destination rules may specify limits on load balancing, the connection pool size, and the parameters for what ends up qualifying as an “outlier” so that unhealthy hosts can be removed from the load balancing pool. This type of circuit breaking is great at insulating clients from service failures, but because destination rules are always applied cluster-wide, it lacks a way of limiting breakers to only a subset of clients. To achieve combinations of circuit breakers with e.g. quality-of-service patterns, multiple client-specific routing rules must be created, each with its own destination rule.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fjsfiddle.net%2Fx4npsgfL%2Fshow%2Fembedded%2F&amp;src=https%3A%2F%2Fjsfiddle.net%2Fx4npsgfL%2Fshow%2Fembedded%2F&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/7d7f588f84416a59fbd25037fa652827/href">https://medium.com/media/7d7f588f84416a59fbd25037fa652827/href</a></iframe><h4>Linkerd</h4><p>Circuit breaking in Linkerd is somewhat complicated, reflecting the generally conflicted state of circuit breaking as a developer pattern. While Linkerd 1 continues to support <a href="https://linkerd.io/1/features/circuit-breaking/">robust circuit breaking</a> courtesy of the original Finagle code, <a href="https://glasnostic.com/blog/an-introduction-to-what-is-linkerd-service-mesh">Linkerd 2</a>, a complete, lightweight rewrite in Rust and Go, does not do so <a href="https://github.com/linkerd/linkerd2/issues/1255">directly</a>. Instead, it offers related functionality in its Conduit proxy, which is now merged into Linkerd 2, albeit without support for retries and timeouts.</p><p>To implement retry and timeout support, Linkerd 2.1 introduced the concept of “service profiles,” custom Kubernetes resources to provide Linkerd with extra information about a service. Using service profiles, operators can now define routes as being “retryable” or having a specific timeout. While this provides some essential functionality related to it, circuit breaking in Linkerd is still a ways off.</p><h3>Circuit Breaking with Glasnostic</h3><p>Glasnostic is a cloud traffic controller that enables operations teams to control the complex emergent behaviors that their organic architectures exhibit. This enables companies to run diverse architectures in an agile manner, without costly revalidation on every change. As a result, development and operations are ideally positioned to adapt to their company’s rapidly changing business needs.</p><p>Unlike Hystrix and service meshes, which implement circuit breaking from a developer’s perspective, Glasnostic implements circuit breaking as an operational pattern, designed for operators.</p><p>Glasnostic’s control plane provides high-level visibility of large-scale, complex and dynamic interaction behaviors that enables operators to remediate issues quickly. Operators are able to apply tried-and-tested, predictable operational patterns such as circuit breaking by exerting fine-grained control over interactions across arbitrary sets of service endpoints. Because operational patterns may be readily combined to form highly refined, compound patterns, circuit breakers can likewise be easily refined by combining them with e.g. <a href="https://glasnostic.com/blog/preventing-systemic-failure-backpressure">backpressure</a> based on request rate, bandwidth or concurrency.</p><p>For example, <a href="#figure-3">figure 3</a> shows a channel set up to monitor and control intermittently recurring latency spikes across a set of otherwise unrelated services. Without looking for a putative root cause, operators decide to first control the situation by circuit-breaking the more extreme long-running requests. They achieve this by first defining a new channel covering the services in question, as well as any potential clients, and then imposing a suitable latency limit on the interactions governed by the channel. This allows the operations team to control the situation until engineering is able to provide a fix.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ptSQpuuaGrZr7jkA.png" /><figcaption><strong><em>Figure 3</em></strong><em>. Glasnostic console showing a channel (1) set up to monitor and control intermittently recurring latency spikes across a series of services. Configuring the circuit breaker to trip when latencies reach 1,800 ms (2) serves as an early warning system to the operations team while at the same time controlling the situation. Once the engineering teams responsible for the services have identified a fix, the circuit breaker may be removed.</em></figcaption></figure><p>Of course, initial policies are often just that–first attempts to remediate a situation — and need to remain open to adjustments. Adjusting or complementing policies in Glasnostic is both fast and easy. For instance, the operations team may find that the initial channel policy can be further refined by first circuit breaking non-mission-critical clients to leave mission-critical clients unaffected as long as possible. To accomplish this, they could define a refinement channel covering only non-mission-critical clients and adding a policy that circuit-breaks them based on connection and request allowances. <a href="#figure-4">Figure 4</a> shows such an auxiliary refinement channel set up with both concurrency and request policies to circuit-break non-mission-critical clients before the original latency breaker is tripped, thus increasing availability for mission-critical systems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_EeyfZ6f0YiiNHg3.png" /><figcaption><strong><em>Figure 4</em></strong><em>. Glasnostic console showing a refinement channel (1) for the channel set up previously (2), configured to break non-mission-critical clients based on connection pool and request rate parameters first, thus delaying circuit breaking for critical clients (3). The request breaker is currently active.</em></figcaption></figure><p>Unlike the circuit breakers typically offered by service middleware such as API gateways and service meshes, Glasnostic supports circuit breaking as an operational pattern, between arbitrary sets of endpoints and in realtime, as opposed to via static deployment descriptors. This allows operators to specify circuit breakers that are not just tactical adjustments to local interactions but instead steps towards improving stability and availability that are meaningful for the entire service landscape. For instance, while Istio implements circuit breaking based on destination rules, Glasnostic can apply circuit breaking to any set of interactions, clients or services, past, present or future. As a result, operators can set separate policies for different traffic classes.</p><h3>Summary</h3><p>Circuit breaking is a fundamental pattern designed to minimize the impact of failures, to prevent them from cascading and compounding, and to ensure end-to-end performance. Because it can be leveraged both as a developer pattern and an operational pattern, it can be applied broadly, often causing confusion.</p><p>As a developer pattern, it is predominantly used as a fairly rudimentary compensation strategy that is difficult to refine without considering each specific call. On the other hand, circuit breaking as an operational pattern aims to relieve distressed systems of pressure to manage both, systemic stability and performance. Its behavior is often further refined by combining it with other stability patterns such as timeouts or backpressure. Operational circuit breakers used to depend on separately deployed service middleware such as API gateways or service meshes. However, because service meshes address primarily developer concerns, support for circuit breaking as an operational pattern is limited and inconsistent across implementations. As a result, operational circuit breaking is best done using a cloud traffic controller like Glasnostic.</p><p>Glasnostic is a cloud traffic controller that enables operations teams to control the complex emergent behaviors that their organic architectures exhibit. The Glasnostic control plane allows operators to apply a number of operational patterns such as circuit breaking to arbitrary sets of interactions. It also allows operators to refine operational goals by combining patterns. This lets operators and developers deploy faster, to production and support the business to adapt to ever faster-changing business needs.</p><p><em>Originally published at </em><a href="https://glasnostic.com/blog/preventing-systemic-failure-circuit-breaking-part-2"><em>glasnostic.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f4c93504be2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/glasnostic/preventing-systemic-failure-circuit-breaking-what-it-is-and-how-it-works-part-2-2f4c93504be2">Preventing Systemic Failure: Circuit Breaking — What it is and How it Works, Part 2</a> was originally published in <a href="https://medium.com/glasnostic">Glasnostic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Preventing Systemic Failure: Circuit Breaking — What it is and How it Works, Part 1]]></title>
            <link>https://medium.com/glasnostic/preventing-systemic-failure-circuit-breaking-what-it-is-and-how-it-works-part-1-e79b3dbd3813?source=rss-114c7ec181cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/e79b3dbd3813</guid>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[circuit-breaker]]></category>
            <category><![CDATA[operations]]></category>
            <category><![CDATA[service-mesh]]></category>
            <dc:creator><![CDATA[Yu-Han Lin]]></dc:creator>
            <pubDate>Thu, 28 Mar 2019 01:46:44 GMT</pubDate>
            <atom:updated>2019-03-28T06:14:16.493Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*L260gwxwygwFy-Pc.jpg" /><figcaption>Circuit breaking a nuclear reactor in the 1940s</figcaption></figure><h3>Preventing Systemic Failure: Circuit Breaking — What it is and How it Works, Part 1</h3><p><em>This is the first of a two-part series on circuit breaking. In this post, we cover the pattern and how it is approached differently by developers and operators. In </em><a href="https://glasnostic.com/blog/preventing-systemic-failure-circuit-breaking-part-2"><em>part two</em></a><em>, we’ll explore its typical use cases and how it is implemented in modern service middleware.</em></p><p>Service-to-service calls across the network are the essence as well as the bane of microservice architectures. It is not a question of whether such calls will fail, but rather when they will fail and how often. Service dependencies may fail due to logical errors, capacity issues or any other external factor. In fact, failure is one of the better outcomes. The worst case is a call that simply “hangs” until it times out.</p><p>Such failures are bad enough in standalone applications, but if they are allowed to ripple and compound through a service architecture, they can quickly morph into a series of catastrophic events. For example, a load spike that at first might choke off only a single data store can quickly lead to widespread slowness in downstream systems. In turn, this can lead to exhausted connection pools, interference by auto-scaling, further downstream failures or unexpected behaviors that can cause the situation to quickly spiral out of control.</p><p>Therefore, the critical questions for microservice practitioners are: how do I prevent such failures from cascading and compounding through the architecture and how do I ensure a service’s performance and availability if one or more of its dependencies fail? The answer to these questions is often to protect important service calls with a <em>circuit breaker</em>.</p><blockquote>Circuit breaking is a fundamental pattern designed to minimize the impact of failures, to prevent them from cascading and compounding, and to assure end-to-end performance.</blockquote><p>Like its analog from the world electrical circuits, the purpose of a circuit breaker is to protect systems from overloading and to prevent failures from — quite literally — burning down the house.</p><h3>Microservices and The Circuit Breaker Pattern</h3><p>The circuit breaker pattern was already a fundamental operational pattern when Michael Nygard introduced it to the wider audience of software practitioners in his book “<a href="https://pragprog.com/book/mnee/release-it">Release It!</a>” It has lived a double life as both an operational and development pattern ever since. Like in electrical circuits, the basic pattern involves injecting a switch into a line of communication that can be either <em>closed</em> or <em>open</em>. If the breaker is closed, calls are allowed to pass through. Conversely, if the breaker is open, calls fail immediately (<a href="https://glasnostic.com/blog/preventing-systemic-failure-circuit-breaking-part-1#figure-1">figure 1</a>).</p><p>The difference between circuit breaking as an operational pattern and circuit breaking as a development pattern lies in what causes these states to change and who changes them.</p><h4>Circuit Breaking as a Developer Pattern</h4><p>Because developers care foremost about their code, circuit breaking as a developer pattern is in effect a <em>compensation strategy</em> to minimize the impact failures in dependencies may have on it.</p><blockquote>Circuit breaking as a developer pattern is a compensation strategy designed to minimize a service’s exposure to a failed dependency.</blockquote><p>As a result, developers gravitate towards circuit breakers that they can link against or are otherwise close to their service, such as <a href="https://github.com/Netflix/Hystrix">Hystrix</a> for example. Developers can spend a considerable amount of time tweaking the logic that opens and closes the breaker. Although many variations of such logic exist, the basic mechanism involves the breaker library passing calls through as long as the breaker is closed and failing them immediately when the breaker is open (<a href="#figure-1">figure 1</a>). If calls are being passed through, the breaker checks the return status of the responses. Failed calls are counted towards a threshold or limit, while successful calls reset the failure count. If failures exceed the allowed maximum, the library then opens the breaker. Because this has the effect of failing all subsequent calls, a timer is set at the same time that upon firing sets the limit to a low, “canary” value and closes the breaker again. This state is also referred to as being “<em>half open</em>”. The first “canary” call that succeeds resets the breaker back to its “fully closed” state and the cycle continues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/846/0*8iiSIWacZyVl7nhM.png" /><figcaption><strong><em>Figure 1</em></strong><em>. Traditional circuit breaker logic. Client calls are passed through as long as the breaker remains closed and are failed immediately if the breaker is open. While it is closed, the breaker observes service responses for failures and “trips” itself as soon as a predefined threshold is reached. A timer then closes the breaker again after a while to let a few “canaries” through. If they succeed, the breaker is closed again. If not, it remains open. This mechanism helps clients avoid excessive slow-down due to a failed service.</em></figcaption></figure><p>There are many variations of this basic circuit breaking mechanism. For instance, breakers may expire accumulated failures after some time or employ failure budgets based on moving averages. However, as these variations become more sophisticated, they also depend increasingly on what the code in question aims to achieve. For example, a call to a recommendation engine may require a circuit breaker combined with a shorter timeout while a call to an authentication service should likely only be failed if it is known to be unresponsive. As a result, none of these variations have so far been able to replace the basic logic of the developer pattern. This is why circuit breaking as a compensating developer pattern is a fundamental, yet fairly limited technique for minimizing a service’s exposure to dependency failures.</p><h4>Circuit Breaking as an Operational Pattern</h4><p>Because operators are responsible for the health and systemic stability of the overall <a href="https://glasnostic.com/blog/microservices-architecture-patterns-service-mesh-glossary#Service-Landscape">service landscape</a>, they approach circuit breaking primarily from the perspective of protecting services, not merely isolating clients. As a result, circuit breaking as an operational pattern often resembles <em>load shedding</em>, i.e. the pattern of terminating requests to relieve services of pressure. An operations team may for instance notice that the latencies of a storage cluster began to increase by 10ms a few minutes ago and decide to shed load by starting to circuit-break non-mission critical services.</p><blockquote>Circuit breaking as an operational pattern aims to manage systemic stability and availability by relieving systems under duress of pressure.</blockquote><p>More complex architectures often require operators to refine how circuit breaking is applied. In our previous example of attempting to remediate the storage cluster’s slowness, the operations team may likely get better results (while causing less downstream disruption) by circuit-breaking long-running queries first and then adjusting the breaker as needed. Such refinements are often achieved by combining operational patterns such as circuit breakers with timeouts.</p><p>Another big difference between applying circuit breaking as an operational pattern and applying it as a developer pattern relates to how circuit breaking capabilities are made available. For developers, circuit breakers are typically provided in the form of a library that applications can link against. With a few exceptions, operators don’t have this option. Instead, they rely on the circuit-breaking capabilities of separately deployed middleware like <a href="https://glasnostic.com/blog/what-is-an-api-gateway-aws-express-kong">API gateways</a> or as part of an underlying platform such as a <a href="https://glasnostic.com/blog/what-is-a-service-mesh-istio-linkerd-envoy-consul">service mesh</a>.</p><p>However, with the advent of large-scale, <a href="https://glasnostic.com/blog/what-is-organic-architecture">organic architectures</a>, operators need the ability to apply circuit breaking not just between individual services, but between arbitrary and at times extensive sets of services. Implementing circuit breaking between sets of services is excruciatingly difficult to achieve with middleware or platforms that are designed to connect pairs of services in fairly static, small or mid-sized architectures. This is because each proxying instance has to be configured to differentiate between all kinds of clients as well as services and to do so in a manner that is consistent with every other instance of the cluster. Cloud traffic controllers such as Glasnostic are much better suited for this task.</p><p>Finally, due to the complex and unpredictable nature of <a href="https://glasnostic.com/blog/microservices-architecture-patterns-service-mesh-glossary#Emergent-Behaviors">emergent behaviors</a> in large-scale and dynamic architectures, circuit breaking for operational purposes can no longer rely on a static, “set-and-forget” configuration based on timers, failure budgets and reset canaries. Instead, operators need to be able to open or close breakers on demand and to adjust their functionality in real-time.</p><p><em>Originally published at </em><a href="https://glasnostic.com/blog/preventing-systemic-failure-circuit-breaking-part-1"><em>glasnostic.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e79b3dbd3813" width="1" height="1" alt=""><hr><p><a href="https://medium.com/glasnostic/preventing-systemic-failure-circuit-breaking-what-it-is-and-how-it-works-part-1-e79b3dbd3813">Preventing Systemic Failure: Circuit Breaking — What it is and How it Works, Part 1</a> was originally published in <a href="https://medium.com/glasnostic">Glasnostic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Security: Segmentation — What Is It and How Does It Work?]]></title>
            <link>https://medium.com/glasnostic/security-segmentation-what-is-it-and-how-does-it-work-7bd30a7fa4a?source=rss-114c7ec181cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/7bd30a7fa4a</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[segmentation]]></category>
            <category><![CDATA[it-operations]]></category>
            <category><![CDATA[architecture]]></category>
            <dc:creator><![CDATA[Yu-Han Lin]]></dc:creator>
            <pubDate>Sun, 03 Mar 2019 14:26:14 GMT</pubDate>
            <atom:updated>2019-03-03T14:26:14.354Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Uuu_lYWZOC7Snrid.jpg" /><figcaption>(Image source: <a href="http://www.salsify.com/">www.salsify.com</a>)</figcaption></figure><h3>Security: Segmentation — What Is It and How Does It Work?</h3><p>In this blog post, we’re explaining <em>segmentation</em> as an operational pattern and how it can be applied to a <a href="https://glasnostic.com/blog/microservices-architecture-patterns-service-mesh-glossary#Service-Landscape">service landscape</a> that is controlled by a cloud traffic controller like <a href="https://glasnostic.com/">Glasnostic</a>.</p><h3>What is Segmentation?</h3><p>At the most fundamental level, segmentation is about separating certain classes of traffic from each other, either based on network properties, protocols, or more generally, on arbitrary labels. While traditionally a rather blunt tool, segmentation can, if based on arbitrary labels, help enforce security policies even in dynamic environments like an <a href="https://glasnostic.com/blog/what-is-organic-architecture">organic architecture</a>.</p><p>Because segmentation has its roots in network security, and because enterprise development teams rarely know where their services will ultimately run or how they will interact with other deployments, segmentation is typically taken as an operational concern that is left to <em>operations</em> to address.</p><p>However, the desire for segmentation is not always driven by security concerns alone. Because today’s agile enterprises organize themselves increasingly around self-managing, parallel teams in order to adapt to ever faster-evolving business needs, they also look to segmentation as a means of isolating their respective deployments from each other. As a result, development teams are able to add deployments to the service landscape faster and with less risk.</p><p>For operators, addressing security and insulation concerns typically involves two steps. The first step is to logically partition the service landscape into <em>segments</em> of services. With segments in place, operators can then institute traffic policies between them as needed. The default traffic policy is to allow zero traffic between segments, regardless of the class it belongs to. However, it is also possible to whitelist specific classes of traffic as necessary. One motivation to do so is that a specific traffic class is essential for running the application.</p><h3>Segmenting with Glasnostic</h3><p>As a cloud traffic controller that manages traffic in general, Glasnostic is ideally suited to segment traffic between arbitrary sets of service endpoints.</p><p>To illustrate this point, consider the example of one of our customers who hosts a distributed video conferencing system. In this system, conference “rooms” consist of separate audio, video, screensharing and chat relay services. Audio is automatically transcribed by a transcription service and all three non-video streams, audio, audio transcription and chat are recorded by a recording service and ultimately stored for record-keeping and compliance reasons. Each conference room is instantiated separately, on demand and secured by a session controller against an entitlement service.</p><p>The diagram below shows a simplified view of the architecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ysvLtN1ikNVG7mBl.png" /><figcaption><em>Simplified diagram of a distributed video conferencing system. This diagram shows only one instance per service. An actual running system will have multiple gateways that are shared among conference participants as well as multiple service instances per room.</em></figcaption></figure><p>However, because misconfigurations, software errors and security breaches do occur, Glasnostic is used to further ensure that no data will be exchanged between conference rooms.</p><p>Conference participants connect to their conference room via an <a href="https://glasnostic.com/blog/what-is-an-api-gateway-aws-express-kong">API Gateway</a>.</p><p>The<em> </em>operator’s goal is to segment each conference room assembly to prevent malicious or accidental communication between the service instances of different rooms, even if a room is compromised. Conference rooms need to be segmented as a matter of operational policy.</p><p>Applying segmentation via traditional firewalling falls short here because conference rooms are continually spun up and torn down because the service addresses are dynamic and continuously reallocated.</p><p>The highly dynamic nature of this service landscape requires a service registry to provide labels on which the segmentation can be based. In our example, a prefix identifying the conference room can be prepended to each service name. A <em>video relay service</em> for room <em>A</em> would be then called A_video-relay and one for room <em>B</em>, B_video-relay.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HY1U3Kn80JBvQJDG.png" /><figcaption><em>Video conferences controlled by Glasnostic. A channel is defined to prohibit traffic between video relay services.</em></figcaption></figure><p>By relying on such labels, the operator can define a security policy that prevents traffic, e.g., from one <em>video relay</em> to another <em>video relay</em> service. To implement such a policy in Glasnostic, an operator would first create a new <em>channel</em>. She would then specify the pattern *_video-relay* for both, the client and service side to capture traffic between all video relay services, past, present and future, and across all conference rooms. Finally, she would specify a limit of zero requests to prevent any traffic between conference rooms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8W7j7ns9HNzdVbW_.png" /><figcaption><em>Video conference system controlled by Glasnostic. A traffic policy is applied to prevent traffic between video relay services.</em></figcaption></figure><p>Of course, such a channel only captures traffic between <em>video relay</em> services. A video conference room consists of more than just video relays, however. To control traffic between all components of a conference room, the operator could either create more such channels or simply broaden the channel definition. For instance, the operator could use multiple wildcards (e.g. *_*relay) or a regular expression such as *_(transcription|recording)-service.</p><h3>Other Uses for Segmentation</h3><p>Aside from our video conference use case, segmentation occurs of course in many other scenarios. In all cases, however, it is an <em>operational concern</em> that is imposed on applications by the operations team.</p><p>Additional use cases include:</p><ul><li>Systems may be considered important enough to warrant comprehensive segmentation around them, in effect making them “off-limits” to all clients. For instance, given the potential for catastrophic monetary loss, a financial services company may decide to completely prohibit access to their investment banking systems.</li><li>Development work in parallel teams may progress along independent branches that require segmentation between most of their respective deployments.</li><li>Data privacy or other legal concerns may require a company to run various parts of its service landscape in separate and insulated environments. For instance, a HealthTech company may be required to enforce segmentation in the cloud (e.g. via AWS VPC) and on-premises and to tightly control the types of traffic that may be exchanged between them.</li></ul><p>Segmentation is a fundamental operational concern and addresses both the security and insulation needs in the enterprise. Segmentation was traditionally implemented by changing network topologies, changing routing tables or using firewalls. These techniques are unsuitable for the fast-moving and dynamic world of the cloud and containers, however. In such environments, a cloud traffic controller such as Glasnostic is the perfect solution to enforce security and insulation policies while reaping the benefits of elasticity that the cloud provides.</p><p><em>Originally published at </em><a href="https://glasnostic.com/blog/segmentation-what-is-it-and-how-does-it-work"><em>glasnostic.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7bd30a7fa4a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/glasnostic/security-segmentation-what-is-it-and-how-does-it-work-7bd30a7fa4a">Security: Segmentation — What Is It and How Does It Work?</a> was originally published in <a href="https://medium.com/glasnostic">Glasnostic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>