Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document Weight predicate #1072

Closed
PadmaGit2 opened this issue May 21, 2019 · 7 comments
Closed

Document Weight predicate #1072

PadmaGit2 opened this issue May 21, 2019 · 7 comments
Assignees
Milestone

Comments

@PadmaGit2
Copy link

Hi , i am trying to customize or use any available predicate to use for A/B testing - like for the same route send 10% traffic to destination B and remaining 90% to A

@spencergibb spencergibb changed the title How to use predicate for canary deployment or A/B deployment Document Weight predicate May 21, 2019
@spencergibb spencergibb added this to To do in Greenwich.SR2 via automation May 21, 2019
@spencergibb spencergibb added this to the 2.1.2.RELEASE milestone May 21, 2019
@spencergibb
Copy link
Member

There is a Weight predicate (while trying to find the docs, I couldn't, so I'll reuse this issue for that.)

Under spring.cloud.gateway.routes

      - id: weight_high_test
        uri: ${test.uri}
        predicates:
        - Host=**.weighthigh.org
        - Weight=group1, 8
      - id: weight_low_test
        uri: ${test.uri}
        predicates:
        - Host=**.weightlow.org
        - Weight=group1, 2

The weights are calculated per group.

@PadmaGit2
Copy link
Author

Thank you Spencer, @spencergibb , I saw something about ThrottleRoutePredicateFactory - is that old? i dont find it in the master branch anymore.

@spencergibb
Copy link
Member

It's only a sample.

@PadmaGit2
Copy link
Author

@spencergibb - Thank you - I think this works, but I was wondering how this uses the weight - does it take the total # of requests in a day? or an in hour? and splits it into X % to service A and Y% to service B. does it reset the count if I restart the gateway application?

I am using a config server to hold the application.yml and using actuator refresh for gateway to pick it up. I wanted to know how the gateway changes - does it consider the apps in a day or an hour and split?

@spencergibb spencergibb added this to To do in Greenwich.SR3 via automation Jul 3, 2019
@spencergibb spencergibb removed this from To do in Greenwich.SR2 Jul 3, 2019
callingmahendra pushed a commit to callingmahendra/spring-cloud-gateway that referenced this issue Jul 19, 2019
ryanjbaxter added a commit that referenced this issue Jul 22, 2019
@ryanjbaxter ryanjbaxter removed this from To do in Greenwich.SR3 Sep 5, 2019
@ryanjbaxter ryanjbaxter added this to To do in Greenwich.SR4 via automation Sep 5, 2019
@ryanjbaxter ryanjbaxter removed this from To do in Greenwich.SR4 Nov 19, 2019
@ryanjbaxter ryanjbaxter added this to To do in Greenwich.SR5 via automation Nov 19, 2019
@spencergibb spencergibb self-assigned this Jan 27, 2020
spencergibb pushed a commit that referenced this issue Jan 31, 2020
@spencergibb
Copy link
Member

Cherry-picked into 2.1.x via 8c21563

Greenwich.SR5 automation moved this from To do to Done Jan 31, 2020
@hariharakumar
Copy link

@PadmaGit2 : My use case is similar to yours. Can you tell me about your experience with weight based routing implementation in production? Did you find answers for this part of your question:

I was wondering how this uses the weight - does it take the total # of requests in a day? or an in hour? and splits it into X % to service A and Y% to service B. does it reset the count if I restart the gateway application?

Thanks in advance.

@rishuyadav
Copy link

I also have a quite similar use case @hariharakumar @PadmaGit2 , can u please share more about your experience with weight based routing implementation,
also i was facing difficulties in implementing it in configuration java class, i want to make the uri and split percentages dynamic.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Greenwich.SR5
  
Done
Development

No branches or pull requests

6 participants