Slow reading tzdb.dat

roger riggs roger.riggs at oracle.com
Wed Oct 9 17:40:25 UTC 2013


Hi Thomas,

Thanks for the report and suggestion, I filed an issue for it.

   https://bugs.openjdk.java.net/browse/JDK-8026198

Roger

On 10/9/2013 1:08 PM, Salter, Thomas A wrote:
> I noticed recently that the JDK8 JVM was very slow starting on systems where the JRE is on a high-latency, remote file system.  I tracked this down to the reading of tzdb.dat.  In java/time/zone/TzdbZoneRulesProvider.java and sun/util/calendar/ZoneInfoFile.java the tzdb.dat file is read using a DataInputStream directly over a FileInputStream.  Consequently there ends up being a large number of very small (often a single byte) read requests to the underlying O/S file system.  This can be fixed trivially by adding a BufferedInputStream between the DataInputStream and the FileInputStream.
>
> Thus this:
>    try (DataInputStream dis = new DataInputStream(
>             new FileInputStream(new File(libDir, "tzdb.dat")))) {
> becomes:
>    try (DataInputStream dis = new DataInputStream(
>        new BufferedInputStream(
>             new FileInputStream(new File(libDir, "tzdb.dat")), 32000))) {
>
>
>    
> Tom Salter  |  Software Engineer  |  Java & Middleware Development
> Unisys  |  2476 Swedesford Road  |  Malvern, PA  19355   |  610-648-2568 |  N385-2568
>
>




More information about the core-libs-dev mailing list