Riak Java client 100% CPU

Brian Roach roach at basho.com
Thu Feb 14 12:22:18 EST 2013


Daniel -

Yes, sorry about that. This has been corrected in the current master
on github and version 1.1.0 of the client will be released today.
https://github.com/basho/riak-java-client/pull/212

Thanks!
Brian Roach

On Thu, Feb 14, 2013 at 9:31 AM, Daniel Iwan <iwan.daniel at gmail.com> wrote:
> I see 100% CPU very regularly on one of the Riak client (v1.0.7) threads.
> I think the place where it spins is connection reaper in RiakConnectionPool
>
> I looked at it briefly and it seems that when it finds first connection
> using peek but that does not expired it can spin in tight while loop.
> I guess second peek() should be outside if block?
>
>     private synchronized void doStart() {
>         if (idleConnectionTTLNanos > 0) {
>             idleReaper.scheduleWithFixedDelay(new Runnable() {
>                 public void run() {
>                     RiakConnection c = available.peek();
>                     while (c != null) {
>                         long connIdleStartNanos = c.getIdleStartTimeNanos();
>                         if (connIdleStartNanos + idleConnectionTTLNanos <
> System.nanoTime()) {
>                             if (c.getIdleStartTimeNanos() ==
> connIdleStartNanos) {
>                                 // still a small window, but better than
> locking
>                                 // the whole pool
>                                 boolean removed = available.remove(c);
>                                 if (removed) {
>                                     c.close();
>                                     permits.release();
>                                 }
>                             }
>                             c = available.peek();
>                         }
>                     }
>                 }
>             }, idleConnectionTTLNanos, idleConnectionTTLNanos,
> TimeUnit.NANOSECONDS);
>         }
>
>         state = State.RUNNING;
>     }
>
>
> Regards
> Daniel Iwan
>
>
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>




More information about the riak-users mailing list