Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8026197

Slow reading tzdb.dat if the JRE is on a high-latency, remote file system

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • 8
    • core-libs
    • 8
    • b115
    • Verified

      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))) {

            sherman Xueming Shen
            sherman Xueming Shen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: