Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Circuit breaker mechanism for
Microservices based architecture
Kunal Grover
Circuit Breaker
Understanding Microservices: Example Bookstore
Understanding Microservices: Example Bookstore
Designing Microservices
!! DESIGN FOR FAILURES !!
Designing Microservices
!! DESIGN FOR FAILURES !!
(A 20-minute outage at Amazon would cause the company $3.75 million appr...
Designing Microservices
!! DESIGN FOR FAILURES !!
- Don’t fail if your microservice goes down
- Application should not for...
Designing Microservices
!! DESIGN FOR FAILURES !!
- Don’t fail if your microservice goes down
- Application should not for...
Designing Microservices
!! DESIGN FOR FAILURES !!
- Don’t fail if your microservice goes down
- Application should not for...
Designing Microservices
!! DESIGN FOR FAILURES !!
- Don’t fail if your microservice goes down
- Application should not for...
Typical multi-threaded webapp
Our Application and Users service
• Service latency(avg) =>100ms
• Timeout =>1s
• RPS =>100
• Application threads =>100
Issues with the architectureOur Application
• Service latency(avg) =>100ms
• Timeout =>1s
• RPS =>100
• Application thread...
Did we design for failures?
- Don’t fail if your microservice goes down
- Application should not forever wait for microser...
Circuit breaker
mechanism
Implementation detail
Threads =>
100(RPS) X 0.1(Latency) = 10
Case: Users service is down.
- How many requests get affected?
- How fast do we re...
Did we design for failures?
- Don’t fail if your microservice goes down
- Application should not forever wait for microser...
Testing and monitoring!
• IPTables FTW!
Drop connections from IP address: iptables -A INPUT -d 202.54.1.22 -j DROP
Drop co...
Testing and monitoring!
• IPTables FTW!
Drop connections from IP address: iptables -A INPUT -d 202.54.1.22 -j DROP
Drop co...
Thank you
• Twitter: @kunalgrover05
• Email: kunalgrover05@gmail.com
• Slides: https://tinyurl.com/RootconfKunal
• Acknowl...
Pop Quiz
You have 20 microservices in your single endpoint
application. You monitor P99 latency numbers for each
microserv...
Pop Quiz
Pop Quiz
You have 20 microservices in your single endpoint
application. You monitor P99 latency numbers for each
microserv...
Pop Quiz
You have 20 microservices in your single endpoint
application. You monitor P99 latency numbers for each
microserv...
Upcoming SlideShare
Loading in …5
×

Circuit breaker mechanism for Microservices based architecture

314 views

Published on

Fault tolerance by design becomes a requirement for companies heavily dependent on their internet presence for their business. In the talk, I would talk about some principles for Cloud application design. I would dive into the world of microservices, and with a real world example, demonstrate a Circuit breaker mechanism providing fault tolerance.

Published in: Software
  • Be the first to comment

Circuit breaker mechanism for Microservices based architecture

  1. 1. Circuit breaker mechanism for Microservices based architecture Kunal Grover
  2. 2. Circuit Breaker
  3. 3. Understanding Microservices: Example Bookstore
  4. 4. Understanding Microservices: Example Bookstore
  5. 5. Designing Microservices !! DESIGN FOR FAILURES !!
  6. 6. Designing Microservices !! DESIGN FOR FAILURES !! (A 20-minute outage at Amazon would cause the company $3.75 million approx.)
  7. 7. Designing Microservices !! DESIGN FOR FAILURES !! - Don’t fail if your microservice goes down - Application should not forever wait for microservice
  8. 8. Designing Microservices !! DESIGN FOR FAILURES !! - Don’t fail if your microservice goes down - Application should not forever wait for microservice - Contain and Isolate failures
  9. 9. Designing Microservices !! DESIGN FOR FAILURES !! - Don’t fail if your microservice goes down - Application should not forever wait for microservice - Contain and Isolate failures - Respect the service when it is slow
  10. 10. Designing Microservices !! DESIGN FOR FAILURES !! - Don’t fail if your microservice goes down - Application should not forever wait for microservice - Contain and Isolate failures - Respect the service when it is slow - Fail fast - Recover fast
  11. 11. Typical multi-threaded webapp
  12. 12. Our Application and Users service • Service latency(avg) =>100ms • Timeout =>1s • RPS =>100 • Application threads =>100
  13. 13. Issues with the architectureOur Application • Service latency(avg) =>100ms • Timeout =>1s • RPS =>100 • Application threads =>100 Users service goes down • Average latency? • Requests received by dependent service? • RPS served?
  14. 14. Did we design for failures? - Don’t fail if your microservice goes down - Application should not forever wait for microservice - Contain and Isolate failures - Respect the service when it is slow - Fail fast - Recover fast
  15. 15. Circuit breaker mechanism
  16. 16. Implementation detail
  17. 17. Threads => 100(RPS) X 0.1(Latency) = 10 Case: Users service is down. - How many requests get affected? - How fast do we recover?
  18. 18. Did we design for failures? - Don’t fail if your microservice goes down - Application should not forever wait for microservice - Contain and Isolate failures - Respect the service when it is slow - Fail fast - Recover fast
  19. 19. Testing and monitoring! • IPTables FTW! Drop connections from IP address: iptables -A INPUT -d 202.54.1.22 -j DROP Drop connections from port: iptables -A INPUT-p tcp --dport 1080 -j DROP
  20. 20. Testing and monitoring! • IPTables FTW! Drop connections from IP address: iptables -A INPUT -d 202.54.1.22 -j DROP Drop connections from port: iptables -A INPUT-p tcp --dport 1080 -j DROP • Percentage of rejections happened?
  21. 21. Thank you • Twitter: @kunalgrover05 • Email: kunalgrover05@gmail.com • Slides: https://tinyurl.com/RootconfKunal • Acknowledgements: Alex Koturanov (@alex_koturanov)
  22. 22. Pop Quiz You have 20 microservices in your single endpoint application. You monitor P99 latency numbers for each microservice.
  23. 23. Pop Quiz
  24. 24. Pop Quiz You have 20 microservices in your single endpoint application. You monitor P99 latency numbers for each microservice. What are you monitoring effectively?
  25. 25. Pop Quiz You have 20 microservices in your single endpoint application. You monitor P99 latency numbers for each microservice. What are you monitoring effectively? (0.99)20 = 0.81 Neglected 19% of your customers

×