DOC PREVIEW
UW-Madison CS 736 - An In-Depth Examination of Java I/O Performance and Possible Tuning Strategies

This preview shows page 1-2-3-4 out of 13 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

AbstractThe abstract classes InputStream and OutputStream are the foundation for all input and output streams. They define methods for reading/writing raw bytes from/to streams. For example, the InputStream class provides methods for reading a single byte, a byte array, or reading the available data into a particular region of a byte array. The OutputStream class provides methods for writing that are analogous to those of InputStream.The FileInputStream and FileOutputStream classes are concrete subclasses of InputStream and OutputStream respectively, which provide a mechanism to read from and write to files sequentially. Both classes provide all the methods of their superclasses. These two classes are the lowest file I/O classes provided to users.We conducted our experiments on a personal computer with one Pentium III 667 MHz CPU, 128 MB of memory, and a 10 GB IDE disk (1216 cylinders, 255 heads and 512 bytes per sector).CS736 Course Project Report An In-Depth Examination of Java I/O Performance and Possible Tuning StrategiesKai Xu [email protected] Guo [email protected] is a growing interest in using Java for high-performance computing because of the many advantagesthat Java offers as a programming language. To be useful as a language for high-performance computinghowever, 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 designand conduct a series of performance experiments accordingly using C/C++ as a comparison group. Basedon 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 reducessystem calls, yet there is no big gain for larger buffer size; direct buffering is better than the Java-providedbuffered I/O classes, since the user can tailor it for his own needs; increasing the operation size helps I/Operformance without overheads; I/O-related system calls implemented within Java native methods arecheap, while the overhead of calling Java native methods is rather high. When the number of JNI calls isreduced properly, a performance comparable to C/C++ can be achieved. 1. Introduction There is a growing interest in using Java for high-performance computing because of the many advantagesthat Java offers as a programming language. To be useful as a language for high-performance computinghowever, Java must not only have good support for computation, but must also be able to provide high-performance file I/O, as many scientific applications have significant I/O requirements. However, whilemuch work has been done in evaluating Java performance as a programming language, little has been donein a satisfying evaluation of Java I/O performance. In this paper, we investigate in depth the I/O capabilitiesof Java, and examine how and how well different possible tuning strategies work compared to C/C++. 1.1 Contribution of This PaperThe contributions of this paper are threefold. First we explored possible strategies one can utilize to gethigh performance in Java I/O. Secondly, we designed and conducted a series of experiments that examinethe performance of each individual strategy accordingly, in comparison to C/C++. Finally, experimentresults are thoroughly analyzed and conclusions are reached. 1.2 Related WorkThere are already some papers discussing Java I/O performance. Our work is different from those in thatwe summarize possible I/O strategies in Java and give a thorough Java I/O performance evaluation andanalysis in comparison to C/C++. [1] describes in detail possible strategies in improving Java I/O.However, no convincing experiments have been given to show how well those strategies work, neither hasit studied Java I/O in comparison to that of C/C++. [2] compares Java I/O to that of C/C++ and proposesbulk I/O extensions. However, this paper mainly focuses on parallel Java I/O for specific applicationsinstead of examining Java I/O in general.. 1 .CS736 Course Project Report 1.3 OrganizationThe rest of this paper is organized as follows. In Section 2 we describe the basic I/O mechanisms defined inJava. In Section 3 we discuss our test methodology and experiments design. Then we give out thecorresponding experiment results and analysis in Section 4. Conclusions and ideas for future work arepresented in Section 5. 2. Java I/O OverviewTo understand the issues associated with performing I/O in Java, it is necessary to briefly review the JavaI/O model. When discussing Java I/O, it is worth noting that the Java programming language assumes two distincttypes of disk file organization. One is based on streams of bytes, the other on character sequences. Byte-oriented I/O includes bytes, integers, floats, doubles and so forth; text-oriented I/O includes characters andtext. In the Java language a character is represented using two bytes, instead of the one byte representationin C/C++. Because of this, some translation is required to handle characters in file I/O. In this project, sinceour major concern is to compare Java I/O to that of C/C++, we will focus on the byte-oriented I/O. In Java, byte-oriented I/O is handled by input streams and output streams, where a stream is an orderedsequence of bytes of unknown length. Java provides a rich set of classes and methods for operating on byteinput and output streams. These classes are hierarchical, and at the base of this hierarchy are the abstractclasses InputStream and OutputStream. It is useful to briefly discuss this class hierarchy in order to clarifythe reason why we are interested in FileInputStream/FileOutputStream, BufferedInputStream/BufferedOutputStream, and RandomAccessFile in our test cases. Figure 2.1 provides a graphicalrepresentation of this I/O hierarchy. Note that we have not included every class that deals with byte-oriented I/O but only those classes that are pertinent to our discussion. 2.1 InputStream and OutputStream ClassesThe abstract classes InputStream and OutputStream are the foundation for all input and output streams.They define methods for reading/writing raw bytes from/to streams. For example, the InputStream classprovides methods for reading a single byte, a byte array, or


View Full Document

UW-Madison CS 736 - An In-Depth Examination of Java I/O Performance and Possible Tuning Strategies

Documents in this Course
Load more
Download An In-Depth Examination of Java I/O Performance and Possible Tuning Strategies
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view An In-Depth Examination of Java I/O Performance and Possible Tuning Strategies and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view An In-Depth Examination of Java I/O Performance and Possible Tuning Strategies 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?