Sorry if this is an obvious question, but I couldn't find an answer elsewhere in the forum or in the docs.
I would like to measure in realtime how long it takes for cache updates (put() and remove()) to actually finish carrying out their synchronization operations with other nodes in the cluster. I know that I can easily measure this for synchronous operations by measuring the time it takes for the put() or remove() to return. But what about for asynchronous operations?
For example, consider a cache configured thus:
<property name="configurationFile" value="infinispan/jgroups-production.xml" />
<property name="threadNamePrefix" value="peopleanswersAsyncTransportExecutor" />
<property name="maxThreads" value="100" />
<stateRetrieval fetchInMemoryState="false" />
When my code calls put(), my understanding is that the cache class returns almost immediately after updating the local cache, and communication of the invalidation to all other caches happens in a background thread. But I would like to measure the time between the start of the initial call to put() all the way to the time that the final invalidation message is sent to the final node in the cluster.
Note that we're currently using TCP/TCPGOSSIP communication in JGroups, if that matters.
Also note that we are not using JTA transactioning at all, so Infinispan is using the DummyTransactionManager, if that is relevant.
Is there some kind of way to measure this in Infinispan? Or is this an impossible task?
Thanks for your help!
That's not how it works. Configuring a cache with async means that the thread will go all the way to the JGroups layer and tell it to send the put() but not wait for any responses. By not waiting for any responses, you're effectively doing fire and forget.
Now, when asyncMarshalling is true, the code behaves the way you say and this can have some nasty side effects as indicated in https://docs.jboss.org/author/display/ISPN/Asynchronous+Options#AsynchronousOptions-AsynchronousMarshalling - This might affect you or might not, depending on the relationship of the data modified.
So, for your timing calculations, with asyncMarshalling disabled, the put call time will measure the time until the message pretty much until the message is sent over the wire. JGroups might do some internal thread work to send this.