RFR: 8339191: JFR: Bulk read support for ChunkInputStream [v3]

David Schlosnagle duke at openjdk.org
Thu Aug 29 19:01:00 UTC 2024


> I would like to contribute an improvement to reading JFR recordings via `InputStream` by implementing `InputStream#read(byte[], int, int)` in `ChunkInputStream` to support bulk reads and avoid many expensive single byte `read()`.
> 
> Testing: `test/jdk/jdk/jfr/api/consumer/TestChunkInputStreamBulkRead.java`, `jdk_jfr`
> 
> While looking through some JFRs recently, I noticed some significant time spent in `java.io.BufferedInputStream#getBufIfOpen()` that traced back to transferring (via `InputStream#transferTo(OutputStream)` JFR profile recording being read via `InputStream` returned by `jdk.jfr.Recording#getStream(Instant , Instant)`. What caught my eye were calls to single byte `jdk.jfr.internal.ChunkInputStream#read()` rather than `read(byte[], int, int)` as seen in the stacktrace from JFR.
> 
> <img width="776" alt="image" src="https://github.com/user-attachments/assets/b92398cd-2761-4600-8cfe-ea1bada6efd2">

David Schlosnagle has updated the pull request incrementally with one additional commit since the last revision:

  closeStream closes chunk

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/20534/files
  - new: https://git.openjdk.org/jdk/pull/20534/files/2dba11bf..d9de5d38

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=20534&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=20534&range=01-02

  Stats: 3 lines in 1 file changed: 1 ins; 2 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/20534.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20534/head:pull/20534

PR: https://git.openjdk.org/jdk/pull/20534


More information about the hotspot-jfr-dev mailing list