-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
asio on linux with multiple threads io_service->run : performance? #886
Comments
Hi @timprepscius, IMHO, Asio is more performant on Linux when the sockets are spread b/w multiple instances of Note that constructor of Note that spreading of sockets b/w multiples instances of I do believe that there was some performance analysis (and there were some performance enhancements in Asio implemented later) for Linux somewhere at https://think-async.com/, but I can't find that page anymore. I think that the most of performance issues of Asio on Linux are connected with / are caused by the nature of epoll. On Windows, I guess, it's more performant to have a single instance of All the information I shared here is yet not confirmed. I have https://github.com/mabrarov/asio_samples where I have ma_echo_server application which supports both of approaches described above (and uses Asio concurrency hints and custom memory allocation to reduce number of locks and other things which can slow down the application) and allows to choose the "strategy" as
BTW, please note that Asio integration with OpenSSL has additional pitfalls (locks becoming bottlenecks). I was looking at http://konradzemek.com/2015/08/16/asio-ssl-and-scalability/, but it's 6 years old and there are definitely changes in both Asio-OpenSSL integration and in OpenSSL implemented since that investigation. |
Thank you for all of this information. |
Hey there,
I realize this is the vaguest of questions, however I will ask in any case.
I am developing yet another com library, which uses asio as its backend.
In the code I use:
There is just one socket A sending to socket B
On linux if there is only 1 thread
The packet rate is ~ 100,000
If there are multiple threads it drops to:
10,000
Of course the numbers are system dependent, and there are acks, retries when necessary, etc, however there is definitely a very large reduction when multiple threads are running on linux.
On osx, multiple threads increases performance considerably.
Has anyone else seen this?
I'll set up a simple tester sometime next week, but I thought I would ask today.
All the code for the asio portion of the com library is here:
https://github.com/timprepscius/MrUDP/tree/main/mrudp/imp
The text was updated successfully, but these errors were encountered: