Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
With OAK-4732, we slightly prioritised reads, allowing callers of LockBasedScheduler#getHeadNodeState to wait for a certain amount of time on the commit semaphore, in order to fetch the latest head. The amount of time to wait for was computed as the median of the latest 1000 commits, but the implementation was flexible enough to replace the 0.5 quantile with a different value.
The initial implementation used SynchronizedDescriptiveStatistics from commons-math3. In OAK-6430, we replaced that with a Histogram backed by a SlindingWindowReservoir from the dropwizard metric library (io.dropwizard.metrics).
One of the problems observed with the current implementation is that, under heavy loading, the performance of LockBasedScheduler#getHeadNodeState decreases due to lock contention in commitTimeHistogram implementation. Namely, SlidingWindowReservoir#getSnapshot seems to be a bottleneck. It copies an array of 1000 elements at each invocation of LockBasedScheduler#getHeadNodeState, acquiring and releasing a lock for each element in the array.