Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Living on the Edge with Spring Cloud Gateway

Ryan Baxter
September 26, 2018

Living on the Edge with Spring Cloud Gateway

Ryan Baxter

September 26, 2018
Tweet

More Decks by Ryan Baxter

Other Decks in Technology

Transcript

  1. Living on the Edge with Spring Cloud Gateway By Ryan

    Baxter @ryanjbaxter By Cora Iberkleid @ciberkleid
  2. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Gateway Basics
  3. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ What Is An API Gateway? Server Side MVC App Microservice A JS or Mobile App Microservice B Microservice C
  4. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ What Is An API Gateway? Server Side MVC App Microservice A JS or Mobile App Microservice B Microservice C Gateway
  5. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Gateway Responsibilities • Routing • Security • Monitoring • Canarying • Monolith Strangling • Resiliency
  6. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Cloud Gateway Basics
  7. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring Cloud Gateway Foundations
  8. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive Gateway
  9. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Gateway Flow Client Predicates Pre-Filters Global Filters Post-Filters Downstream Service Gateway Handler Mapping Web Handler
  10. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Gateway Gateway Flow Client Predicates Pre-Filters Global Filters Post-Filters Downstream Service Handler Mapping Web Handler Predicates • Path • Host • Date/Time • Method • Headers • Query Params • Cookies • Read Body • Anything….
  11. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Gateway Gateway Flow Client Predicates Pre-Filters Global Filters Post-Filters Downstream Service Handler Mapping Web Handler Pre-Filters • Headers • Path • Rate Limiting • Cookies • Hystrix • Modify Body • Anything
  12. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Gateway Gateway Flow Client Predicates Pre-Filters Global Filters Post-Filters Downstream Service Handler Mapping Web Handler Global Filters • Netty Router • Web Sockets • Load Balancer • Metrics
  13. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Gateway Gateway Flow Client Predicates Pre-Filters Global Filters Post-Filters Downstream Service Handler Mapping Web Handler Post Filters • Set status • Headers • Cookies • Anything...
  14. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Design Decisions
  15. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ App Embedded Gate way Sample Use Case • When latency is essential - no added network hops
  16. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Embedded App Sample Use Case • Fine-grained access control for pay-per-use service or fragile backing service App Gate way App Gate way App Gate way App
  17. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Facade Gateway App Client Sample Use Cases • Prevent direct access to apps • Polyglot compatible
  18. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Facade Gateway App B Client Sample Use Cases • Cross-cutting concerns • Present common API to clients • Shield clients from app refactoring (monolith → microservices) App C App A
  19. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Cross-Cutting + App-Specific App-Specific Gateway App B Client Sample Use Cases • Delegate cross-cutting concerns to a separate common gateway (and a separate dev team!) App C App A App-Specific Gateway App E App F App D Common Gateway
  20. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Demo Part I: Spring Cloud Gateway Photo Credit: Aerosmith, Living On The Edge
  21. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Demo Architecture Gateway Blue Service Green Service Frontend App Client Service Discovery (Eureka)
  22. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Demo Architecture Gateway Blue Service Green Service Frontend App Client Service Discovery (Eureka) Yellow Service
  23. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Demo Part II: Gateway On Cloud Foundry
  24. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ User Stories - Subscription SLA Management • As a consumer, I want features in accordance with my subscription. • As a developer, I want to focus on my app. • As a product owner, I want to ensure a consistent and unified consumer experience. • As an operator, I want the the solution to be resilient and scalable.
  25. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ configs: - name: trial replenishRate: 2 burstCapacity: 2 - name: basic replenishRate: 10 burstCapacity: 15 - name: premium replenishRate: 50 burstCapacity: 100 Consumers… need subscriptions Trial Basic Premium
  26. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Developers want… Aut t a n Aut za Rat i n Req En i h t Req For d …as a service
  27. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Product Owners want… consistency Open Service Broker API Instances Bindings Catalog
  28. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Operators want… resilience and scalability 2 8  Rate Limiters (Redis) Service Instance Info (MongoDB) Service Broker + Gateway
  29. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ To the demo...
  30. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Thank You Scott Frederick Spencer Gibb Madhav Sathe Rob Winch
  31. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Feedback Please!
  32. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Q&A Spring Cloud Gateway: https://github.com/spring-cloud/spring-cloud-gateway Session Code: https://github.com/ryanjbaxter/gateway-s1p-2018 Slides: https://speakerdeck.com/ryanjbaxter
  33. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Cross-Cutting + App-Specific App-Specific Gateway App B Client App C App A App-Specific Gateway App E App F App D Common Gateway Service Broker (OSBAPI) Cloud Foundry Service Instance Info Rate Limiters Sessions