Share
Embed
Living on the Edge with Spring Cloud Gateway
Ryan Baxter
September 26, 2018
Annual Pro sale · Save $30
Have presentations of your own?
Share with private links, password protection, and more control over your work.
Transcript
34 slides
-
Living on the Edge with Spring Cloud Gateway By Ryan
Baxter @ryanjbaxter By Cora Iberkleid @ciberkleid -
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 -
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 -
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 -
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 -
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 -
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 -
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 -
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 -
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…. -
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 -
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 -
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... -
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 -
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 -
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 -
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 -
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 -
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 -
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 -
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) -
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 -
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 -
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. -
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 -
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 -
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 -
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 -
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... -
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 -
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! -
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 -
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