当前位置: 首页 > 工具软件 > AIO4J > 使用案例 >

IBM aio4j初见

饶谦
2023-12-01

18M的一个Java异步IO接口实现

What is Asynchronous IO for Java? (http://www.alphaworks.ibm.com/tech/aio4j

Asynchronous IO for Java TM (AIO4J) is a package that provides the capability to perform input and output (IO) on sockets and files asynchronously -- that is, where the Java application can request the operation but can continue doing useful work while the underlying system performs the operation. The application is informed of the operation's completion later.

This package provides Java applications with capabilities that are now available from most operating systems at the "C" API layer, such as IO Completion Ports on Windows. AIO4J provides Java application programmers with access to these capabilities, but in a way that is very much in keeping with Java idioms and styles of programming.

AIO4J can be used as a replacement for classic synchronous IO and also as an alternative to the New IO package introduced in Java 1.4. AIO4J aims to give performance and scalability that is better than either of these other packages. In particular, AIO4J aims to help Java server applications address what has been called the "C10K problem": building server applications that serve 10,000 clients simultaneously with good responsiveness and performance. This is very difficult with Java synchronous IO because most systems cannot sustain 10,000 threads, and Java New IO does not perform well with such a load.

How does it work?

AIO4J provides a standard Java package of function, layered above a native library that interfaces with the underlying capabilities of the operating system.

The package provides facilities that support a range of programming styles, including Blocking, Polling and Callbacks as techniques for getting notifications of the completion of Read or Write operations.

For Callbacks, the application can control the number and the type of threads that are used.

目前,AIO4J受美国软件出口法律限制,并不能从网上自由得到。

下面是一个简单介绍 http://www.cis.nctu.edu.tw/~gis91530/blog/archives/2004_06.html

下面对比了AIO4J的性能: http://www.javaworld.com.tw/jute/post/view?bid=12&id=77914&sty=1&tpg=1&age=0

Number of Clients | Sync Server | New IO Server| Async Server|
50                         | 357/186     |487/180          | 332/180      |
200                       | 326/178     |200/179          | 211/178      |
400                       | 193/181     |201/178          | 190/178      |
1000                     | 200/180     |433/197          | 222/186      |
3000                     | 230/180     |565/184          | 217/201      |
1000active+          |                   |                       |                    |
3000static             | 232/187     |688/196          | 230/181      |
1000active+          |                   |                       |                    |
6000static             |outofmemory|781/269         | 275/195      |
單位 overall time/data transfer time,
All times are average microseconds per cycle

 类似资料: