One more talk about AIO (asynchronous IO) vs. NIO (non-blocking IO) in Java

Source: Internet
Author: User

Today, when using AB for stress testing, it is unintentional to discover:

Requests per second:xxx [#/sec] (mean)

Ab-n 5000-c http://www:8080/upload/5kb.jpg (nioserver:700 aio:400)

Ab-n 5000-c http://www:8080/upload/18kb.jpg (nioserver:560 aio:360)

Ab-n 2000-c http://www:8080/upload/134kb.jpg (nioserver:330 aio:300)

Ab-n 2000-c http://www:8080/upload/134kb.jpg (nioserver:330 aio:260)

ab-n 3000-c http://www:8080/upload/134kb.jpg (nioserver:300 aio:310)

Ab-n 5000-c http://www:8080/upload/134kb.jpg (nioserver:270 aio:280)

Most of the previous tests were using-K (open: connection:keep-alive), and the test found that Aio was a triumph for NIO.

No parameters are used today:-K, as seen from the above results:

1. NiO in high concurrency, if you are dealing with small pictures (1kb-100kb), NiO's concurrency is better than AIO.

The reason is also very simple, nio no matter how much concurrency, generally only use 2-3 threads to handle, in processing small pictures, high concurrency, CPU utilization 90%+, concurrency performance is very good.

And AIO, because it is asynchronous, the transfer file uses a thread pool, generally use 20-30 threads, in the processing of small pictures, high concurrency, because of the number of threads,CPU utilization in 50%-70%, and multiple thread switching also wasted some performance, concurrency is not as good as NIO.

2. When processing files become larger, such as 100kb+, high concurrency, AIO will reach or exceed NiO, both working CPU utilization: 90%+.

2013-03-06

One more talk about AIO (asynchronous IO) vs. NIO (non-blocking IO) in Java

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.