[Gluster-devel] FreeBSD port of GlusterFS racks up a lot of CPU usage

Niels de Vos ndevos at redhat.com
Wed Dec 30 10:31:52 UTC 2015

On Tue, Dec 29, 2015 at 08:12:40PM -0500, Rick Macklem wrote:
> Hi,
> I'm been playing with the FreeBSD port of GlusterFS and it seems
> to be working ok. I do notice that the daemons use a lot of CPU,
> even when there is nothing to do (no volumes started, etc).
> When I ktrace the daemon, I see a small number of nanosleep() and
> select() syscalls and lots of poll() syscalls (close to 1000/sec).
> Looking at libglusterfs/src/event-poll.c, I find:
>    ret = poll(ufds, size, 1);
> in a loop. The only thing the code seems to do when poll() times
> out is a call to event_dispatch_poll_resize().
> So, is it necessary to call event_dispatch_poll_resize() 1000 times
> per second?
> Or is there a way to make event_dispatch_poll_resize() return quickly
> when there is nothing to do?

I do not think this is critical. A longer timeout should be well

> I'm guessing that Linux uses the event-epoll stuff instead of event-poll,
> so it wouldn't exhibit this. Is that correct?

Well, both. most (if not all) Linux builds will use event-poll. But,
that calls epoll_wait() with a timeout of 1 millisecond as well.

> Thanks for any information on this, rick
> ps: I am tempted to just crank the timeout of 1msec up to 10 or 20msec.

Yes, that is probably what I would do too. And have both poll functions
use the same timeout, have it defined in libglusterfs/src/event.h. We
could make it a configurable option too, but I do not think it is very
useful to have.

Could you file a bug and/or send a patch for this?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://www.gluster.org/pipermail/gluster-devel/attachments/20151230/77599efa/attachment.sig>

More information about the Gluster-devel mailing list