Slide 1

Slide 1 text

Application Resilience Engineering and Operations at Netflix Ben Christensen – @benjchristensen – Software Engineer on API Platform at Netflix

Slide 2

Slide 2 text

Global deployment spread across data centers in multiple AWS regions. Geographic isolation, active/active with regional failover coming (http://techblog.netflix.com/2013/05/denominating-multi-region-sites.html)

Slide 3

Slide 3 text

AWS Availability Zone AWS Availability Zone AWS Availability Zone 3 data centers (AWS Availability Zones) operate in each region with deployments split across them for redundancy in event of losing an entire zone.

Slide 4

Slide 4 text

Each zone is populated with application clusters (‘auto-scaling groups’ or ASGs) that make up the service oriented distributed system. Application clusters operate independently of each other with software and hardware load balancing routing traffic between them.

Slide 5

Slide 5 text

Application clusters are made up of 1 to 100s of machine instances per zone. Service registry and discovery work with software load balancing to allow machines to launch and disappear (for planned or unplanned reasons) at any time and become part of the distributed system and serve requests. Auto-scaling enables system-wide adaptation to demand as it launches instances to meet increasing traffic and load or handle instance failure.

Slide 6

Slide 6 text

Failed instances are dropped from discovery so traffic stops routing to them. Software load balancers on client applications detect and skip them until discovery removes them.

Slide 7

Slide 7 text

Auto-scale policies brings on new instances to replace failed ones or to adapt to increasing demand.

Slide 8

Slide 8 text

User Request Dependency A Dependency D Dependency G Dependency J Dependency M Dependency P Dependency B Dependency E Dependency H Dependency K Dependency N Dependency Q Dependency C Dependency F Dependency I Dependency L Dependency O Dependency R Applications communicate with dozens of other applications in the service-oriented architecture. Each of these client/server dependencies represents a relationship within the complex distributed system.

Slide 9

Slide 9 text

User Request Dependency A Dependency D Dependency G Dependency J Dependency M Dependency P Dependency B Dependency E Dependency H Dependency K Dependency N Dependency Q Dependency C Dependency F Dependency I Dependency L Dependency O Dependency R User request blocked by latency in single network call Any one of these relationships can fail at any time. They can be intermittent or cluster-wide, immediate with thrown exceptions or returned error codes or latency from various causes. Latency is particularly challenging for applications to deal with as it causes resource utilization in queues and pools and blocks user requests (even with async IO).

Slide 10

Slide 10 text

At high volume all request threads can block in seconds User Request Dependency A Dependency D Dependency G Dependency J Dependency M Dependency P Dependency B Dependency E Dependency H Dependency K Dependency N Dependency Q Dependency C Dependency F Dependency I Dependency L Dependency O Dependency R User Request User Request User Request User Request User Request User Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Latency at high volume can quickly saturate all application resources (queues, pools, sockets, etc) causing total application failure and the inability to serve user requests even if all other dependencies are healthy.

Slide 11

Slide 11 text

Dozens of dependencies. One going bad takes everything down. 99.99%30 = 99.7% uptime 0.3% of 1 billion = 3,000,000 failures 2+ hours downtime/month Reality is generally worse. Large distributed systems are complex and failure will occur. If failure from every component is allowed to cascade across the system they will all affect the user.

Slide 12

Slide 12 text

CONSTRAINTS Speed of Iteration Client Libraries Mixed Environment Solution design was done with constraints, context and priorities of the Netflix environment.

Slide 13

Slide 13 text

CONSTRAINTS Speed of Iteration Client Libraries Mixed Environment Speed of iteration is optimized for and this leads to client/server relationships where client libraries are provided rather than each team writing their own client code against a server protocol. This means “3rd party” code from many developers and teams is constantly being deployed into applications across the system. Large applications such as the Netflix API have dozens of client libraries.

Slide 14

Slide 14 text

CONSTRAINTS Speed of Iteration Client Libraries Mixed Environment Speed of iteration is optimized for and this leads to client/server relationships where client libraries are provided rather than each team writing their own client code against a server protocol. This means “3rd party” code from many developers and teams is constantly being deployed into applications across the system. Large applications such as the Netflix API have dozens of client libraries.

Slide 15

Slide 15 text

CONSTRAINTS Speed of Iteration Client Libraries Mixed Environment The environment is also diverse with different types of client/server communications and protocols. This heterogenous and always changing environment affects the approach for resilience engineering and is potentially very different than approaches taken for a tightly controlled codebase or homogenous architecture.

Slide 16

Slide 16 text

User Request Dependency A Dependency D Dependency G Dependency J Dependency M Dependency P Dependency B Dependency E Dependency H Dependency K Dependency N Dependency Q Dependency C Dependency F Dependency I Dependency L Dependency O Dependency R User Request User Request User Request User Request User Request User Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Each dependency - or distributed system relationship - must be isolated so its failure does not cascade or saturate all resources.

Slide 17

Slide 17 text

cy D dency G ependency J Dependency M Dependency B Dependency E Dependency H Dependency K Dependency N Dependency C Dependency F Dependency I Dependency L Dependency O User Request User Request User Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Network Request - TCP/HTTP, latency, 4xx, 5xx, etc Deserialization - JSON/XML/Thrift/Protobuf/etc Logic - argument validation, caches, metrics, logging, multivariate testing, routing, etc Serialization - URL and/or body generation Logic - validation, decoration, object model, caching, metrics, logging, etc It is not just the network that can fail and needs isolation but the full request/response loop including business logic and serialization/deserialization. Protecting against a network failure only to return a response that causes application logic to fail elsewhere in the application only moves the problem.

Slide 18

Slide 18 text

User Request Dependency A Dependency D Dependency G Dependency J Dependency M Dependency P Dependency B Dependency E Dependency H Dependency K Dependency N Dependency Q Dependency C Dependency F Dependency I Dependency L Dependency O Dependency R Bulkheading is an approach to isolating failure and latency. It can be used to compartmentalize each system relationship so their failure impact is limited and controllable.

Slide 19

Slide 19 text

User Request Dependency A Dependency D Dependency G Dependency J Dependency M Dependency P Dependency B Dependency E Dependency H Dependency K Dependency N Dependency Q Dependency C Dependency F Dependency I Dependency L Dependency O Dependency R Bulkheading is an approach to isolating failure and latency. It can be used to compartmentalize each system relationship so their failure impact is limited and controllable.

Slide 20

Slide 20 text

User Request Dependency A Dependency D Dependency G Dependency J Dependency M Dependency P Dependency B Dependency E Dependency H Dependency K Dependency N Dependency Q Dependency C Dependency F Dependency I Dependency L Dependency O Dependency R Responses can be intercepted and replaced with fallbacks.

Slide 21

Slide 21 text

User Request Dependency A Dependency D Dependency G Dependency J Dependency M Dependency P Dependency B Dependency E Dependency H Dependency K Dependency N Dependency Q Dependency C Dependency F Dependency I Dependency L Dependency O Dependency R A user request can continue in a degraded state with a fallback response from the failing dependency.

Slide 22

Slide 22 text

Logic - validation, decoration, object model, caching, metrics, logging, etc Deserialization - JSON/XML/Thrift/Protobuf/etc Network Request - TCP/HTTP, latency, 4xx, 5xx, etc Serialization - URL and/or body generation Logic - argument validation, caches, metrics, logging, multivariate testing, routing, etc A bulkhead wraps around the entire client behavior not just the network portion.

Slide 23

Slide 23 text

Tryable Semaphore Rejected Permitted Logic - validation, decoration, object model, caching, metrics, logging, etc Deserialization - JSON/XML/Thrift/Protobuf/etc Network Request - TCP/HTTP, latency, 4xx, 5xx, etc Serialization - URL and/or body generation Logic - argument validation, caches, metrics, logging, multivariate testing, routing, etc An effective form of bulkheading is a tryable semaphore that restricts concurrent execution. Read more at https://github.com/Netflix/Hystrix/wiki/How-it-Works#semaphores

Slide 24

Slide 24 text

Thread-pool Rejected Permitted Logic - validation, decoration, object model, caching, metrics, logging, etc Deserialization - JSON/XML/Thrift/Protobuf/etc Network Request - TCP/HTTP, latency, 4xx, 5xx, etc Serialization - URL and/or body generation Logic - argument validation, caches, metrics, logging, multivariate testing, routing, etc Timeout A thread-pool also limits concurrent execution while also offering the ability to timeout and walk away from a latent thread. Read more at https://github.com/Netflix/Hystrix/wiki/How-it-Works#threads--thread- pools

Slide 25

Slide 25 text

Construct Hystrix Command Object .observe() .execute() Asynchronous Synchronous run() Circuit Open? getFallback() Success? Exception Thrown Successful Response Return Successful Response Calculate Circuit Health Feedback Loop Not Implemented Successful Fallback Failed Fallback Exception Thrown Exception Thrown Return Fallback Response Rate Limit? Timeout Short-circuit Reject Yes return immediately .queue() Asynchronous Hystrix execution flow chart. Read more at https://github.com/Netflix/Hystrix/wiki/How-it-Works#flow-chart

Slide 26

Slide 26 text

Construct Hystrix Command Object .observe() .execute() Asynchronous Synchronous run Circuit Open? getFallback() Return Successful Response Calculate Cir Health Not Implemented Successful Fallback Failed Fallback Exception Thrown Exception Thrown Return Fallback Response Rate Limit? Time Short-circuit Reject Yes return immediately .queue() Asynchronous Execution can be synchronous or asynchronous (via a Future or Observable).

Slide 27

Slide 27 text

Construct Hystrix Command Object .observe() .execute() Asynchronous Synchronous run Circuit Open? getFallback() Return Successful Response Calculate Cir Health Not Implemented Successful Fallback Failed Fallback Exception Thrown Exception Thrown Return Fallback Response Rate Limit? Time Short-circuit Reject Yes return immediately .queue() Asynchronous Current state is queried before allowing execution to determine if it is short-circuited or throttled and should reject.

Slide 28

Slide 28 text

.observe() .execute() run() Circuit Open? getFallback() Success? Exception Thrown Successful Response Return Successful Response Calculate Circuit Health Feedback Loop Not Implemented Successful Fallback Failed Fallback Rate Limit? Timeout Short-circuit Reject Yes return immediately .queue() If not rejected execution proceeds to the run() method which performs underlying work.

Slide 29

Slide 29 text

.observe() .execute() run() Circuit Open? getFallback() Success? Exception Thrown Successful Response Return Successful Response Calculate Circuit Health Feedback Loop Not Implemented Successful Fallback Failed Fallback Rate Limit? Timeout Short-circuit Reject Yes return immediately .queue() Successful responses return.

Slide 30

Slide 30 text

.observe() .execute() run() Circuit Open? getFallback() Success? Exception Thrown Successful Response Return Successful Response Calculate Circuit Health Feedback Loop Not Implemented Successful Fallback Failed Fallback Rate Limit? Timeout Short-circuit Reject Yes return immediately .queue() All requests, successful and failed, contribute to a feedback loop used to make decisions and publish metrics.

Slide 31

Slide 31 text

.observe() .execute() run() Circuit Open? getFallback() Success? Exception Thrown Successful Response Return Successful Response Calculate Circuit Health Feedback Loop Not Implemented Successful Fallback Failed Fallback Rate Limit? Timeout Short-circuit Reject Yes return immediately .queue() All failure states are routed through the same path.

Slide 32

Slide 32 text

Construct Hystrix Command Object .observe() .execute() Asynchronous Synchronous run() Circuit Open? getFallback() Return Successful Response Calculate Circu Health Not Implemented Successful Fallback Failed Fallback Exception Thrown Exception Thrown Return Fallback Response Rate Limit? Timeo Short-circuit Reject Yes return immediately .queue() Asynchronous Every failure is given the opportunity to retrieve a fallback which can result in one of three results.

Slide 33

Slide 33 text

Construct Hystrix Command Object .observe() .execute() Asynchronous Synchronous run() Circuit Open? getFallback() Success? Exception Thrown Successful Response Return Successful Response Calculate Circuit Health Feedback Loop Not Implemented Successful Fallback Failed Fallback Exception Thrown Exception Thrown Return Fallback Response Rate Limit? Timeout Short-circuit Reject Yes return immediately .queue() Asynchronous Hystrix execution flow chart. Read more at https://github.com/Netflix/Hystrix/wiki/How-it-Works#flow-chart

Slide 34

Slide 34 text

HystrixCommand run() public  class  CommandHelloWorld  extends  HystrixCommand  {        ...        protected  String  run()  {                return  "Hello  "  +  name  +  "!";        } } Basic successful execution pattern and sample code. Read more at https://github.com/Netflix/Hystrix/wiki/How-To-Use#wiki-Hello-World

Slide 35

Slide 35 text

public  class  CommandHelloWorld  extends  HystrixCommand  {        ...        protected  String  run()  {                return  "Hello  "  +  name  +  "!";        } } run() invokes “client” Logic HystrixCommand run() The run() method is where the wrapped logic goes.

Slide 36

Slide 36 text

HystrixCommand run() throw Exception Fail Fast Failing fast is the default behavior if no fallback is implemented. Even without a fallback this is useful as it prevents resource saturation beyond the bulkhead so the rest of the application can continue functioning and enables rapid recovery once the underlying problem is resolved. Read more at https://github.com/Netflix/Hystrix/wiki/How-To-Use#fail-fast

Slide 37

Slide 37 text

HystrixCommand run() getFallback() return  null; return  new  Option(); return  Collections.emptyList(); return  Collections.emptyMap(); Fail Silent Silent failure is an approach for removing non-essential functionality from the user experience by returning a value that equates to “no data”, “not available” or “don’t display”. Read more at https://github.com/ Netflix/Hystrix/wiki/How-To-Use#fail-silent

Slide 38

Slide 38 text

HystrixCommand run() getFallback() return  true; return  DEFAULT_OBJECT; Static Fallback Static fallbacks can be used when default data or behavior can be returned to the user. Read more at https://github.com/Netflix/Hystrix/wiki/How-To-Use#fallback-static

Slide 39

Slide 39 text

HystrixCommand run() getFallback() return  new  UserAccount(customerId,  "Unknown  Name",                                countryCodeFromGeoLookup,  true,  true,  false); return  new  VideoBookmark(movieId,  0); Stubbed Fallback Stubbed fallbacks are an extension of static fallbacks when some data is available (such as from request arguments, authentication tokens or other functioning system calls) and combined with default values for data that can not be retrieved. Read more at https://github.com/Netflix/Hystrix/wiki/How-To-Use#fallback-stubbed

Slide 40

Slide 40 text

HystrixCommand run() getFallback() Stubbed Fallback public  class  CommandHelloWorld  extends  HystrixCommand  {        ...        protected  String  run()  {                return  "Hello  "  +  name  +  "!";        }        protected  String  getFallback()  {                return  "Hello  Failure  "  +  name  +  "!";        } }

Slide 41

Slide 41 text

HystrixCommand run() getFallback() Stubbed Fallback public  class  CommandHelloWorld  extends  HystrixCommand  {        ...        protected  String  run()  {                return  "Hello  "  +  name  +  "!";        }        protected  String  getFallback()  {                return  "Hello  Failure  "  +  name  +  "!";        } } The getFallback() method is executed whenever failure occurs (after run() invocation or on rejection without run() ever being invoked) to provide opportunity to do fallback.

Slide 42

Slide 42 text

HystrixCommand run() getFallback() HystrixCommand run() Fallback via network Fallback via network is a common approach for falling back to a stale cache (such as a memcache server) or less personalized value when not able to fetch from the primary source. Read more at https://github.com/ Netflix/Hystrix/wiki/How-To-Use#fallback-cache-via-network

Slide 43

Slide 43 text

HystrixCommand run() getFallback() HystrixCommand run() getFallback() Fallback via network then Local When the fallback performs a network call it’s preferable for it to also have a fallback that does not go over the network otherwise if both primary and secondary systems fail it will fail by throwing an exception (similar to fail fast except after two fallback attempts).

Slide 44

Slide 44 text

So now what? Code is only part of the solution. Operations is the other critical half.

Slide 45

Slide 45 text

Historical metrics representing all possible states of success, failure, decision making and performance related to each bulk head.

Slide 46

Slide 46 text

>40,000 success 1 timeout 4 rejected Looking closely at high volume systems it is common to find constant failure.

Slide 47

Slide 47 text

The rejection spikes on the left correlate with and do in fact represent the cause of the fallback spikes on the right.

Slide 48

Slide 48 text

Latency percentiles are captured at every 5th percentile and a few extra such as 99.5th (though this graph is only showing 50th/99th/99.5th).

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

>40,000 success 0.10 exceptions Exceptions Thrown helps to identify if a failure state is being handled by a fallback successfully or not. In this case we are seeing < 0.1 exceptions per second being thrown but on the previous set of metrics saw 5-40 fallbacks occurring each second, thus we can see that the fallbacks are doing their job but we may want to look for very small number of edge cases where fallbacks fail resulting in an exception.

Slide 51

Slide 51 text

We found that historical metrics with 1 datapoint per minute and 1-2 minutes latency were not sufficient during operational events such as deployments, rollbacks, production alerts and configuration changes so we built near realtime monitoring and data visualizations to help us consume large amounts of data easily. This dashboard is the aggregate view of a production cluster with ~1-2 second latency from the time an event occurs to being rendered in the browser. Read more at https://github.com/Netflix/Hystrix/wiki/Dashboard

Slide 52

Slide 52 text

Each bulkhead is represented with a visualization like this.

Slide 53

Slide 53 text

circle color and size represent health and traffic volume

Slide 54

Slide 54 text

2 minutes of request rate to show relative changes in traffic circle color and size represent health and traffic volume

Slide 55

Slide 55 text

2 minutes of request rate to show relative changes in traffic circle color and size represent health and traffic volume hosts reporting from cluster

Slide 56

Slide 56 text

last minute latency percentiles 2 minutes of request rate to show relative changes in traffic circle color and size represent health and traffic volume hosts reporting from cluster

Slide 57

Slide 57 text

last minute latency percentiles 2 minutes of request rate to show relative changes in traffic circle color and size represent health and traffic volume hosts reporting from cluster Circuit-breaker status

Slide 58

Slide 58 text

last minute latency percentiles Request rate 2 minutes of request rate to show relative changes in traffic circle color and size represent health and traffic volume hosts reporting from cluster Circuit-breaker status

Slide 59

Slide 59 text

Error percentage of last 10 seconds last minute latency percentiles Request rate 2 minutes of request rate to show relative changes in traffic circle color and size represent health and traffic volume hosts reporting from cluster Error percentage of last 10 seconds Circuit-breaker status

Slide 60

Slide 60 text

last minute latency percentiles Request rate 2 minutes of request rate to show relative changes in traffic circle color and size represent health and traffic volume hosts reporting from cluster Error percentage of last 10 seconds Circuit-breaker status Rolling 10 second counters with 1 second granularity Failures/Exceptions Thread-pool Rejections Thread timeouts Successes Short-circuited (rejected)

Slide 61

Slide 61 text

23 5 2 0 47 8 1 0 26 4 0 0 48 9 4 0 38 4 2 0 42 6 7 0 59 11 5 1 46 5 2 0 39 3 5 0 12 1 0 0 Success Timeout Failure Rejection 10 1-second "buckets" 23 5 2 0 47 8 1 0 26 4 0 0 48 9 4 0 38 4 2 0 42 6 7 0 59 11 5 1 46 5 2 0 39 3 5 0 45 6 2 0 1 0 0 0 On "getLatestBucket" if the 1-second window is passed a new bucket is created, the rest slid over and the oldest one dropped. Low Latency Granular Metrics Rolling 10 second window 1 second resolution All metrics are captured in both absolute cumulative counters and rolling windows with 1 second granularity. Read more at https://github.com/Netflix/Hystrix/wiki/Metrics-and-Monitoring

Slide 62

Slide 62 text

23 5 2 0 47 8 1 0 26 4 0 0 48 9 4 0 38 4 2 0 42 6 7 0 59 11 5 1 46 5 2 0 39 3 5 0 12 1 0 0 Success Timeout Failure Rejection 10 1-second "buckets" 23 5 2 0 47 8 1 0 26 4 0 0 48 9 4 0 38 4 2 0 42 6 7 0 59 11 5 1 46 5 2 0 39 3 5 0 45 6 2 0 1 0 0 0 On "getLatestBucket" if the 1-second window is passed a new bucket is created, the rest slid over and the oldest one dropped. Low Latency Granular Metrics Rolling 10 second window 1 second resolution The rolling counters default to 10 second windows with 1 second buckets.

Slide 63

Slide 63 text

23 5 2 0 47 8 1 0 26 4 0 0 48 9 4 0 38 4 2 0 42 6 7 0 59 11 5 1 46 5 2 0 39 3 5 0 12 1 0 0 Success Timeout Failure Rejection 10 1-second "buckets" 23 5 2 0 47 8 1 0 26 4 0 0 48 9 4 0 38 4 2 0 42 6 7 0 59 11 5 1 46 5 2 0 39 3 5 0 45 6 2 0 1 0 0 0 On "getLatestBucket" if the 1-second window is passed a new bucket is created, the rest slid over and the oldest one dropped. Low Latency Granular Metrics Rolling 10 second window 1 second resolution As each second passes the oldest bucket is dropped (to soon be overwritten since it is a ring buffer)...

Slide 64

Slide 64 text

23 5 2 0 47 8 1 0 26 4 0 0 48 9 4 0 38 4 2 0 42 6 7 0 59 11 5 1 46 5 2 0 39 3 5 0 12 1 0 0 Success Timeout Failure Rejection 10 1-second "buckets" 23 5 2 0 47 8 1 0 26 4 0 0 48 9 4 0 38 4 2 0 42 6 7 0 59 11 5 1 46 5 2 0 39 3 5 0 45 6 2 0 1 0 0 0 On "getLatestBucket" if the 1-second window is passed a new bucket is created, the rest slid over and the oldest one dropped. Low Latency Granular Metrics Rolling 10 second window 1 second resolution ... and a new bucket is created.

Slide 65

Slide 65 text

~1 second latency aggregated stream Turbine stream aggregator Low Latency Granular Metrics Metrics are subscribed to from all servers in a cluster and aggregated with ~1 second latency from event to aggregation. This stream can then be consumed by the dashboard, an alerting system or anything else wanting low latency metrics.

Slide 66

Slide 66 text

propagate across cluster in seconds Low Latency Configuration Changes The low latency loop is completed with the ability to propagate configuration changes across a cluster in seconds. This enables rapid iterations of seeing behavior in production, pushing config changes and then watching them take effect immediately as the changes roll across a cluster of servers. Low latency operations requires both the visibility into metrics and ability to affect change operating with similar latency windows.

Slide 67

Slide 67 text

Auditing via Simulation Simulating failure states in production has proven an effective approach for auditing our applications to either prove resilience or find weakness.

Slide 68

Slide 68 text

Auditing via Simulation In this example failure was injected into a single dependency which caused the bulkhead to return fallbacks and trip all circuits since the failure rate was almost 100%, well above the threshold for circuits to trip.

Slide 69

Slide 69 text

Auditing via Simulation When the ‘TitleStatesGetAllRentStates` bulkhead began returning fallbacks the ‘atv_mdp’ endpoint shot to the top of the dashboard with 99% error rate. There was a bug in how the fallback was handled so we immediately stopped the simulation, fixed the bug over the coming days and repeated the simulation to prove it was fixed and the rest of the system remained resilient. This was caught in a controlled simulation where we could catch and act in less than a minute rather than a true production incident where we likely wouldn’t have been able to do anything.

Slide 70

Slide 70 text

This shows another simulation where latency was injected. Read more at http://techblog.netflix.com/2011/07/netflix-simian-army.html

Slide 71

Slide 71 text

125 -> 1500+ 1000+ ms of latency was injected into a dependency that normally completes with a median latency of ~15-20ms and 99.5th of 120-130ms.

Slide 72

Slide 72 text

~5000 The latency spike caused timeouts, short-circuiting and rejecting and up to ~5000 fallbacks per second as a result of these various failure states.

Slide 73

Slide 73 text

~1 While delivering the ~5000 fallbacks per second the exceptions thrown didn’t go beyond ~1 per second demonstrating that user impact was negligible (as perceived from the server, the client behavior must also be validated during a simulation but is not part of this dataset).

Slide 74

Slide 74 text

Zuul Routing Layer Canary vs Baseline Squeeze Production "Coalmine" Other approaches to auditing take advantage of our routing layer to route traffic to different clusters. Read more at http://techblog.netflix.com/2013/06/announcing-zuul-edge-service-in-cloud.html

Slide 75

Slide 75 text

Zuul Routing Layer Canary vs Baseline Squeeze Production "Coalmine" Every code deployment is preceded by a canary test where a small number of instances are launched to take production traffic, half with new code (canary), half with existing production code (baseline) and compared for differences. Thousands of system, application and bulkhead metrics are compared to make a decision on whether the new code should continue to full deployment. Many issues are found via production canaries that are not found in dev and test environments.

Slide 76

Slide 76 text

Zuul Routing Layer Canary vs Baseline Squeeze Production "Coalmine" New instances are also put through a squeeze test before full rollout to find the point at which the performance degrades. This is used to identify performance and throughput changes of each deployment.

Slide 77

Slide 77 text

Zuul Routing Layer Canary vs Baseline Squeeze Production "Coalmine" Long-term canaries are kept in a cluster we call “coalmine” with agents intercepting all network traffic. These run the same code as the production cluster and are used to identify network traffic without a bulkhead that starts happening due to unknown code paths being enabled via configuration, AB test and other changes. Read more at https://github.com/Netflix/Hystrix/tree/master/hystrix-contrib/hystrix-network- auditor-agent

Slide 78

Slide 78 text

User Request Dependency A Dependency D Dependency G Dependency J Dependency M Dependency P Dependency B Dependency E Dependency H Dependency K Dependency N Dependency Q Dependency C Dependency F Dependency I Dependency L Dependency O Dependency R System Relationship Over Network without Bulkhead For example, a network relationship could exist in production code but not be triggered in dev, test or production canaries but then be enabled via a condition that changes days after deployment to production. This can be a vulnerability and we use the “coalmine” to identity these situations and inform decisions.

Slide 79

Slide 79 text

Zuul Routing Layer Canary vs Baseline Squeeze Production "Coalmine"

Slide 80

Slide 80 text

Failure inevitably happens ...

Slide 81

Slide 81 text

Cluster adapts Failure Isolated When the backing system for the ‘SocialGetTitleContext’ bulkhead became latent the impact was contained and fallbacks returned.

Slide 82

Slide 82 text

Cluster adapts Failure Isolated When the backing system for the ‘SocialGetTitleContext’ bulkhead became latent the impact was contained and fallbacks returned.

Slide 83

Slide 83 text

Cluster adapts Failure Isolated Since the failure rate was above the threshold circuit breakers began tripping. As a portion of the cluster tripped circuits it released pressure on the underlying system so it could successfully perform some work.

Slide 84

Slide 84 text

Cluster adapts Failure Isolated The cluster naturally adapts as bulkheads constrain throughput and circuits open and close in a rolling manner across the instances in the cluster.

Slide 85

Slide 85 text

In this example the ‘CinematchGetPredictions’ functionality began failing.

Slide 86

Slide 86 text

The red metric shows it was exceptions thrown by the client, not latency or concurrency constraints.

Slide 87

Slide 87 text

The 20% error rate from the realtime visualization is also seen in the historical metrics with accompanying drop in successes.

Slide 88

Slide 88 text

Matching the increase in failures is the increase of fallbacks being delivered for every failure.

Slide 89

Slide 89 text

Distributed Systems are Complex Distributed applications need to be treated as complex systems and we must recognize that no machine or human can comprehend all of the state or interactions.

Slide 90

Slide 90 text

Isolate Relationships One way to dealing with the complex system is to isolate the relationships so they can each fail independently of each other. Bulkheads have proven an effective approach for isolating and managing failure.

Slide 91

Slide 91 text

Auditing & Operations are Essential Resilient code is only part of the solution. Systems drift and have latent bugs and failure states emerge from the complex interactions of the many relationships. Constant auditing can be part of the solution. Human operations must handle everything the system can’t which by definition means it is unknown so the system must strive to expose clear insights and effective tooling so humans can make informed decisions.

Slide 92

Slide 92 text

Hystrix https://github.com/Netflix/Hystrix Application Resilience in a Service-oriented Architecture http://programming.oreilly.com/2013/06/application-resilience-in-a-service-oriented-architecture.html Fault Tolerance in a High Volume, Distributed System http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html Making the Netflix API More Resilient http://techblog.netflix.com/2011/12/making-netflix-api-more-resilient.html Ben Christensen @benjchristensen http://www.linkedin.com/in/benjchristensen jobs.netflix.com