commit d690cac08ca0f6c18518e7760d8bdcfd14cdee84
Author: John Eckersberg <email address hidden>
Date: Fri Oct 14 11:02:47 2016 -0400
rabbit: Avoid busy loop on epoll_wait with heartbeat+eventlet
Calling threading.Event.wait() when using eventlet results in a busy
loop calling epoll_wait, because the Python 2.x
threading.Condition.wait() implementation busy-waits by calling
sleep() with very small values (0.0005..0.05s). Because sleep() is
monkey-patched by eventlet, this results in many very short timers
being added to the eventlet hub, and forces eventlet to constantly
epoll_wait looking for new data unecessarily.
This utilizes a new Event from eventletutils which conditionalizes the
event primitive depending on whether or not eventlet is being used.
If it is, eventlet.event.Event is used instead of threading.Event.
The eventlet.event.Event implementation does not suffer from the same
busy-wait sleep problem. If eventlet is not used, the previous
behavior is retained.
For Newton backport, this bundles the Event from eventletutils
directly in oslo.messaging under the _utils module. It is taken from:
Reviewed: https:/ /review. openstack. org/395018 /git.openstack. org/cgit/ openstack/ oslo.messaging/ commit/ ?id=d690cac08ca 0f6c18518e7760d 8bdcfd14cdee84
Committed: https:/
Submitter: Jenkins
Branch: stable/mitaka
commit d690cac08ca0f6c 18518e7760d8bdc fd14cdee84
Author: John Eckersberg <email address hidden>
Date: Fri Oct 14 11:02:47 2016 -0400
rabbit: Avoid busy loop on epoll_wait with heartbeat+eventlet
Calling threading. Event.wait( ) when using eventlet results in a busy Condition. wait() implementation busy-waits by calling
loop calling epoll_wait, because the Python 2.x
threading.
sleep() with very small values (0.0005..0.05s). Because sleep() is
monkey-patched by eventlet, this results in many very short timers
being added to the eventlet hub, and forces eventlet to constantly
epoll_wait looking for new data unecessarily.
This utilizes a new Event from eventletutils which conditionalizes the event.Event is used instead of threading.Event. event.Event implementation does not suffer from the same
event primitive depending on whether or not eventlet is being used.
If it is, eventlet.
The eventlet.
busy-wait sleep problem. If eventlet is not used, the previous
behavior is retained.
For Newton backport, this bundles the Event from eventletutils
directly in oslo.messaging under the _utils module. It is taken from:
https:/ /review. openstack. org/#/c/ 389739/
combined with the followup fix:
https:/ /review. openstack. org/#/c/ 394460/
Change-Id: I5c211092d282e7 24d1c87ce4d06b6 c44b592e764 a1fe24c12b053c3 36b6d265501 cbfe04d0fa93e95 352bcfb1c3)
Depends-On: Id33c9f8c17102b
Closes-bug: #1518430
(cherry picked from commit a6c193f3eba62cd