[erlang-questions] Why does an idle erlang process (couchdb, to be precise) call epoll_wait so often?

Jann Horn jann@REDACTED
Wed May 22 13:09:28 CEST 2013


This is strace output from a totally idle couchdb process:

[pid 18350] 17:40:15.086577 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.086610 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.086643 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.086675 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.086736 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.086771 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.086940 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.087180 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.087219 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.087251 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.087287 epoll_wait(3, {}, 256, 228) = 0
[pid 18350] 17:40:15.315646 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.315718 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.315751 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.315800 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.315833 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.315865 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.315900 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.315953 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.315992 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.316081 epoll_wait(3, {}, 256, 651) = 0
[pid 18350] 17:40:15.967979 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.969211 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.969926 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.970484 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.970616 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.970717 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.970806 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.970895 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.970983 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.971071 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.971158 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.971243 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:15.971343 epoll_wait(3, {}, 256, 345) = 0
[pid 18350] 17:40:16.316908 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:16.317266 epoll_wait(3, {}, 256, 650) = 0
[pid 18350] 17:40:16.969333 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:16.970057 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:16.970580 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:16.970736 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:16.970827 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:16.970917 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:16.971011 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:16.971118 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:16.971206 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:16.971300 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:16.971386 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:16.971485 epoll_wait(3, {}, 256, 115) = 0
[pid 18350] 17:40:17.087042 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:17.087421 accept(10, 0x7fb208dbfba0, [28]) = -1 EAGAIN (Resource temporarily unavailable)
[pid 18350] 17:40:17.087915 epoll_ctl(3, EPOLL_CTL_DEL, 10, {EPOLLIN, {u32=10, u64=73199780460757002}}) = 0
[pid 18350] 17:40:17.088035 epoll_ctl(3, EPOLL_CTL_ADD, 10, {EPOLLIN, {u32=10, u64=73199780460757002}}) = 0
[pid 18350] 17:40:17.088139 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:17.088231 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:17.088327 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:17.088477 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:17.088565 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:17.088660 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:17.088746 epoll_wait(3, {}, 256, 0) = 0
[pid 18350] 17:40:17.088833 epoll_wait(3, {}, 256, 0) = 0

This seems to be, at least partly, intentional – erts/emulator/beam/erl_process.c
contains a constant named "ERTS_SCHED_SYS_SLEEP_SPINCOUNT" which is set to 10.

Can anyone tell me what the rationale behind this excessive busylooping is? A few
dozen syscalls per second for nothing seems a bit weird to me.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130522/07cc99c3/attachment.bin>


More information about the erlang-questions mailing list