4 Replies Latest reply on Sep 1, 2014 5:09 AM by infinispan user

    More CPU Utilization

    infinispan user Newbie

      Hi all,

           I am running infinispan in embedded with distribution mode(3 nodes).With infinispan integration i am getting more cpu utilization(nearly 20 times more) than the without Infinispan.

      hprof reference

      ===========

      CPU TIME (ms) BEGIN (total = 206851744)

      rank   self  accum   count trace method

         1 61.48% 61.48%  124327 343962 java.util.concurrent.locks.LockSupport.parkNanos

         2 18.06% 79.54%   13118 336943 java.util.concurrent.locks.LockSupport.park

         3  2.66% 82.20%    1395 372873 java.util.concurrent.locks.LockSupport.park

         4  2.31% 84.51%    3219 366886 java.net.SocketInputStream.read

         5  2.31% 86.83%    3603 367136 java.util.concurrent.locks.LockSupport.park

         6  1.24% 88.07%    3137 345644 java.lang.Object.wait

         7  1.24% 89.30%   12735 334908 java.util.concurrent.locks.LockSupport.parkNanos

         8  1.22% 90.52%    2575 360649 java.lang.Object.wait

         9  1.22% 91.74%    2576 360762 java.net.SocketInputStream.read

        10  1.22% 92.96%    2528 363747 org.jboss.mq.SpyMessageConsumer.receive

        11  1.22% 94.18%     253 363102 java.net.PlainSocketImpl.accept

        12  1.22% 95.40%      43 360924 EDU.oswego.cs.dl.util.concurrent.ClockDaemon.nextTask

        13  1.22% 96.62%      42 369602 EDU.oswego.cs.dl.util.concurrent.SynchronousChannel.poll

        14  1.16% 97.78%      16 359239 java.lang.ref.ReferenceQueue.remove

        15  1.09% 98.87%       8 374938 java.util.concurrent.locks.LockSupport.park

        16  0.17% 99.04%     115 337048 java.util.concurrent.locks.LockSupport.parkNanos

        17  0.15% 99.19%     802 336976 java.net.PlainSocketImpl.doConnect

        18  0.13% 99.32%     615 336398 java.util.concurrent.locks.LockSupport.park

        19  0.13% 99.45%       2 369061 java.net.PlainSocketImpl.accept

        20  0.13% 99.57%       2 366588 java.net.PlainSocketImpl.accept

        21  0.07% 99.64%       1 374060 java.net.SocketInputStream.read

        22  0.06% 99.71%      36 377230 java.util.concurrent.locks.LockSupport.parkNanos

        23  0.02% 99.73%       2 345400 java.lang.Object.wait

      CPU TIME (ms) END

       

      TRACE 343962:

              java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:Unknown line)

              java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:Unknown line)

              java.util.concurrent.DelayQueue.take(DelayQueue.java:Unknown line)

              java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:Unknown line)

      TRACE 336943:

              java.util.concurrent.locks.LockSupport.park(LockSupport.java:Unknown line)

              java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:Unknown line)

              java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:Unknown line)

              java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:Unknown line)

      TRACE 372873:

              java.util.concurrent.locks.LockSupport.park(LockSupport.java:Unknown line)

              java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:Unknown line)

              java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:Unknown line)

              java.util.concurrent.SynchronousQueue.take(SynchronousQueue.java:Unknown line)

       

      Can any one provide help on this.

      Kindly see the attached configuration documents.

      Thanks.

        • 1. Re: More CPU Utilization
          Radim Vansa Master

          The hprof output says just that there are many threads just waiting for some job/lock: these do not account for CPU utilization. What are you doing with Infinispan exactly? I don't understand the difference 'before' and 'after'.

          • 2. Re: More CPU Utilization
            infinispan user Newbie

            Before means  project without using infinispan..No infinispan at all.Simply i am using ConcurrentHashMap's for storage.

            After means project Merged with infinispan..using distributed cache I am storing in Cache.

            • 3. Re: More CPU Utilization
              Sanne Grinovero Master

              I wouldn't be too surprised, serializing and transmitting each entry as it's updated has a cost.

              You can get a significant benefit from using Infinispan but it depends how you use it, just dropping it in as a replacement for a ConcurrentHashMap might not be a good idea. Generally though if CHM works fine why would you use Infinispan?

              The people move to Infinispan is because the data size gets too large that CHM is no longer an option, or because you need multiple servers to read the same data efficiently - but writes will of course be slower than a CHM.

              • 4. Re: More CPU Utilization
                infinispan user Newbie

                Yes,

                     Storing/retrieving data in  concurrentHashMap is faster because it is available in local..

                But storing/retreiving data in Infinispan Cache is some what costlier Yes I agree...But it should not take 100% cpu right...With local  ConcurrentHashMap it is not taking more than 5%cpu..

                 

                Please provide some solution..