HomePhabricator

http: speed up shutdown
a264c32e3321Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

http: speed up shutdown

This continues/fixes #6719.

event_base_loopbreak was not doing what I expected it to, at least in
libevent 2.0.21.
What I expected was that it sets a timeout, given that no other pending
events it would exit in N seconds. However, what it does was delay the
event loop exit with 10 seconds, even if nothing is pending.

Solve it in a different way: give the event loop thread time to exit
out of itself, and if it doesn't, send loopbreak.

This speeds up the RPC tests a lot, each exit incurred a 10 second
overhead, with this change there should be no shutdown overhead in the
common case and up to two seconds if the event loop is blocking.

As a bonus this breaks dependency on boost::thread_group, as the HTTP
server minds its own offspring.

Details

Provenance
Wladimir J. van der Laan <laanwj@gmail.com>Authored on Nov 11 2015, 16:34
deadalnixPushed on May 14 2017, 22:04
Parents
rABC3ac70609345a: Merge pull request #6978
Branches
Unknown
Tags
Unknown

Event Timeline

Wladimir J. van der Laan <laanwj@gmail.com> committed rABCa264c32e3321: http: speed up shutdown (authored by Wladimir J. van der Laan <laanwj@gmail.com>).Nov 13 2015, 10:10