Skip to content

Conversation

@jabolina
Copy link
Member

@jabolina jabolina commented Sep 2, 2025

  • Requires JFR package.
  • Covering read and write path.

Closes #531.

@jabolina jabolina requested a review from a team as a code owner September 2, 2025 19:11
public long[] readLongs(String fieldName) throws IOException {
List<Long> values = readCollection(fieldName, new ArrayList<>(), Long.class);
long[] result = new long[values.size()];
JfrEventPublisher.bufferAllocateEvent(result.length * Long.BYTES);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am most likely micro-optimizing, but if JFR is disabled, you're still doing unnecessary multiplications. WOuldn't it be better to have bufferAllocateLong, bufferAllocateInteger, etc methods instead and do the multiplication only inside the if statement?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds good. Let me update.

@wburns
Copy link
Member

wburns commented Sep 10, 2025

@jabolina Did you find using this showed anything interesting? I wonder how easy it is to parse this type of information.

@jabolina
Copy link
Member Author

Let me put together a script with JBang to extract the values and generate a summary of sorts. The only thing I've noticed is that it emits so many events that it can hurt perf badly, so it is something to have enabled only for analysis, at most.

image

* Requires JFR package.
* Covering read and write path.
@jabolina
Copy link
Member Author

Ok, I've pushed a small script to generate a summary:

=========================================================
   Infinispan ProtoStream Buffer Events JFR Summary      
=========================================================

--- Buffer Resize Events (org.infinispan.protostream.ResizeEvent) ---
Total Resize Events: 729,252
Total Bytes Added by Resizing: 250,389,288 bytes
Average Resize Increase: 343.35 bytes
Largest Single Resize: from 1,101 to 2,202 bytes (an increase of 1,101 bytes)

Top 5 Most Common Resize Locations (Stack Trace):
  - [728,795 times]:
org.infinispan.protostream.impl.jfr.JfrEventPublisher.bufferResizeEvent:38 [Inlined]
	at org.infinispan.protostream.impl.RandomAccessOutputStreamImpl.ensureCapacity:87 [JIT compiled]
	at org.infinispan.protostream.impl.TagWriterImpl$OutputStreamRandomAccessEncoder.writeUInt64Field:1171 [Interpreted]
	at org.infinispan.protostream.impl.TagWriterImpl.writeInt64:188 [Interpreted]
	at org.infinispan.commands.write.BackupMultiKeyAckCommand$___Marshaller_e9af2f6dca33056a8e88a66161579c07aaebf33b7f8b5aebffc5b34e3c28587e.write:85 [Interpreted]
	at org.infinispan.commands.write.BackupMultiKeyAckCommand$___Marshaller_e9af2f6dca33056a8e88a66161579c07aaebf33b7f8b5aebffc5b34e3c28587e.write:13 [Interpreted]
	at org.infinispan.protostream.impl.ProtobufTagMarshallerDelegate.marshall:28 [JIT compiled]
	at org.infinispan.protostream.WrappedMessage.writeCustomObject:327 [JIT compiled]
	at org.infinispan.protostream.WrappedMessage.writeMessage:258 [Interpreted]
	at org.infinispan.protostream.WrappedMessage.write:251 [Interpreted]
	at org.infinispan.protostream.ProtobufUtil.toWrappedStream:160 [Interpreted]
	at org.infinispan.marshall.protostream.impl.AbstractInternalProtoStreamMarshaller.objectToOutputStream:67 [Interpreted]
	at org.infinispan.marshall.protostream.impl.AbstractInternalProtoStreamMarshaller.objectToBuffer:90 [Interpreted]
	at org.infinispan.marshall.protostream.impl.GlobalMarshaller.objectToBuffer:71 [Interpreted]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.marshallRequest:1196 [Interpreted]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.doSendForCluster:1188 [Interpreted]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.sendCommandCheckingView:1176 [Interpreted]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.sendTo:306 [Interpreted]
	at org.infinispan.remoting.rpc.RpcManagerImpl.sendTo:390 [Interpreted]
	at org.infinispan.remoting.inboundhandler.TrianglePerCacheInboundInvocationHandler.sendBackupAck:148 [Interpreted]
	at org.infinispan.remoting.inboundhandler.TrianglePerCacheInboundInvocationHandler$1.afterInvoke:173 [Interpreted]
	at org.infinispan.remoting.inboundhandler.BaseBlockingRunnable.invokedComplete:133 [Interpreted]
	at org.infinispan.remoting.inboundhandler.BaseBlockingRunnable.invoke:122 [Interpreted]
	at org.infinispan.remoting.inboundhandler.BaseBlockingRunnable.runAsync:79 [Interpreted]
	at org.infinispan.remoting.inboundhandler.BaseBlockingRunnable.run:48 [Interpreted]
	at java.util.concurrent.ThreadPerTaskExecutor$TaskRunner.run:314 [Interpreted]
	at java.lang.Thread.runWith:1596 [Inlined]
	at java.lang.VirtualThread.run:309 [JIT compiled]
	at java.lang.VirtualThread$VThreadContinuation$1.run:190 [JIT compiled]
	at jdk.internal.vm.Continuation.enter0:320 [Inlined]
	at jdk.internal.vm.Continuation.enter:312 [JIT compiled]
	at jdk.internal.vm.Continuation.enterSpecial:-1 [Native]

  - [457 times]:
org.infinispan.protostream.impl.jfr.JfrEventPublisher.bufferResizeEvent:38 [Interpreted]
	at org.infinispan.protostream.impl.RandomAccessOutputStreamImpl.ensureCapacity:87 [JIT compiled]
	at org.infinispan.protostream.impl.TagWriterImpl$OutputStreamRandomAccessEncoder.writeBytes:1249 [Interpreted]
	at org.infinispan.protostream.impl.TagWriterImpl.writeBytes:244 [Interpreted]
	at org.infinispan.protostream.impl.TagWriterImpl.writeBytes:239 [Interpreted]
	at org.infinispan.commons.marshall.WrappedByteArray$___Marshaller_dd5f1f82b70f419159a02b94c2ffa39a035efa36bc3f94e3bec8f1fb78d5e078.write:56 [Interpreted]
	at org.infinispan.commons.marshall.WrappedByteArray$___Marshaller_dd5f1f82b70f419159a02b94c2ffa39a035efa36bc3f94e3bec8f1fb78d5e078.write:13 [Interpreted]
	at org.infinispan.protostream.impl.ProtobufTagMarshallerDelegate.marshall:28 [Interpreted]
	at org.infinispan.protostream.WrappedMessage.writeCustomObject:327 [Interpreted]
	at org.infinispan.protostream.WrappedMessage.writeMessage:258 [Interpreted]
	at org.infinispan.protostream.WrappedMessage$1.write:836 [Interpreted]
	at org.infinispan.protostream.WrappedMessage$1.write:817 [Interpreted]
	at org.infinispan.protostream.impl.ProtobufTagMarshallerDelegate.marshall:28 [Interpreted]
	at org.infinispan.protostream.GeneratedMarshallerBase.writeNestedMessage:45 [Interpreted]
	at org.infinispan.marshall.protostream.impl.MarshallableObject$Marshaller.write:145 [Interpreted]
	at org.infinispan.marshall.protostream.impl.MarshallableObject$Marshaller.write:70 [Interpreted]
	at org.infinispan.protostream.impl.ProtobufTagMarshallerDelegate.marshall:28 [Interpreted]
	at org.infinispan.protostream.GeneratedMarshallerBase.writeNestedMessage:45 [Interpreted]
	at org.infinispan.commands.triangle.SingleKeyBackupWriteCommand$___Marshaller_3f5a0bfd78cc229ce9389de39402811ec2d2daaca7159b654b3845be8d043c89.write:201 [Interpreted]
	at org.infinispan.commands.triangle.SingleKeyBackupWriteCommand$___Marshaller_3f5a0bfd78cc229ce9389de39402811ec2d2daaca7159b654b3845be8d043c89.write:13 [Interpreted]
	at org.infinispan.protostream.impl.ProtobufTagMarshallerDelegate.marshall:28 [Interpreted]
	at org.infinispan.protostream.WrappedMessage.writeCustomObject:327 [Interpreted]
	at org.infinispan.protostream.WrappedMessage.writeMessage:258 [Interpreted]
	at org.infinispan.protostream.WrappedMessage.write:251 [Interpreted]
	at org.infinispan.protostream.ProtobufUtil.toWrappedStream:160 [Interpreted]
	at org.infinispan.marshall.protostream.impl.AbstractInternalProtoStreamMarshaller.objectToOutputStream:67 [Interpreted]
	at org.infinispan.marshall.protostream.impl.AbstractInternalProtoStreamMarshaller.objectToBuffer:90 [Interpreted]
	at org.infinispan.marshall.protostream.impl.GlobalMarshaller.objectToBuffer:71 [Interpreted]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.marshallRequest:1196 [Interpreted]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.sendCommand:1400 [Interpreted]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.sendToMany:317 [Interpreted]
	at org.infinispan.remoting.rpc.RpcManagerImpl.sendToMany:403 [Interpreted]
	at org.infinispan.interceptors.distribution.TriangleDistributionInterceptor.sendToBackups:521 [Interpreted]
	at org.infinispan.interceptors.distribution.TriangleDistributionInterceptor.lambda$remotePrimaryOwnerWrite$5:502 [Interpreted]
	at org.infinispan.interceptors.distribution.TriangleDistributionInterceptor$$Lambda+0x00007f50c051fab8.2142762596.apply:-1 [Interpreted]
	at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNextThenApply:85 [Interpreted]
	at org.infinispan.interceptors.distribution.TriangleDistributionInterceptor.remotePrimaryOwnerWrite:489 [Interpreted]
	at org.infinispan.interceptors.distribution.TriangleDistributionInterceptor.handleSingleKeyWriteCommand:414 [Interpreted]
	at org.infinispan.interceptors.distribution.TriangleDistributionInterceptor.visitPutKeyValueCommand:115 [Interpreted]
	at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor:113 [Interpreted]
	at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNext:58 [JIT compiled]
	at org.infinispan.interceptors.BaseAsyncInterceptor.asyncInvokeNext:231 [Interpreted]
	at org.infinispan.interceptors.impl.EntryWrappingInterceptor.setSkipRemoteGetsAndInvokeNextForDataCommand:732 [Interpreted]
	at org.infinispan.interceptors.impl.EntryWrappingInterceptor.visitPutKeyValueCommand:335 [Interpreted]
	at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor:113 [Interpreted]
	at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNextAndFinally:154 [Interpreted]
	at org.infinispan.interceptors.locking.AbstractLockingInterceptor.lambda$nonTxLockAndInvokeNext$3:318 [Interpreted]
	at org.infinispan.interceptors.locking.AbstractLockingInterceptor$$Lambda+0x00007f50c051e6c0.2012015600.apply:-1 [Interpreted]
	at org.infinispan.interceptors.SyncInvocationStage.andHandle:71 [Interpreted]
	at org.infinispan.interceptors.locking.AbstractLockingInterceptor.nonTxLockAndInvokeNext:313 [Interpreted]
	at org.infinispan.interceptors.locking.AbstractLockingInterceptor.visitNonTxDataWriteCommand:138 [Interpreted]
	at org.infinispan.interceptors.locking.NonTransactionalLockingInterceptor.visitDataWriteCommand:41 [Interpreted]
	at org.infinispan.interceptors.locking.AbstractLockingInterceptor.visitPutKeyValueCommand:82 [Interpreted]
	at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor:113 [Interpreted]
	at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNext:58 [JIT compiled]
	at org.infinispan.statetransfer.StateTransferInterceptor.handleNonTxWriteCommand:309 [Interpreted]
	at org.infinispan.statetransfer.StateTransferInterceptor.handleWriteCommand:256 [Interpreted]
	at org.infinispan.statetransfer.StateTransferInterceptor.visitPutKeyValueCommand:96 [Interpreted]
	at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor:113 [Interpreted]
	at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNext:58 [JIT compiled]
	at org.infinispan.interceptors.impl.CacheMgmtInterceptor.updateStoreStatistics:233 [Interpreted]
	at org.infinispan.interceptors.impl.CacheMgmtInterceptor.visitPutKeyValueCommand:196 [Interpreted]
	at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor:113 [Interpreted]
	at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNext:58 [JIT compiled]


--- Buffer Allocate Events (org.infinispan.protostream.AllocateEvent) ---
Total Allocation Events: 12,858,712
Total Bytes Allocated: 6,428,168,589 bytes
Average Allocation Size: 499.91 bytes
Largest Single Allocation: 1,536 bytes

Top 5 Most Common Allocation Locations (Stack Trace):
  - [6,088,336 times]:
org.infinispan.protostream.impl.jfr.JfrEventPublisher.bufferAllocateEvent:15 [JIT compiled]
	at org.infinispan.protostream.impl.TagReaderImpl$ByteArrayDecoder.readRawByteArray:644 [JIT compiled]
	at org.infinispan.protostream.impl.TagReaderImpl.readByteArray:181 [Inlined]
	at org.infinispan.util.ByteString$___Marshaller_8e599c0fc1e9a512b7cdb7c05fb5529744ecac265708e69fd30c5e989237252a.read:39 [JIT compiled]
	at org.infinispan.util.ByteString$___Marshaller_8e599c0fc1e9a512b7cdb7c05fb5529744ecac265708e69fd30c5e989237252a.read:13 [JIT compiled]
	at org.infinispan.protostream.impl.ProtobufTagMarshallerDelegate.unmarshall:33 [JIT compiled]
	at org.infinispan.protostream.GeneratedMarshallerBase.readMessage:22 [Inlined]
	at org.infinispan.commands.write.PutKeyValueCommand$___Marshaller_ed1a9e8e7c2535a535a200179a93b38d0fefe58e2398c90ea7a66e76d4895bc8.read:67 [JIT compiled]
	at org.infinispan.commands.write.PutKeyValueCommand$___Marshaller_ed1a9e8e7c2535a535a200179a93b38d0fefe58e2398c90ea7a66e76d4895bc8.read:13 [Interpreted]
	at org.infinispan.protostream.impl.ProtobufTagMarshallerDelegate.unmarshall:33 [Inlined]
	at org.infinispan.protostream.WrappedMessage.readCustomObject:596 [JIT compiled]
	at org.infinispan.protostream.WrappedMessage.readMessage:420 [JIT compiled]
	at org.infinispan.protostream.WrappedMessage.read:410 [Inlined]
	at org.infinispan.protostream.ProtobufUtil.fromWrappedByteArray:131 [JIT compiled]
	at org.infinispan.marshall.protostream.impl.AbstractInternalProtoStreamMarshaller.objectFromByteBuffer:132 [JIT compiled]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.processRequest:1524 [JIT compiled]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.processMessage:1462 [JIT compiled]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport$ChannelCallbacks.up:1635 [Inlined]
	at org.jgroups.JChannel.up:678 [JIT compiled]
	at org.jgroups.stack.ProtocolStack.up:938 [JIT compiled]
	at org.jgroups.protocols.FRAG2.up:137 [JIT compiled]
	at org.jgroups.protocols.FlowControl.up:252 [JIT compiled]
	at org.jgroups.protocols.FlowControl.up:260 [JIT compiled]
	at org.jgroups.protocols.pbcast.GMS.up:799 [JIT compiled]
	at org.jgroups.protocols.pbcast.STABLE.up:235 [JIT compiled]
	at org.jgroups.protocols.UNICAST3.deliverMessage:1173 [JIT compiled]
	at org.jgroups.protocols.UNICAST3.addMessage:898 [JIT compiled]
	at org.jgroups.protocols.UNICAST3.handleDataReceived:880 [JIT compiled]
	at org.jgroups.protocols.UNICAST3.up:489 [JIT compiled]
	at org.jgroups.protocols.pbcast.NAKACK2.up:644 [JIT compiled]
	at org.jgroups.protocols.VERIFY_SUSPECT2.up:104 [JIT compiled]
	at org.jgroups.protocols.FailureDetection.up:181 [JIT compiled]
	at org.jgroups.protocols.FD_SOCK2.up:190 [JIT compiled]
	at org.jgroups.protocols.MERGE3.up:271 [JIT compiled]
	at org.jgroups.protocols.Discovery.up:304 [JIT compiled]
	at org.jgroups.protocols.TP.passMessageUp:1126 [JIT compiled]
	at org.jgroups.util.SubmitToThreadPool$SingleMessageHandler.run:105 [JIT compiled]
	at java.util.concurrent.ThreadPerTaskExecutor$TaskRunner.run:314 [JIT compiled]
	at java.lang.Thread.runWith:1596 [Inlined]
	at java.lang.VirtualThread.run:309 [JIT compiled]
	at java.lang.VirtualThread$VThreadContinuation$1.run:190 [JIT compiled]
	at jdk.internal.vm.Continuation.enter0:320 [Inlined]
	at jdk.internal.vm.Continuation.enter:312 [JIT compiled]
	at jdk.internal.vm.Continuation.enterSpecial:-1 [Native]

  - [5,528,805 times]:
org.infinispan.protostream.impl.jfr.JfrEventPublisher.bufferAllocateEvent:15 [Inlined]
	at org.infinispan.protostream.impl.RandomAccessOutputStreamImpl.toByteArray:110 [Inlined]
	at org.infinispan.protostream.ProtobufUtil.toWrappedByteArray:150 [Inlined]
	at org.infinispan.protostream.ProtobufUtil.toWrappedByteArray:144 [Inlined]
	at org.infinispan.encoding.ProtostreamTranscoder.marshall:116 [Inlined]
	at org.infinispan.encoding.ProtostreamTranscoder.doTranscode:73 [JIT compiled]
	at org.infinispan.commons.dataconversion.AbstractTranscoder.transcode:62 [Interpreted]
	at org.infinispan.encoding.DataConversion.toStorage:96 [Interpreted]
	at org.infinispan.cache.impl.EncoderCache.keyToStorage:105 [Interpreted]
	at org.infinispan.cache.impl.EncoderCache.get:675 [Interpreted]
	at org.cache.impl.InfinispanCache.get:45 [Interpreted]
	at org.perf.Test$CacheInvoker.run:971 [Interpreted]
	at java.lang.Thread.runWith:1596 [JIT compiled]
	at java.lang.VirtualThread.run:309 [Interpreted]
	at java.lang.VirtualThread$VThreadContinuation$1.run:190 [Interpreted]
	at jdk.internal.vm.Continuation.enter0:320 [Interpreted]
	at jdk.internal.vm.Continuation.enter:312 [Interpreted]
	at jdk.internal.vm.Continuation.enterSpecial:-1 [Native]

  - [1,215,351 times]:
org.infinispan.protostream.impl.jfr.JfrEventPublisher.allocateEvent:8 [JIT compiled]
	at org.infinispan.protostream.impl.jfr.JfrEventPublisher.intBufferAllocateEvent:20 [Inlined]
	at org.infinispan.protostream.impl.TagWriterImpl$ChildOutputStreamRandomAccessEncoder.subEncoder:1441 [Inlined]
	at org.infinispan.protostream.impl.TagWriterImpl.subWriter:254 [JIT compiled]
	at org.infinispan.protostream.WrappedMessage.writeCustomObject:326 [JIT compiled]
	at org.infinispan.protostream.WrappedMessage.writeMessage:258 [Inlined]
	at org.infinispan.protostream.WrappedMessage.write:251 [Inlined]
	at org.infinispan.protostream.ProtobufUtil.toWrappedStream:160 [Inlined]
	at org.infinispan.marshall.protostream.impl.AbstractInternalProtoStreamMarshaller.objectToOutputStream:67 [JIT compiled]
	at org.infinispan.marshall.protostream.impl.AbstractInternalProtoStreamMarshaller.objectToBuffer:90 [JIT compiled]
	at org.infinispan.marshall.protostream.impl.GlobalMarshaller.objectToBuffer:71 [JIT compiled]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.marshallRequest:1196 [Interpreted]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.sendCommand:1400 [Interpreted]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.sendToMany:317 [Interpreted]
	at org.infinispan.remoting.rpc.RpcManagerImpl.sendToMany:403 [Interpreted]
	at org.infinispan.interceptors.distribution.TriangleDistributionInterceptor.sendToBackups:521 [Interpreted]
	at org.infinispan.interceptors.distribution.TriangleDistributionInterceptor.lambda$remotePrimaryOwnerWrite$5:502 [Interpreted]
	at org.infinispan.interceptors.distribution.TriangleDistributionInterceptor$$Lambda+0x00007f50c051fab8.2142762596.apply:-1 [Interpreted]
	at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNextThenApply:85 [JIT compiled]
	at org.infinispan.interceptors.distribution.TriangleDistributionInterceptor.remotePrimaryOwnerWrite:489 [Interpreted]
	at org.infinispan.interceptors.distribution.TriangleDistributionInterceptor.handleSingleKeyWriteCommand:414 [Inlined]
	at org.infinispan.interceptors.distribution.TriangleDistributionInterceptor.visitPutKeyValueCommand:115 [JIT compiled]
	at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor:113 [Inlined]
	at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNext:58 [Inlined]
	at org.infinispan.interceptors.BaseAsyncInterceptor.asyncInvokeNext:231 [Inlined]
	at org.infinispan.interceptors.impl.EntryWrappingInterceptor.setSkipRemoteGetsAndInvokeNextForDataCommand:732 [Inlined]
	at org.infinispan.interceptors.impl.EntryWrappingInterceptor.visitPutKeyValueCommand:335 [JIT compiled]
	at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor:113 [JIT compiled]
	at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNextAndFinally:154 [Interpreted]
	at org.infinispan.interceptors.locking.AbstractLockingInterceptor.lambda$nonTxLockAndInvokeNext$3:318 [Interpreted]
	at org.infinispan.interceptors.locking.AbstractLockingInterceptor$$Lambda+0x00007f50c051e6c0.2012015600.apply:-1 [Interpreted]
	at org.infinispan.interceptors.SyncInvocationStage.andHandle:71 [Interpreted]
	at org.infinispan.interceptors.locking.AbstractLockingInterceptor.nonTxLockAndInvokeNext:313 [Interpreted]
	at org.infinispan.interceptors.locking.AbstractLockingInterceptor.visitNonTxDataWriteCommand:138 [Inlined]
	at org.infinispan.interceptors.locking.NonTransactionalLockingInterceptor.visitDataWriteCommand:41 [Inlined]
	at org.infinispan.interceptors.locking.AbstractLockingInterceptor.visitPutKeyValueCommand:82 [JIT compiled]
	at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor:113 [Inlined]
	at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNext:58 [JIT compiled]
	at org.infinispan.statetransfer.StateTransferInterceptor.handleNonTxWriteCommand:309 [Inlined]
	at org.infinispan.statetransfer.StateTransferInterceptor.handleWriteCommand:256 [Inlined]
	at org.infinispan.statetransfer.StateTransferInterceptor.visitPutKeyValueCommand:96 [JIT compiled]
	at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor:113 [Inlined]
	at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNext:58 [Inlined]
	at org.infinispan.interceptors.impl.CacheMgmtInterceptor.updateStoreStatistics:233 [Inlined]
	at org.infinispan.interceptors.impl.CacheMgmtInterceptor.visitPutKeyValueCommand:196 [JIT compiled]
	at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor:113 [Inlined]
	at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNext:58 [Inlined]
	at org.infinispan.interceptors.DDAsyncInterceptor.handleDefault:54 [Inlined]
	at org.infinispan.interceptors.DDAsyncInterceptor.visitPutKeyValueCommand:60 [JIT compiled]
	at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor:113 [Inlined]
	at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNextAndExceptionally:127 [Inlined]
	at org.infinispan.interceptors.impl.InvocationContextInterceptor.visitCommand:90 [JIT compiled]
	at org.infinispan.interceptors.impl.AsyncInterceptorChainImpl.invokeAsync:211 [Interpreted]
	at org.infinispan.commands.VisitableCommand.invokeAsync:38 [Interpreted]
	at org.infinispan.remoting.inboundhandler.BasePerCacheInboundInvocationHandler.invokeCommand:95 [Interpreted]
	at org.infinispan.remoting.inboundhandler.BaseBlockingRunnable.invoke:111 [Interpreted]
	at org.infinispan.remoting.inboundhandler.BaseBlockingRunnable.runAsync:79 [Interpreted]
	at org.infinispan.remoting.inboundhandler.BaseBlockingRunnable.run:48 [Interpreted]
	at org.infinispan.remoting.inboundhandler.TrianglePerCacheInboundInvocationHandler.handleDefaultCommand:96 [Interpreted]
	at org.infinispan.remoting.inboundhandler.TrianglePerCacheInboundInvocationHandler.handle:65 [Interpreted]
	at org.infinispan.remoting.inboundhandler.GlobalInboundInvocationHandler.handleCacheRpcCommand:121 [Interpreted]
	at org.infinispan.remoting.inboundhandler.GlobalInboundInvocationHandler.handleFromCluster:74 [Interpreted]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.processRequest:1538 [Interpreted]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.processMessage:1462 [Interpreted]

  - [20,904 times]:
org.infinispan.protostream.impl.jfr.JfrEventPublisher.bufferAllocateEvent:15 [Interpreted]
	at org.infinispan.protostream.impl.TagReaderImpl$ByteArrayDecoder.readRawByteArray:644 [Interpreted]
	at org.infinispan.protostream.impl.TagReaderImpl.readByteArray:181 [Interpreted]
	at org.infinispan.util.ByteString$___Marshaller_8e599c0fc1e9a512b7cdb7c05fb5529744ecac265708e69fd30c5e989237252a.read:39 [Interpreted]
	at org.infinispan.util.ByteString$___Marshaller_8e599c0fc1e9a512b7cdb7c05fb5529744ecac265708e69fd30c5e989237252a.read:13 [Interpreted]
	at org.infinispan.protostream.impl.ProtobufTagMarshallerDelegate.unmarshall:33 [Interpreted]
	at org.infinispan.protostream.GeneratedMarshallerBase.readMessage:22 [Interpreted]
	at org.infinispan.commands.triangle.SingleKeyBackupWriteCommand$___Marshaller_3f5a0bfd78cc229ce9389de39402811ec2d2daaca7159b654b3845be8d043c89.read:66 [Interpreted]
	at org.infinispan.commands.triangle.SingleKeyBackupWriteCommand$___Marshaller_3f5a0bfd78cc229ce9389de39402811ec2d2daaca7159b654b3845be8d043c89.read:13 [Interpreted]
	at org.infinispan.protostream.impl.ProtobufTagMarshallerDelegate.unmarshall:33 [Interpreted]
	at org.infinispan.protostream.WrappedMessage.readCustomObject:596 [Interpreted]
	at org.infinispan.protostream.WrappedMessage.readMessage:420 [Interpreted]
	at org.infinispan.protostream.WrappedMessage.read:410 [Interpreted]
	at org.infinispan.protostream.ProtobufUtil.fromWrappedByteArray:131 [Interpreted]
	at org.infinispan.marshall.protostream.impl.AbstractInternalProtoStreamMarshaller.objectFromByteBuffer:132 [Interpreted]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.processRequest:1524 [Interpreted]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.processMessage:1462 [Interpreted]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport$ChannelCallbacks.lambda$up$0:1649 [Interpreted]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport$ChannelCallbacks$$Lambda+0x00007f50c04e6450.916274499.accept:-1 [Interpreted]
	at java.lang.Iterable.forEach:75 [JIT compiled]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport$ChannelCallbacks.up:1641 [Interpreted]
	at org.jgroups.JChannel.up:694 [Interpreted]
	at org.jgroups.stack.ProtocolStack.up:941 [Interpreted]
	at org.jgroups.protocols.FRAG2.up:159 [Interpreted]
	at org.jgroups.protocols.FlowControl.up:318 [Interpreted]
	at org.jgroups.protocols.FlowControl.up:318 [Interpreted]
	at org.jgroups.protocols.pbcast.GMS.up:813 [Interpreted]
	at org.jgroups.protocols.pbcast.STABLE.up:255 [Interpreted]
	at org.jgroups.protocols.UNICAST3.deliverBatch:1196 [Interpreted]
	at org.jgroups.protocols.UNICAST3.handleBatchReceived:959 [Interpreted]
	at org.jgroups.protocols.UNICAST3.up:587 [Interpreted]
	at org.jgroups.protocols.pbcast.NAKACK2.up:686 [Interpreted]
	at org.jgroups.protocols.VERIFY_SUSPECT2.up:118 [Interpreted]
	at org.jgroups.protocols.FailureDetection.up:194 [Interpreted]
	at org.jgroups.protocols.FD_SOCK2.up:204 [Interpreted]
	at org.jgroups.protocols.MERGE3.up:285 [Interpreted]
	at org.jgroups.protocols.Discovery.up:324 [Interpreted]
	at org.jgroups.protocols.TP.passBatchUp:1163 [Interpreted]
	at org.jgroups.util.SubmitToThreadPool$BatchHandler.passBatchUp:147 [Interpreted]
	at org.jgroups.util.SubmitToThreadPool$BatchHandler.run:143 [Interpreted]
	at java.util.concurrent.ThreadPerTaskExecutor$TaskRunner.run:314 [Interpreted]
	at java.lang.Thread.runWith:1596 [Inlined]
	at java.lang.VirtualThread.run:309 [JIT compiled]
	at java.lang.VirtualThread$VThreadContinuation$1.run:190 [JIT compiled]
	at jdk.internal.vm.Continuation.enter0:320 [Inlined]
	at jdk.internal.vm.Continuation.enter:312 [JIT compiled]
	at jdk.internal.vm.Continuation.enterSpecial:-1 [Native]

  - [5,316 times]:
org.infinispan.protostream.impl.jfr.JfrEventPublisher.allocateEvent:8 [Interpreted]
	at org.infinispan.protostream.impl.jfr.JfrEventPublisher.intBufferAllocateEvent:20 [Interpreted]
	at org.infinispan.protostream.impl.TagWriterImpl$ChildOutputStreamRandomAccessEncoder.subEncoder:1441 [Interpreted]
	at org.infinispan.protostream.impl.TagWriterImpl.subWriter:254 [Interpreted]
	at org.infinispan.protostream.WrappedMessage.writeCustomObject:326 [Interpreted]
	at org.infinispan.protostream.WrappedMessage.writeMessage:258 [Interpreted]
	at org.infinispan.protostream.WrappedMessage.write:251 [Interpreted]
	at org.infinispan.protostream.ProtobufUtil.toWrappedStream:160 [Interpreted]
	at org.infinispan.marshall.protostream.impl.AbstractInternalProtoStreamMarshaller.objectToOutputStream:67 [Interpreted]
	at org.infinispan.marshall.protostream.impl.AbstractInternalProtoStreamMarshaller.objectToBuffer:90 [Interpreted]
	at org.infinispan.marshall.protostream.impl.GlobalMarshaller.objectToBuffer:71 [Interpreted]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.marshallRequest:1196 [Interpreted]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.sendCommand:1400 [Interpreted]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.sendToMany:317 [Interpreted]
	at org.infinispan.remoting.rpc.RpcManagerImpl.sendToMany:403 [Interpreted]
	at org.infinispan.interceptors.distribution.TriangleDistributionInterceptor.sendToBackups:521 [Interpreted]
	at org.infinispan.interceptors.distribution.TriangleDistributionInterceptor.lambda$remotePrimaryOwnerWrite$5:502 [Interpreted]
	at org.infinispan.interceptors.distribution.TriangleDistributionInterceptor$$Lambda+0x00007f50c051fab8.2142762596.apply:-1 [Interpreted]
	at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNextThenApply:85 [Interpreted]
	at org.infinispan.interceptors.distribution.TriangleDistributionInterceptor.remotePrimaryOwnerWrite:489 [Interpreted]
	at org.infinispan.interceptors.distribution.TriangleDistributionInterceptor.handleSingleKeyWriteCommand:414 [Interpreted]
	at org.infinispan.interceptors.distribution.TriangleDistributionInterceptor.visitPutKeyValueCommand:115 [Interpreted]
	at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor:113 [Interpreted]
	at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNext:58 [JIT compiled]
	at org.infinispan.interceptors.BaseAsyncInterceptor.asyncInvokeNext:231 [Interpreted]
	at org.infinispan.interceptors.impl.EntryWrappingInterceptor.setSkipRemoteGetsAndInvokeNextForDataCommand:732 [Interpreted]
	at org.infinispan.interceptors.impl.EntryWrappingInterceptor.visitPutKeyValueCommand:335 [Interpreted]
	at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor:113 [Interpreted]
	at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNextAndFinally:154 [Interpreted]
	at org.infinispan.interceptors.locking.AbstractLockingInterceptor.lambda$nonTxLockAndInvokeNext$3:318 [Interpreted]
	at org.infinispan.interceptors.locking.AbstractLockingInterceptor$$Lambda+0x00007f50c051e6c0.2012015600.apply:-1 [Interpreted]
	at org.infinispan.interceptors.SyncInvocationStage.andHandle:71 [Interpreted]
	at org.infinispan.interceptors.locking.AbstractLockingInterceptor.nonTxLockAndInvokeNext:313 [Interpreted]
	at org.infinispan.interceptors.locking.AbstractLockingInterceptor.visitNonTxDataWriteCommand:138 [Interpreted]
	at org.infinispan.interceptors.locking.NonTransactionalLockingInterceptor.visitDataWriteCommand:41 [Interpreted]
	at org.infinispan.interceptors.locking.AbstractLockingInterceptor.visitPutKeyValueCommand:82 [Interpreted]
	at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor:113 [Interpreted]
	at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNext:58 [JIT compiled]
	at org.infinispan.statetransfer.StateTransferInterceptor.handleNonTxWriteCommand:309 [Interpreted]
	at org.infinispan.statetransfer.StateTransferInterceptor.handleWriteCommand:256 [Interpreted]
	at org.infinispan.statetransfer.StateTransferInterceptor.visitPutKeyValueCommand:96 [Interpreted]
	at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor:113 [Interpreted]
	at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNext:58 [JIT compiled]
	at org.infinispan.interceptors.impl.CacheMgmtInterceptor.updateStoreStatistics:233 [Interpreted]
	at org.infinispan.interceptors.impl.CacheMgmtInterceptor.visitPutKeyValueCommand:196 [Interpreted]
	at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor:113 [Interpreted]
	at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNext:58 [JIT compiled]
	at org.infinispan.interceptors.DDAsyncInterceptor.handleDefault:54 [Interpreted]
	at org.infinispan.interceptors.DDAsyncInterceptor.visitPutKeyValueCommand:60 [Interpreted]
	at org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor:113 [Interpreted]
	at org.infinispan.interceptors.BaseAsyncInterceptor.invokeNextAndExceptionally:127 [Interpreted]
	at org.infinispan.interceptors.impl.InvocationContextInterceptor.visitCommand:90 [Interpreted]
	at org.infinispan.interceptors.impl.AsyncInterceptorChainImpl.invokeAsync:211 [Interpreted]
	at org.infinispan.commands.VisitableCommand.invokeAsync:38 [Interpreted]
	at org.infinispan.remoting.inboundhandler.BasePerCacheInboundInvocationHandler.invokeCommand:95 [Interpreted]
	at org.infinispan.remoting.inboundhandler.BaseBlockingRunnable.invoke:111 [Interpreted]
	at org.infinispan.remoting.inboundhandler.BaseBlockingRunnable.runAsync:79 [Interpreted]
	at org.infinispan.remoting.inboundhandler.BaseBlockingRunnable.run:48 [Interpreted]
	at org.infinispan.remoting.inboundhandler.TrianglePerCacheInboundInvocationHandler.handleDefaultCommand:96 [Interpreted]
	at org.infinispan.remoting.inboundhandler.TrianglePerCacheInboundInvocationHandler.handle:65 [Interpreted]
	at org.infinispan.remoting.inboundhandler.GlobalInboundInvocationHandler.handleCacheRpcCommand:121 [Interpreted]
	at org.infinispan.remoting.inboundhandler.GlobalInboundInvocationHandler.handleFromCluster:74 [Interpreted]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.processRequest:1538 [Interpreted]
	at org.infinispan.remoting.transport.jgroups.JGroupsTransport.processMessage:1462 [Interpreted]


=========================================================

@wburns
Copy link
Member

wburns commented Sep 11, 2025

I think it might be useful to put the script somewhere. My only complaint is technically don't we have this with JFR/async profiler when tracking allocations? I am trying to think when I would use this over that.

@jabolina
Copy link
Member Author

I see. I think allocation with JFR/async-profiler would be generalized to the whole JVM. You should then be able to filter out when generating the flamegraph. I guess the flamegraph would be larger in places where it has more allocations? I am not sure if it exposes the allocation size (you can set a minimum size in asprof). And it wouldn't distinguish between allocating or resizing a buffer either. All in all, I guess this provides a little more specific info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Include JFR events for buffer allocation

3 participants