Integrated: 8339191: JFR: Bulk read support for ChunkInputStream

David Schlosnagle duke at openjdk.org
Fri Aug 30 12:39:26 UTC 2024


On Sat, 10 Aug 2024 21:55:29 GMT, David Schlosnagle <duke at openjdk.org> wrote:

> 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">

This pull request has now been integrated.

Changeset: 3a352b82
Author:    David Schlosnagle <davids at palantir.com>
Committer: Erik Gahlin <egahlin at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/3a352b82591eb522c24108de95e42a3d1e5ceb3a
Stats:     118 lines in 2 files changed: 111 ins; 3 del; 4 mod

8339191: JFR: Bulk read support for ChunkInputStream

Reviewed-by: egahlin

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

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


More information about the hotspot-jfr-dev mailing list