1 Reply Latest reply on Oct 10, 2011 6:30 AM by galder.zamarreno

    Measuring cache update latency

    darrellburgan

      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:

       

      {code:xml}

      <global>

                <transport

                          transportClass="org.infinispan.remoting.transport.jgroups.JGroupsTransport"

                          strictPeerToPeer="false"

                          distributedSyncTimeout="240000">

                                    <properties>

                                              <property name="configurationFile" value="infinispan/jgroups-production.xml" />

                                    </properties>

                </transport>

                <asyncTransportExecutor>

                          <properties>

                                    <property name="threadNamePrefix" value="peopleanswersAsyncTransportExecutor" />

                                    <property name="maxThreads" value="100" />

                          </properties>

                </asyncTransportExecutor>

      </global>

      <default>

                <transaction

                          useEagerLocking="false"

                          syncCommitPhase="false"

                          syncRollbackPhase="false"

                          useSynchronization="false"

                          cacheStopTimeout="30000" />

                <locking

                          useLockStriping="false"

                          isolationLevel="READ_COMMITTED"

                          concurrencyLevel="256"

                          lockAcquisitionTimeout="15000"

                          writeSkewCheck="false" />

                <eviction

                          maxEntries="10000"

                          strategy="LIRS" />

                <expiration

                          lifespan="-1"

                          maxIdle="14400000" />

      </default>

      <namedCache name="asyncInvalidationCache">

                <clustering mode="invalidation">

                          <async

                                    asyncMarshalling="false"

                                    useReplQueue="false" />

                          <stateRetrieval fetchInMemoryState="false" />

                </clustering>

      </namedCache>

      {code}

       

      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!

       

      Darrell Burgan

        • 1. Re: Measuring cache update latency
          galder.zamarreno

          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.