linkerd2 icon indicating copy to clipboard operation
linkerd2 copied to clipboard

Tab / Mirror of traffic

Open tobad357 opened this issue 5 years ago • 6 comments

Feature Request

We would like to have the ability to mirror traffic to one service to another url

What problem are you trying to solve?

This would solve an issue where we want to either test a new version with production traffic or alternatively debug an issue by using production traffic

How should the problem be solved?

Either by extending the traffic split to allow mirroring

What do you want to happen? Add any considered drawbacks. The traffic from one service gets mirrored to another service

Any alternatives you've considered?

We have tried to use tap but for debugging, which would solve one half of the problem. The issue is that tap doesn't allow to see the POST request body so we can't see whats being sent in and what is responded

Is there another way to solve this problem that isn't as good a solution?

How would users interact with this feature?

If you can, explain how users will be able to use this. Maybe some sample CLI output?

tobad357 avatar May 13 '20 02:05 tobad357

You can do this today with TrafficSplit and nginx. If you follow the fault injection tutorial and tweak the nginx config a little bit you should be good to go!

Now that I've said that, we should totally add shadow traffic to Linkerd!

grampelberg avatar May 13 '20 02:05 grampelberg

Great :) Should I log another issue to allow seeing request and response body with tap?

tobad357 avatar May 14 '20 08:05 tobad357

I think #4326 is close to what you're looking for. If that doesn't hit your use case, please open up a new issue!

grampelberg avatar May 14 '20 17:05 grampelberg

Any news? Would love to see traffic mirroring/shadowing in Linkerd 🙏

lebenitza avatar Dec 05 '21 21:12 lebenitza

You can do this today with TrafficSplit and nginx. If you follow the fault injection tutorial and tweak the nginx config a little bit you should be good to go!

Now that I've said that, we should totally add shadow traffic to Linkerd!

Looking at the tutorial now, the TrafficSplit has been replaced by HTTPRoute

With httpBackendRef, can one specify weights that total > 100% ? eg send 100% of traffic to both backends?

kzap avatar Aug 30 '23 14:08 kzap

Another update here from this Slack thread: https://linkerd.slack.com/archives/C89RTCWJF/p1693405159374459

httpBackendRef weights are not % See https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io%2fv1.BackendRef

Weight specifies the proportion of requests forwarded to the referenced backend. This is computed as weight/(sum of all weights in this BackendRefs list). For non-zero values, there may be some epsilon from the exact proportion defined here depending on the precision an implementation supports. Weight is not a percentage and the sum of weights does not need to equal 100.

If only one backend is specified and it has a weight greater than 0, 100% of the traffic is forwarded to that backend. If weight is set to 0, no traffic should be forwarded for this entry. If unspecified, weight defaults to 1.

Support for this field varies based on the context where used.

kzap avatar Nov 07 '23 16:11 kzap