For example, it doesn't relay FINs between connections, doesn't disable Nagle algorithm on the upstream socket, doesn't wait for pending writes to complete before tearing down the connection, doesn't handle congestion at all (potentially leading to unbound memory use), etc.
High Performance TCP Proxy Server
11–20 of 62 posts
Re: High Performance TCP Proxy Server
#12Earlier quoted context omitted.
Netty is a more mature foundation for this sort of thing and likely much faster
Again, this is a really cool 300 loc snippet. No need to pull in the jvm if you're going to do something simple. As for performance, a reproducible benchmark is the minimum requirement to even start the conversation.
Re: High Performance TCP Proxy Server
#13Earlier quoted context omitted.
Can you expand on your reasons for making that claim - perhaps with some benchmarks?
Check out the techempower framework benchmarks. Netty can do over a million http responses per second on a reasonable machine. On Linux it uses an epoll native driver and is asynchronous. The framework makes it possible to write proxies in a few lines. If you want to beat netty by a significant margin you'll probably need to use kernel bypass
Re: High Performance TCP Proxy Server
#14As a sidenote if you don't have a requirement to compile with C++03 I would recommend using the standalone asio library free from boost[1]. The only things you need to modify are the includes and namespaces. [1] http://think-async.com/Asio/Download
Re: High Performance TCP Proxy Server
#15Around half the code in this implementation could probably be removed by the realisation that, after a connection is established, both ends are completely symmetric: all it needs to do is try to read from A and write to B, then try to read from B and write to A. If A closes, close B. If B closes, close A.
Re: High Performance TCP Proxy Server
#16Earlier quoted context omitted.
Can you expand on your reasons for making that claim - perhaps with some benchmarks?
Check out the techempower framework benchmarks. Netty can do over a million http responses per second on a reasonable machine. On Linux it uses an epoll native driver and is asynchronous. The framework makes it possible to write proxies in a few lines. If you want to beat netty by a significant margin you'll probably need to use kernel bypass
Re: High Performance TCP Proxy Server
#17As a sidenote if you don't have a requirement to compile with C++03 I would recommend using the standalone asio library free from boost[1]. The only things you need to modify are the includes and namespaces. [1] http://think-async.com/Asio/Download
Why would you recommend the upstream Asio library instead of the one in Boost?
Re: High Performance TCP Proxy Server
#18Earlier quoted context omitted.
Check out the techempower framework benchmarks. Netty can do over a million http responses per second on a reasonable machine. On Linux it uses an epoll native driver and is asynchronous. The framework makes it possible to write proxies in a few lines. If you want to beat netty by a significant margin you'll probably need to use kernel bypass
ASIO does all that. And it compiles to machine code. What you're basically trying to argue is a well-written C++ application will be slower than a well-written java application. That's not going to happen -- at best they will be the same performance.
Netty is also a lot easier to extend and more portable
Re: High Performance TCP Proxy Server
#19Earlier quoted context omitted.
Check out the techempower framework benchmarks. Netty can do over a million http responses per second on a reasonable machine. On Linux it uses an epoll native driver and is asynchronous. The framework makes it possible to write proxies in a few lines. If you want to beat netty by a significant margin you'll probably need to use kernel bypass
C++ 17 Networking TS is based on ASIO. It will be very interesting if netty performs better than ASIO based code for the same task.