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
870
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
95
Hystrix Warstories
mrbw
0
59
Other Decks in Programming
See All in Programming
OS アップデート対応の取り組み方がもっと共有されてほしい
andpad
0
110
継続モナドとリアクティブプログラミング
yukikurage
3
590
型も通る、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
210
LaravelLive Japan の裏方のすべて — 第188回 PHP勉強会@東京 (2026-06-24)
suguruooki
2
150
なぜ型を書くのか? TSKaigi2026で改めて考える #tskaigi_smarthr
kajitack
0
360
エンジニアと一緒にテストコードの設計と実装を改善した話
mototakatsu
0
260
Laravelで学ぶ Webアプリケーションチューニング入門/web_application_tuning_101
hanhan1978
3
380
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
200
PHPだって関数型したい 〜できること、できないこと〜 / fp-in-php
jsoizo
0
210
Laravel Boostに学ぶ、AIにPHPを書かせる技術 〜OSSの実装から蒸留するエージェント制御の王道〜
kentaroutakeda
3
330
yield再入門 #phpcon
o0h
PRO
0
240
初めてのKubernetes 本番運用でハマった話
oku053
0
120
Featured
See All Featured
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
630
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
550
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.2k
Marketing to machines
jonoalderson
1
5.6k
Being A Developer After 40
akosma
91
590k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
320
So, you think you're a good person
axbom
PRO
2
2.1k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.6k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
220
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