3 Replies Latest reply on Feb 23, 2006 12:31 PM by Ben Wang

    TreeCacheAOP Get Performance

    Joe Reger Newbie

      Hi all!

      I'm using TreeCacheAOP in a webapp. It successfully transmits objects over the network and shares them with other app servers. Excellent!

      But performance has been slower than expected (but I'm not pointing fingers here... just looking for some help). I'm using CacheMode=REPL_ASYNC, IsolationLevel=NONE and UseReplQueue=TRUE to increase performance. It is faster, but still slower than expected.

      A dynamic page that normally takes 25ms to load (with a simple in-memory cache) now takes about 230ms. A tenfold increase.

      I profiled the app with jProfiler and things like org.jboss.aop.joinpoint.FieldReadInvocation.invokeNext are called any time I get a property on one of the cached objects. I notice things in my classpath like MyObject.myprop$myprop_Get which are certainly generated by the AOP process.

      I'm using this statement to prepare the objects:

      And org.jboss.aop.ant.AopC to do the intrumentation. I'm running Java 5.0 with 5.0-style annotations.

      My question: is there any way to prepare the objects so that the jboss cache overhead is not triggered on property gets? I understand that the cache must be updated any time I set a property, but this performance for gets seems a little slow and I'm not sure what it's doing... since I'm running in REPL_ASYNC mode I assumed that it wouldn't have to do much on the get.

      I'm not sure whether this is an AOP performance issue, user error (me) or something in jbosscache. The functionality is exactly what I need but performance may be an issue if I can't overcome this.

      Thanks for any insight you can offer,


        • 1. Re: TreeCacheAOP Get Performance
          Ben Wang Master

          The first question is how do you the TreeCacheAop? Do you use putObject() inside your session for every request? If it is, this may be the problem since it is slow (and should be used only initially).

          Also, if you use web clustering, we will support fine-grained replication in 4.0.4 (using TreecacheAop). It is not yet fully released. But you can give it a try soon.

          • 2. Re: TreeCacheAOP Get Performance
            Joe Reger Newbie

            Hi Ben!

            I'm using a homegrown session manager because I can't set the subdomain cookie scope on Tomcat's sessions (long story). I create a session once and put it into the cache with putObject(). The key I use is a unique string generated from the request (url + subdomain + some other stuff). So on each request I retrieve the session using that key and the getObject() method. The putObject() is not used on every request.

            One thing I've considered is that at least one property is updated on every request. I have a property called UserSession.mostrecentactivity which I update every request so that I can expire sessions properly (sysadmins for our app can set the timeout via the web). My hope was that because of AOP this property update wouldn't cause that much traffic across the wire.

            Of course, the problem I'm seeing isn't network related. It's the performance of the app itself. I've done some testing and the performance degradation seems to relate to how many times I read a property from the object that was cached... even after I've retrieved the object from the cache into local memory.

            For example, if I pull a UserSession from the cache and then use the getFoo() method to access the foo String 1000 times the app is a lot slower than if i had only accessed the foo String 10 times. In other words, because of AOP the performance of simple property gets is degraded.

            Watching the profiler it seems that there is some jbosscache code that is called by AOP each time that I do a property get call. This doesn't make sense to me. I understand that jbosscache needs to know about property puts/updates because it needs to replicate those changes across the cache. But I don't understand why org.jboss.aop.joinpoint.FieldReadInvocation.invokeNext is called on gets.

            Question: is there a way to tell AOP to not worry about property gets and only notify jbosscache of property puts/updates?

            The good news is that TreeCacheAOP is working as advertised. Now it's just a matter of tweaking the performance for my particular app. I appreciate your help and look forward to running our cluster on TreeCacheAOP! (Looking forward to your training session on webapp clustering next week.)



            • 3. Re: TreeCacheAOP Get Performance
              Ben Wang Master

              Ok, it is diffcult for me to see now because I have run some profiling myself last week and I didn't see it. Which version of JBossCache you are using?