Skip to content

Commit b892c6e

Browse files
authored
CP-51692: Do not enable Event.next ratelimiting if Event.next is still used internally (#6222)
This fixes a performance regression on `feature/perf` with all feature flags disabled. By default Event.next is still used internally, so although this API is deprecated do not yet enable the throttling by default. Fixes: 3e1d8a2 ("CP-51692: Event.next: use same batching as Event.from") Fixes: 2b4e0db ("CP-49158: [prep] Event.{from,next}: make delays configurable and prepare for task specific delays") It slows down all synchronous API calls that create tasks, like VM.start. Only enable the throttling when Event.next is not used internally (`use-event-next = false` in xapi.conf), which will eventually become the default. The code prior to the above changes used 0 delay between checking for events, so do the same here (although this lead to a lot of inefficient wakeups of all active tasks in XAPI, whenever anything changes, it matches previous behaviour) (the code for Event.from used a 50ms delay, which matches the default for that setting already)
2 parents 9c5c8dd + 77147a3 commit b892c6e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ocaml/xapi/xapi_event.ml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,13 @@ let unregister ~__context ~classes =
476476

477477
(** Blocking call which returns the next set of events relevant to this session. *)
478478
let rec next ~__context =
479-
let batching = !Xapi_globs.event_next_delay in
479+
let batching =
480+
if !Constants.use_event_next then
481+
Throttle.Batching.make ~delay_before:Mtime.Span.zero
482+
~delay_between:Mtime.Span.zero
483+
else
484+
!Xapi_globs.event_next_delay
485+
in
480486
let session = Context.get_session_id __context in
481487
let open Next in
482488
assert_subscribed session ;

0 commit comments

Comments
 (0)