Giter Club home page Giter Club logo

zuul-ratio-based-routing's Introduction

Sample Application Demonstrating Ratio based Routing to a legacy and a modern app

This app demonstrates using Zuul to route to a "legacy" and a "pcf" based app based on user specified ratios.

Additionally it understands sessions - if say the user is routed to the legacy app and the app is session based then further requests from the user will be pinned to the legacy app.

Starting it up Locally

In three terminal windows:

Terminal 1:

cd zuulgateway
../gradlew bootRun

Terminal 2:

cd legacyapp
../gradlew bootRun

Terminal 3:

cd pcfapp
../gradlew bootRun

Testing the routing behavior

Access an endpoint - http://localhost:8080/routes/message, the request will be routed to either "pcfapp" or "legacyapp" based on this property:

routing:
  ratio:
    old-percent: 50

Access another session based endpoint in an "Incognito" window - http://localhost:8080/routes/withsession, the behavior now will be once the user is directed to one of the versions of the app, subsequent requests should stick to the same app.

Deploying to CloudFoundry using SCS Tile

All the libraries relevant to getting it to work with SCS tile is already present with the app, just bind to Eureka, specify the name of the "pcfapp" via properties in zuulgateway, for eg:

pcf:
  ribbon:
    DeploymentContextBasedVipAddresses: myeurekaappname

Challenges with Sticky session

  • If Zuul and the target app are hosted on PCF then the call will go via gorouter twice. If there is JSESSIONID being set, then the gorouter tends to add the VCAP_ID twice

  • We add a custom token to route to "legacy" or "pcf" app - however we don’t have a good mechanism to expire this currently. Short term we plan to just add the same expiry as the JSESSIONID cookie, but we will never know if the session has been invalidated manually.

zuul-ratio-based-routing's People

Contributors

bijukunjummen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.