Comparison of Muduo and boost ASIO throughput

Source: Internet
Author: User
Tags comparison

Muduo (Http://code.google.com/p/muduo) is a C + + network library based on reactor mode, I didn't write it with high concurrent high throughput as the main goal, but to my surprise, ping pong test shows that Muduo Throughput is more than 15% higher than Boost.asio.

Test object

ASIO 1.4.3 in boost 1.40

ASIO 1.4.5 (http://think-async.com/Asio/Download)

Muduo 0.1.1 (http://muduo.googlecode.com/files/muduo-0.1.1-alpha.tar.gz) SHA1 Checksum: a446ea8a22915f439063d2bc52eb2dc4b9caf92d

Test environment

Hardware: DELL 490 workstation, dual Intel Quad core Xeon E5320 cpu,16g memory

Operating system: Ubuntu Linux Server 10.04.1 LTS x86_64

Compiler: g++ 4.4.3

Test method

Based on the ASIO performance test http://think-async.com/Asio/LinuxPerformanceImprovements, ping pong protocol is used to test throughput.

Simply put, the ping pong Protocol is the ECHO protocol that both the client and the server implement. When a TCP connection is established, the client sends some data to the server, and the server echo back the data, and the client then echo back to the server. The data will be transferred back and forth between the client and the server, like ping pong, until one side disconnects. This is a common way to test throughput.

ASIO's test code is taken from http://asio.cvs.sourceforge.net/viewvc/asio/asio/src/tests/performance/and has not been changed.

The Muduo test code is in the 0.1.1 package, the path is examples/pingpong/, and the code is shown in http://gist.github.com/564985.

The optimized compilation parameters for Muduo and ASIO are all-o2-finline-limit=1000

$ build_type=release./build.sh # Compiling an optimized version of Muduo

I have done two main tests:

Single-threaded test to test throughput when the number of concurrent connections is 1/10/100/1000/10000.

Multithreading tests, the number of concurrent connections is 100 or 1000, and the number of threads for the server and client is set to 1/2/3/4. (Since my home has only one 8 nuclear machine and the server and the client are running on the same machine, the number of threads greater than 4 is meaningless.) )

In all tests, the ping pong message has a size of 16k bytes. Test shell scripts can be downloaded from the http://gist.github.com/564985.

Test results

The result of single-threaded testing, the larger the number the better:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.