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

Question: Can L4 tcp proxy have same behaviour as udp proxy with use_per_packet_load_balancing=true? #34965

Open
didimelli opened this issue Jun 28, 2024 · 3 comments
Labels
area/tcp_proxy question Questions that are neither investigations, bugs, nor enhancements

Comments

@didimelli
Copy link

Title: Per-packet tcp proxy

Description:
My app must receive a very high amount of data (300MBps) in a single tcp connection.

I would like to be able to split the incoming data into individual "chunks" that my app understands (e.g. my app receives 10KB packets) and proxy the newly created chunks to N upstream servers. Typical tcp load balancer would not help, since they make a 1:1 connection between the client and an upstream server.

My app would only reason by individual packets, so ordering is not an issue. Moreover, my app does not need to reply to the client (apart from the tcp ack). Basically my app is a sink for binary data that is serialized into 10KB packets (with a custom structure, with headers, crcs and payload) and sent over a tcp connection.

Reading the docs, I understood that udp proxy, when configured with use_per_packet_load_balancing=true, does exactly that.
I realize tcp (connection-based) is very different from udp (connection-less), but I was wondering if something similar is achievable (maybe with some custom extension)?

@didimelli didimelli added the triage Issue requires triage label Jun 28, 2024
@didimelli
Copy link
Author

Looking at the documentation, it looks like a good solution might be this https://www.envoyproxy.io/docs/envoy/latest/configuration/listeners/network_filters/generic_proxy_filter. Would it be a good way to go?

@htuch
Copy link
Member

htuch commented Jul 1, 2024

I think you would need to implement a custom TCP protocol for this that demuxed the TCP stream across multiple backend connections. Generic proxy filter could be a way to go, depending on complexity. CC @ggreenway @wbpcode

@htuch htuch added question Questions that are neither investigations, bugs, nor enhancements area/tcp_proxy and removed triage Issue requires triage labels Jul 1, 2024
@didimelli
Copy link
Author

didimelli commented Jul 2, 2024

Not sure about how to measure "complexity", but if you refer to the protocol it should be pretty straight forward, something in the lines of:

  • sync word (always fixed)
  • some headers
  • first crc (computed on sync word and headers)
  • fixed length payload data
  • second crc (computed on whole packet)

All packets would are fixed length. No response is sent back to the sender (only tcp connection needs to stay live).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/tcp_proxy question Questions that are neither investigations, bugs, nor enhancements
Projects
None yet
Development

No branches or pull requests

2 participants