Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Has anyone done a performance analysis of boost::asio?

I require socket-like local IPC. I used named pipes and overlapped IO on windows and I want to rewrite the application to boost::ASIO so that it can use UNIX domain sockets as well.

I've recently reviewed parts of the libevent library and I know it only supports socket() and select() for windows in the 1.4 version. As overlapped IO is very efficient leaving it out is obviously an unacceptable trait which is being adressed in version 2 (which is in alpha). Another example of sub-optimal implementation is the use of red-black trees vs. prio-queues for the timeout logic which was adressed somewhere along the line.

Does anyone have any opinions on the performance characteristics of boost vs libevent/libev. Does it have any glaring undesireable traits on certain platforms ? My aim for this question is that I do not want to pidgeon-hole the ASIO library unless I absolutely must. I want to know if boost::asio uses the most optimal OS primitives in the most optimal way.

like image 973
Hassan Syed Avatar asked Nov 25 '09 20:11

Hassan Syed


People also ask

Is ASIO part of Boost?

Asio is a cross-platform C++ library for network and low-level I/O programming that provides developers with a consistent asynchronous model using a modern C++ approach. (Note: Boost. Asio 1.24. 0 is also included in Boost 1.80.)

Where is Boost ASIO used?

Boost. Asio is a C++ library used for network programming operations.

How does Boost ASIO work?

At its core, Boost Asio provides a task execution framework that you can use to perform operations of any kind. You create your tasks as function objects and post them to a task queue maintained by Boost Asio. You enlist one or more threads to pick these tasks (function objects) and invoke them.

Is Boost ASIO header only?

By default, Boost. Asio is a header-only library. However, some developers may prefer to build Boost. Asio using separately compiled source code.


3 Answers

I do performance tests of asio and my own impl on file reading (my blogpost entry) - in two words - asio shown good results.

like image 158
Sergey Miryanov Avatar answered Nov 07 '22 01:11

Sergey Miryanov


Also check this post about a locking problem in boost::asio, which may affect you.

like image 34
Frunsi Avatar answered Nov 07 '22 02:11

Frunsi


In my opinion Boost.Asio is Windows-First, where most other free-software libraries are Linux-First. However the quality under Linux has always been good. Since this software got reveiwed by 20 people who did not participate in its development. Speed under Linux with multiple threads has been rapidly improved around the time the asker asked this question (2009): http://think-async.com/Asio/LinuxPerformanceImprovements

Speed under Windows has always been good. My biggest gripe is the design of UDP sockets, it is poorly implemented.

like image 37
unixman83 Avatar answered Nov 07 '22 02:11

unixman83