nickva opened a new pull request, #5890:
URL: https://github.com/apache/couchdb/pull/5890
When debugging processes getting stuck in hibernation bug [1] a few
benchmarks showed that hibernation can be pretty expensive. I saw 20% or so
reduction in latency in couch_work_queue if we hibernate after every single
item insertion.
Erlang documents warn about this [2]:
> Use this feature with care, as hibernation implies at least two garbage
collections (when hibernating and shortly after waking up) and is not something
you want to do between each call to a busy server.
In a few places like the `couch_work_queue` and `couch_db_updater` we did
exactly that [3]. However, since we added that more Erlang/OTP implemented a
new `gen_server` option - `{hibernate_after, Timeout}`. It will trigger
hibernation after an idle time. That seems ideal for us - it keeps expensive
hibernation out of the main data path, as docs warn us about, but once the
server goes idle we still get to run it to dereference any ref binaries.
Since we encountered the recent hibernation bug [1] also add an option to
disable it altogether, just to have a way to mitigate the issue when running on
OTP 27 and 28 before the fix is out.
As a separate commit also fix `get_integer_or_infinity/3` to handle an
explicitly configured "infinity" value.
[1] https://github.com/erlang/otp/issues/10651
[2] https://www.erlang.org/doc/apps/stdlib/gen_server.html
[3]
https://github.com/apache/couchdb/commit/d9eb87f60ac8328afcca25cf6c7aae53b395b089
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]