3 Replies Latest reply on Mar 25, 2007 9:52 AM by brian.stansberry

    Questions regarding performance of read-only operations

    haviv.rosh

      Hi
      1)I was wondering why read operations - such as POJO aspectized getters and PojoCache.getObject method - have to be so slow ...
      After reviewing the code - it seems that even for Read Only operations there is a Method call to get the data via the JChannel:

       public Node get(Fqn fqn) throws CacheException
       {
       MethodCall m = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal, new Object[]{fqn});
       return (Node) invokeMethod(m);
       }
      

      I was wondering what is the reason for doing that ?
      After all cache is read-mostly and read operations should as fast as regular direct method calls.

      2)Another question is - Are there any optimizations if the cluster member size is 0 ? (I didn't see any - although in the JGroups Distributed map examples there are)
      If there are no members on the channel why do so much work ?

        • 1. Re: Questions regarding performance of read-only operations
          genman

          The calls are made using reflection. The call does not go to the JChannel for local caches.

          If you want to find performance issues, I suggest you use a profiler.

          • 2. Re: Questions regarding performance of read-only operations
            haviv.rosh

            OK, so no channel calls are involved, but reflection call on every
            getter I call ? Why ?
            Second- You are right about the profiling part - I will profile it too, I just compared simple pojo getters against aspectized pojo getter and the results were pretty surprising ....

            • 3. Re: Questions regarding performance of read-only operations
              brian.stansberry

              All cache operations move through an interceptor stack that handles aspects like locking, transaction management, and interactions with cache loaders. Replication is just one of those aspects; if the cache is in LOCAL mode the other aspects still have to be properly handled.

              An interceptor-based architecture involves an object that carries the invocation through the interceptor stack. In JBoss Cache this object is a MethodCall. Use of that particular class, with its roots in JGroups, is largely a result of JBoss Cache's historical roots. Using that class is a bit conceptually messy, but if we switched to some other class, it would have to perform the same functions MethodCall does.