mtcp-stack / mtcp

mTCP: A Highly Scalable User-level TCP Stack for Multicore Systems

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sample TCP proxy application (slow performance)

sebymiano opened this issue · comments

Hi there!

I am trying to write a simple TCP proxy application with mTCP where basically the proxy can accept multiple TCP connections from a set of clients on the same TCP port and, for every new connection, creates a parallel session with a backend server with another IP:Port.

I have basically copied the epproxy application from this repo [1] (AccelTCP), modifying it in a way that it does not read the HTTP packet content but just forwards all the data from the client socket to the corresponding backend socket (without any hardware-assisted mtcp_splice operation).
You can have a look at the application here [2].

I have tested the application with iperf3, with the proxy redirecting packets from a frontend interface (where the proxy is listening to) to a backend interface (where the backend server is placed).

The problem is that performance are tremendously slow. Within a single core and the default mTCP parameters (rcvbuf = sndbuf = 8192) the reported iperf3 throughput is about 290 Kbits/sec.
I was able to achieve better results increasing the rcvbuf and sndbuf size to around 4MB but with a throughput of 50 Mbits/sec.

I am sure there is something wrong with my applicatsiion but I am not able to understand what.
Any help?

Thanks!

[1] https://github.com/acceltcp/AccelTCP/tree/master/apps/epproxy/src
[2] https://github.com/sebymiano/mtcp/blob/blu5_proxy_new/apps/blue5_proxy/blue5_proxy.c