[Koha-bugs] [Bug 22417] Add a task queue

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Oct 7 05:21:36 CEST 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22417

--- Comment #323 from David Cook <dcook at prosentient.com.au> ---
Reading through
http://erlang.org/pipermail/erlang-questions/2015-September/085799.html took me
to
https://github.com/erlang/otp/blob/master/erts/lib_src/pthread/ethr_event.c#L65-L161

There are the futex and monotonic time gets I reckon. And maybe the scheduler
event loop:
https://github.com/erlang/otp/blob/master/erts/emulator/beam/erl_process.c#L3347

I tried adding "+scl false" to see if that would reduce the load generated
while waiting, but no change. 

I'm half tempted to use "+S" to limit the number of schedulers created, which
seems equivalent to Go's GOMAXPROCS, but I doubt it's worth fiddling too much. 

This is a topic that I've encountered when writing my own schedulers and
reading about Go's scheduler(s). Unless you sleep, you're going to generate
some load, as you're constantly checking if you have work to do. Of course, if
you sleep, then you create a chance for latency. Although I think most
schedulers check for I/O and timers, and (micro) sleep if there's no I/O, no
timer, and no work to do. 

If you do a strace gainst Apache httpd, you'll see that it's using a
select(null, null, null, 1) as an alternative to sleep (like the one mentioned
in Perl at https://perldoc.perl.org/functions/select).

An alternative to select would be to use epoll (which Erlang does use although
with a 0 second timeout), but it seems like Erlang instead does some other work
while waiting for work. I'm not an expert on programming language internals
especially not ones with focuses on concurrency.

Anyway, I don't think RabbitMQ using some system resources is a big drama.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list