An In-Depth Examination of Java I/O Performance

and Possible Tuning Strategies

Kai Xu          xuk@cs.wisc.edu

Hongfei Guo     guo@cs.wisc.edu

Abstract: There is a growing interest in using Java for high-performance computing because of the many advantages that Java offers as a programming language. To be useful as a language for high-performance computing however, Java must not only have good support for computation, but must also be able to provide high-performance file I/O. In this paper, we first examine possible strategies for doing Java I/O. Then we design and conduct a series of performance experiments accordingly using C/C++ as a comparison group. Based on the experimental results and analysis, we reach our conclusions: Java raw I/O is slower than C/C++, since system calls in Java are more expensive; buffering improves Java I/O performance, for it reduces system calls, yet there is no big gain for larger buffer size; direct buffering is better than the Java-provided buffered I/O classes, since the user can tailor it for his own needs; increasing the operation size helps I/O performance without overheads; I/O-related system calls implemented within Java native methods are cheap, while the overhead of calling Java native methods is rather high. When the number of JNI calls is reduced properly, a performance comparable to C/C++ can be achieved.

[Full Paper] [Slides]

 

Resourses:
A Java profiling tool: PerfAnal