Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Hysterie in verteilten Systemen - Hystrix im Ei...
Search
Benjamin Wilms
March 29, 2017
Programming
360
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Hysterie in verteilten Systemen - Hystrix im Einsatz
Benjamin Wilms
March 29, 2017
More Decks by Benjamin Wilms
See All by Benjamin Wilms
Chaos Engineering @ Spring I/O 2019 Barcelona
mrbw
1
510
Chaos Engineering - W-JAX 2018
mrbw
0
320
Chaos Engineering - AWS Community Days 2018
mrbw
0
880
Chaos Engineering @ JUG Bonn
mrbw
0
180
Chaos Engineering @ Microservices Meetup Berlin
mrbw
0
150
Spring Cloud Netf
mrbw
1
210
Resilience mit Hystrix: Fehlertoleranz statt Hochverfügbarkeit
mrbw
0
250
Hystrix @ Vaadin Meetup Düsseldorf
mrbw
0
96
Hystrix Warstories
mrbw
0
59
Other Decks in Programming
See All in Programming
<title><a id="</title>君はこのHTMLをパースできるか"></a></title> #雑LT_study
pizzacat83
0
140
琵琶湖の水は止められてもNet--HTTPのリトライは止められない / You might be able to stop the water flow of Lake Biwa but you can't stop Net::HTTP retries
luccafort
PRO
0
640
【やさしく解説 設計編・中級 #1】一つの車に、運転手は一人 ~ある倉庫システムの事例から~
panda728
PRO
0
210
Claude CodeとAgentCore Gatewayを繋ぐ際の認証認可 / Authentication and authorization when connecting Claude Code with AgentCore Gateway
har1101
2
260
Apache Hive: Toward a Cloud Native Lakehouse
okumin
0
180
Android CLI
fornewid
0
220
What's New in Android 2026
veronikapj
0
260
型も通る、synthも通る、それでも危ない 〜AIのCDKの権限とコストを機械で検証する〜 / It Passes Type Checks, It Passes Synth Checks, but It’s Still Risky — Automatically Verifying Permissions and Costs in AI’s CDK —
seike460
PRO
1
540
【やさしく解説 設計編・中級 #4】ルールの寿命と、システムの年輪
panda728
PRO
2
180
夏だ!祭りだ!祭りとはドメインモデリングでは?
ryugen04
0
220
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
550
複数の Claude Code が"放置"されてしまう問題をCLI ダッシュボードを自作して解決した話
sumihiro3
1
670
Featured
See All Featured
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.3k
Deep Space Network (abreviated)
tonyrice
0
250
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Leo the Paperboy
mayatellez
8
2.1k
What's in a price? How to price your products and services
michaelherold
247
13k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
230
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.9k
Are puppies a ranking factor?
jonoalderson
1
3.8k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Chasing Engaging Ingredients in Design
codingconduct
0
260
VelocityConf: Rendering Performance Case Studies
addyosmani
332
25k
Transcript
HYSTERIE IN VERTEILTEN SYSTEMEN Hystrix im Einsatz Benjamin Wilms codecentric
AG
Benjamin Wilms codecentric Twitter: @MrBWilms GitHub: github.com/MrBW
Agenda Resilience Timeout Bulkheads Circuit Breaker Simian Army Hystrix Fallback
Configuration Dynamic Configuration Chaos Monkey Archaius Metrics Stream Dashboard Turbine RabbitMQ Spring Boot Admin
None
Patterns of Resilience Timeout Bulkheads Circuit Breaker Steady State Fail
Fast Handshaking Test harness Decoupling middleware
Patterns of Resilience Timeout (Hystrix) Bulkheads (Hystrix) Circuit Breaker (Hystrix)
Steady State Fail Fast (Hystrix) Handshaking (Hystrix) Test harness Decoupling middleware
Hystrix Introduction Quelle: Netflix
Hystrix Introduction
Hystrix Introduction Quelle: Netflix
Semaphore vs. Threads Threads Timeout Handling Isolation vom Aufrufer Fallbacks
Circuit Breaker Semaphore keine Isolation vom Aufrufer Fallbacks Circuit Breaker (Counting)
Hystrix Overhead 10% > 3 ms Overhead 1% > 9
ms Overhead 10+ Millarden Requests Quelle: Netflix
TRANSPORT MY PACKAGE
Transport my Package - Architecture
Transport my Package - Flow
Transport my Package - Flow
Transport my Package - Flow
Transport my Package - Hystrix
Service Discovery Eureka
Service Discovery - Eureka System Status DS Replicas Instances currently
registered with Eureka Application AMIs Availability Zones Status ADDRESS-SERVICE n/a (2) (2) UP (2) - 2008f3e0f6fb:address-service (http://172.19.0.10:8080/info) , ad0992a451bc:address-service (http://172.19.0.13:8080/info) BOOKING-SERVICE n/a (2) (2) UP (2) - 181daeac41ee:booking-service (http://172.19.0.14:8080/info) , 1a19b053c2b3:booking-service (http://172.19.0.11:8080/info) CONNOTE-SERVICE n/a (2) (2) UP (2) - 8f95af38afa3:connote-service (http://172.19.0.15:8080/info) , 5d7d6317b504:connote-service (http://172.19.0.9:8080/info) CUSTOMER-SERVICE n/a (2) (2) UP (2) - 528b8d4c0960:customer-service (http://172.19.0.16:8080/info) , 5771c7be2118:customer-service (http://172.19.0.12:8080/info) HYSTRIX-TURBINE- DASHBOARD n/a (1) (1) UP (1) - a583a53203e9:hystrix-turbine-dashboard:8080 (http://172.19.0.7:8080/info) SPRING-BOOT-ADMIN n/a (1) (1) UP (1) - cf908142d5ff:spring-boot-admin (http://172.19.0.6:8080/info) Environment test Data center default Current time 2017-03-29T05:45:56 +0000 Uptime 00:06 Lease expiration enabled true Renews threshold 22 Renews (last min) 48 localhost (http://localhost:8761/eureka/)
Transport Service - Booking Request code/booking-create.js var request = require("request");
var moment = require('moment'); var startTime = moment(); // request var jsonRequest = { "customerId": 1, "sender-country": "de", "sender-city": "Solingen", "sender-postcode": "42697", "sender-street": "Hochstraße", "sender-streetnumber": "11", 1 2 3 4 5 6 7 8 9 10 11 12
Simian Army Quelle: Netflix
Simian Army - Chaos Monkey Quelle: Netflix
AOP - Chaos Monkey Nichts passiert! RuntimeException Timeout
Dynamische Konfiguration zur Laufzeit Hystrix & Archaius Flickr: Rod Waddingtons
Dynamische Konfiguration zur Laufzeit Archaius dynamic & typed thread safe
polling framework callback mechanism dynamic configuration
Dynamische Konfiguration zur Laufzeit Quellen AWS Dynamo DB Apache ZooKeeper
CoreOS etcd Classpath Resourcen File URI´s
Dynamische Konfiguration zur Laufzeit CoreOS etcd Distributed key value store
REST API Cluster ready
Chaos Monkey aktivieren code/archaius_demo/step_1.js var request = require("request"); var baseUrl
= "http://0.0.0.0:2379/v2/keys/hystrix"; var data = {value: "true"}; request({ url: baseUrl + '/chaos.monkey.active', method: 'PUT', qs: data, }, function(error, response, body){ if(error) { console.log(error); } else { 1 2 3 4 5 6 7 8 9 10 11 12
Transport Service - Booking Request (Chaos) code/booking-create.js var request =
require("request"); var moment = require('moment'); var startTime = moment(); // request var jsonRequest = { "customerId": 1, "sender-country": "de", "sender-city": "Solingen", "sender-postcode": "42697", "sender-street": "Hochstraße", "sender-streetnumber": "11", 1 2 3 4 5 6 7 8 9 10 11 12
Mögliche Fallback Strategien? Caching Messaging Stubbed Fallback - static defaults
Scaling docker-compose scale booking-service=2 connote-service=2 customer-service=2 address-service=2
Service Discovery - Eureka System Status DS Replicas Instances currently
registered with Eureka Application AMIs Availability Zones Status ADDRESS-SERVICE n/a (2) (2) UP (2) - 2008f3e0f6fb:address-service (http://172.19.0.10:8080/info) , ad0992a451bc:address-service (http://172.19.0.13:8080/info) BOOKING-SERVICE n/a (2) (2) UP (2) - 181daeac41ee:booking-service (http://172.19.0.14:8080/info) , 1a19b053c2b3:booking-service (http://172.19.0.11:8080/info) CONNOTE-SERVICE n/a (2) (2) UP (2) - 8f95af38afa3:connote-service (http://172.19.0.15:8080/info) , 5d7d6317b504:connote-service (http://172.19.0.9:8080/info) CUSTOMER-SERVICE n/a (2) (2) UP (2) - 528b8d4c0960:customer-service (http://172.19.0.16:8080/info) , 5771c7be2118:customer-service (http://172.19.0.12:8080/info) HYSTRIX-TURBINE- DASHBOARD n/a (1) (1) UP (1) - a583a53203e9:hystrix-turbine-dashboard:8080 (http://172.19.0.7:8080/info) SPRING-BOOT-ADMIN n/a (1) (1) UP (1) - cf908142d5ff:spring-boot-admin (http://172.19.0.6:8080/info) Environment test Data center default Current time 2017-03-29T05:45:56 +0000 Uptime 00:06 Lease expiration enabled true Renews threshold 22 Renews (last min) 48 localhost (http://localhost:8761/eureka/)
Feature toggle - aktiviere "Second Service Call" code/enable_second_call.js var request
= require("request"); var baseUrl = "http://0.0.0.0:2379/v2/keys/hystrix"; var data = {value: "true"}; request({ url: baseUrl + '/second.service.call', method: 'PUT', qs: data, }, function(error, response, body){ if(error) { console.log(error); } else { 1 2 3 4 5 6 7 8 9 10 11 12
Transport Service - Booking Request (Second Service Call) code/booking-create.js var
request = require("request"); var moment = require('moment'); var startTime = moment(); // request var jsonRequest = { "customerId": 1, "sender-country": "de", "sender-city": "Solingen", "sender-postcode": "42697", "sender-street": "Hochstraße", "sender-streetnumber": "11", 1 2 3 4 5 6 7 8 9 10 11 12
Hystrix Command - Connote Timeout 1 Second
Hystrix Command - Connote Timeout 300 Milliseconds
Hystrix Command Timeout - Connote code/timeouts.js var request = require("request");
var baseUrl = "http://0.0.0.0:2379/v2/keys/hystrix"; request({ url: baseUrl + '/hystrix.command.ConnoteServiceClient.execution.isolation.thread.timeoutInMillisecon ds', method: 'PUT', qs: {value: "300"}, }, function(error, response, body){ console.log(response.statusCode, body); }); 1 2 3 4 5 6 7 8 9 10
Transport Service - Booking Request (Second Service Call) code/booking-create.js var
request = require("request"); var moment = require('moment'); var startTime = moment(); // request var jsonRequest = { "customerId": 1, "sender-country": "de", "sender-city": "Solingen", "sender-postcode": "42697", "sender-street": "Hochstraße", "sender-streetnumber": "11", 1 2 3 4 5 6 7 8 9 10 11 12
Hystrix Monitoring & Metriken via REST Endpoint via JMX via
Logfile via Elastic, Splunk und Co. via Messaging
REST Endpoint Zugriff via HystrixCommandMetrics: Result: HystrixCommandMetrics.getInstance(ConnoteRESTCommand.CONNOTE_KEY) { averageExecutionTime: 0,
commandGroupKey: "ConnoteRESTCommandGroupKey", commandKey: "ConnoteCommand", concurrentExecutionCount: 0, errorCount: 1, healthCounts: "HealthCounts[1 / 1 : 100%]", totalRequests: 1 }
Hystrix Dashboard Spring Boot Admin Spring Boot applications Filter
Application ▲ / URL Version Info Status ADDRESS-SERVICE 2 UP BOOKING-SERVICE 2 UP CONNOTE-SERVICE 2 UP CUSTOMER-SERVICE 2 UP HYSTRIX-TURBINE-DASHBOARD (63b55a23) http://172.19.0.7:8080 UP SPRING-BOOT-ADMIN (adddb55b) http://172.19.0.6:8080 UP TRANSPORT-API-GATEWAY (2ed68569) http://172.19.0.8:8080 UP ZIPKIN-SERVICE (260fe666) http://172.19.0.5:9411 UP Reference Guide (https://codecentric.github.io/spring-boot-admin/1.4.5) - Sources (https://github.com/codecentric/spring-boot-admin) - Code licensed under Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) Details Details Details Details APPLICATIONS JOURNAL ABOUT
Hystrix Metriken via RabbitMQ Metriken werden via RabbitMQ bereitgestellt Aggregation
via Turbine als Consumer Hystrix Dashboard verarbeitet den Turbine Stream
Hystrix Metriken via RabbitMQ
Transport Service - Booking Request Simulation code/booking-create-simulate.js var request =
require("request"); var moment = require('moment'); var startTime = moment(); // request var jsonRequest = { "customerId": 1, "sender-country": "de", "sender-city": "Solingen", "sender-postcode": "42697", "sender-street": "Hochstraße", "sender-streetnumber": "11", 1 2 3 4 5 6 7 8 9 10 11 12
Hystrix Dashboard & Turbine Stream Circuit Thread Pools Hystrix Stream:
http://localhost:8989/ Sort: Error then Volume | Alphabetical | Volume | Error | Mean | Median | 90 | 99 | 99.5 Success | Short-Circuited | Timeout | Rejected | Failure | Error % tran...ustomerServiceClient 50.0 % 2 0 3 5 0 Hosts 1 90th 1019ms Median 15ms 99th 2002ms Mean 516ms 99.5th 2002ms Host: 1.0/s Cluster: 1.0/s Circuit Closed tran...AddressServiceClient 25.0 % 3 0 1 12 0 Hosts 1 90th 1010ms Median 10ms 99th 2003ms Mean 290ms 99.5th 2003ms Host: 1.6/s Cluster: 1.6/s Circuit Closed tran...BookingServiceClient 0.0 % 0 0 0 4 0 Hosts 1 90th 320ms Median 17ms 99th 611ms Mean 139ms 99.5th 611ms Host: 0.5/s Cluster: 0.5/s Circuit Closed book...ConnoteServiceClient 41.5 % 3 0 0 4 0 Hosts 2 90th 350ms Median 9ms 99th 458ms Mean 100ms 99.5th 458ms Host: 0.4/s Cluster: 0.7/s Circuit Closed Sort: Alphabetical | Volume | AddressServiceClientGroup Active 3 Max Active 2 Queued 0 Executions 16 Pool Size 10 Queue Size 5 Host: 1.6/s Cluster: 1.6/s CustomerServiceClientGroup Active 1 Max Active 2 Queued 0 Executions 10 Pool Size 10 Queue Size 5 Host: 1.0/s Cluster: 1.0/s ConnoteServiceClientGroup Active 2 Max Active 4 Queued 0 Executions 7 Pool Size 20 Queue Size 2 Host: 0.7/s Cluster: 1.4/s BookingServiceClientGroup Active 0 Max Active 1 Queued 0 Executions 5 Pool Size 10 Queue Size 5 Host: 0.5/s Cluster: 0.5/s
Finished Vielen Dank für Eure Aufmerksamkeit! FEEDBACK & FRAGEN? GitHub:
Short URL: https://github.com/MrBW/resilient-transport- service https://goo.gl/cIqNoi