quick poll welcome to sunny london tammer saleh
play

Quick poll Welcome to sunny London! Tammer Saleh Geek: Unix, Ruby, - PowerPoint PPT Presentation

Quick poll Welcome to sunny London! Tammer Saleh Geek: Unix, Ruby, Golang , etc Cloud Foundry @ Pivotal http://tammersaleh.com | tsaleh@pivotal.io Microservice Anti-patterns How not to go down in flames. Why microservices? What is a


  1. Quick poll…

  2. Welcome to sunny London!

  3. Tammer Saleh Geek: Unix, Ruby, Golang , etc Cloud Foundry @ Pivotal http://tammersaleh.com | tsaleh@pivotal.io

  4. Microservice Anti-patterns How not to go down in flames.

  5. Why microservices? What is a microservice , and why do I care ?

  6. Monolithic Entire application in a single codebase , deployed and scaled as a single unit .

  7. Monolithic Hard to scale the application . Impossible to scale the team .

  8. It’s not about code… It’s about teams.

  9. But it can go wrong. Here are the most common problems we see in the wild, and how to fix them .

  10. Overzealous Services The most common mistake is to start with microservices

  11. Boring is Beautiful ™

  12. Solution: Start monolithic and extract Microservices are complex and add a constant tax to development . Build a boring application and extract services as needed.

  13. Twitter Heavy and Expensive /tweet /dashboard /… /…

  14. Twitter Lite and Cheap /tweet /dashboard /… /…

  15. Congratulations You’re now a microservice architect.

  16. Schemas everywhere /tweet v1 V1 Schema /dashboard v1 /… /… Deploy v2

  17. Schemas everywhere /tweet v1 V1 Schema /dashboard v2 /… /… Migrate v2 Deploy v2

  18. Schemas everywhere Deploy v2 /tweet v1 V2 Schema /dashboard v2 /… /… Migrate v2

  19. Schemas everywhere /tweet v2 V2 Schema /dashboard v2 /… /…

  20. Solution: Gatekeeper /tweet v1 Tweet Service /bulk_add Tweets GET /tweets /dashboard GET /tweets/ID v2 /… /… Owns database and migrations

  21. Lock-step deployment v1 Service A Service C — v1 v1 Service B

  22. Lock-step deployment v1 Service A Service C — v2 v1 Service B Deploy v2

  23. Lock-step deployment v1 Service A Service C — v2 v1 Service B Deploy v2

  24. Lock-step deployment v2 Service A Service C — v2 v2 Service B Deploy v2

  25. Solution: Semantic Versioning v1 Service A Service C — v1 v1 Service B vMajor.Minor.Patch MYBAD.SHINY.OOPS

  26. Solution: Semantic Versioning v1 :) Service A Service C — v1.2 :) v1 Service B Deploy v1.2 (extra stuff)

  27. Solution: Semantic Versioning v1.2 Service A Service C — v1.2 v1.2 Service B Deploy v1.2

  28. Solution: Semantic Versioning v1.2 Service A Service C — v1.2 v1.2 Service B Service C — v2 Deploy v2 (breaking change)

  29. Solution: Semantic Versioning v1.2 Service A Service C — v1.2 Service B Service C — v2 v2 Deploy v2

  30. Solution: Semantic Versioning v2 Service A Service C — v1.2 Deploy v2 Service B Service C — v2 v2

  31. OMG ALL THE STEPS!!! See Rule #1

  32. Spiky load between services Must maintain enough servers to handle peak load.

  33. Spiky load between services /tweet /dashboard /… /…

  34. Spiky load between services /tweet /dashboard /… /…

  35. Solution: Amortize via queues Peak load is now much lower. Queues in between services provide buffers that smooth traffic .

  36. Solution: Amortize via queues /tweet /dashboard /… /…

  37. Solution: Amortize via queues /tweet Worker /dashboard /… /… Complexity : Now clients must deal with asynchronous responses.

  38. Hardcoded IPs and Ports Simple to get started, but immediately leads to deployment issues.

  39. Solution 1: Discovery Service consul etcd

  40. Solution 1: Discovery Service Where is B? Service A 192.168.0.2:1234 Service B (192.168.0.2:1234)

  41. Solution 1: Discovery Service Service A Hey there! Service B (192.168.0.2:1234)

  42. Solution 1: Discovery Service Complexity : Your code must understand the service lookup system.

  43. Solution 2: Centralised router Router A A A B B A B B A B A B Service B Service B Service B Service A Service A Service A

  44. Solution 2: Centralised router Simplicity : “It’s just DNS.”

  45. Router vs Discovery Service Both require service registration. Both require HA and scalability . Router is transparent . Discovery Service is simpler to build and scale , since it doesn’t need to Router can be exposed externally . route all data. Router can cache transparently. Discovery service does fewer network hops . Router can round-robin .

  46. Dogpiles You there? No. How about now? I’m busy. But I wanna chat! Service A Service B Go away Whachya doin? Please leave me alone. Wanna be friends? I hate you.

  47. Dogpiles x 100 Service A Service A Service B Service A Service A

  48. Solution: Circuit Breaker Hey, B’s sick :( Where’s B? Hello! Service A Service A B’s sick. Wait 10 min. Go to Hell! Service B

  49. Debugging hell Turns out, distributed systems are hard.

  50. Debugging Hell Service 1 Service 2 time:1428374783 source:service3 msg:” Error with payment! ” Service 3 Where?? Why?? Who??

  51. Solution: Correlation IDs Service Service CID: 1234 CID: 1234 CID: 1234 time:1427127483 source:service1 id:1234 msg:”Received request…” time:1427348748 source:service2 id:1234 msg:”Processing payment" time:1428374783 source:service3 id:1234 msg:” Error with payment! ” Service

  52. Solution: Correlation IDs 1. Tag all incoming requests with unique ID ID 2. Service saves ID for all incoming requests ID ID 3. Include that ID in all log lines, Logs Service etc. 4. Tag new requests with that ID ID Complexity : Must be done manually.

  53. Missing Mock Servers Each consuming team has to create their own mocks and stubs.

  54. Missing Mock Servers Team A Service A

  55. Missing Mock Servers Team A Team B Product Surface Area HTTP Service A Service B

  56. Missing Mock Servers Team A Team B HTTP Service A Service B HTTP Mock of Service A For each service… For each team…

  57. Solution: Service Team Provides the Mock Better… Team A Team B HTTP Service A Service B HTTP Team B still needs to know Mock of Service A how to run Mock Service A

  58. Solution: Service Team Owns the Client Best… Team A Team B Product Surface Area HTTP Service B Client A Service A P T T H T eam A can change MOCK=“true” Mock of Service A the protocol as they see fit Both modes are tested in CI

  59. Flying Blind

  60. Solution: Graphs, alerts, pages.

  61. Solution: Graphs, alerts, pages. Platform Events Alerting Rules Engine ? ? ? T A W G Apps M Apps O Apps Apps Apps Apps Apps Apps Apps Apps Apps

  62. Snowflakes

  63. Snowflakes BASH remote exploit! Ruby XSS exploit!

  64. Snowflakes Containers Virtual Machines

  65. Solution: Golden Image

  66. Solution: Golden Image Common Runtimes and Frameworks + = Golden OS Image Base Platform

  67. Doomsday Deployments

  68. Solution: Predictable Pipelines

  69. Solution: Predictable Pipelines http://concourse.ci

  70. Solution: Predictable Pipelines Need to trust your tests , your platform , and your automation .

  71. Operational Explosion!

  72. Operational Explosion! Operations block Development

  73. Solution: AUTOMATE ALL THE THINGS!!!!! Form a team to build tools that enable developers to manage the system in an entirely automated way .

  74. OMG ALLTHETHINGS???? App deployment, infrastructure provisioning, OS installation , configuration management, database provisioning, disaster recovery, application monitoring, HA, blue-green deployments, self-healing, scaling, runtime installation, log rotation, backups, security updates, database upgrades, application logs, system logs, database logs, continuous integration, continuous deployment , service discovery, monitor queue usage, security monitoring, hotspot detection, error monitoring, issue notification and escalation, virtual machine migration, shard rebalancing, circuit breaker monitoring, resiliency testing, database snapshots, flux capacitors , ion overdrive maintenance, change the oil, dog feeding, cat shooting, pig eating …

  75. Solution: AUTOMATE ALL THE THINGS!!!!! Time and Money

  76. In summary… Start boring and extract to services. Enable other teams through mockable clients. Understand the hidden schemas . Kill your snowflakes . Amortize traffic with queues . Automate your deployments . Decouple through discovery tools . Build in operations tools from the beginning. Contain failures with circuit breakers . Make use of a platform like Cloud Foundry.

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend