zookeeper icon indicating copy to clipboard operation
zookeeper copied to clipboard

ZOOKEEPER-4252: Fix flaky test RequestPathMetricsCollectorTest#testMultiThreadPerf

Open kezhuw opened this issue 3 years ago • 0 comments

This test is asserting low performance threshold for RequestPathMetricsCollector#registerRequest. It fails at rate 20% according to jira reports. I think it caused by combination of:

  1. Unstable test environment.
  2. Executors.newCachedThreadPool is not suitable for cpu-bound operations.
  3. System.currentTimeMillis is not suitable for time counting due to possible wall clock skewing.

This pr try to fix flakyness through:

  1. Increase timeout for unstable test environment.
  2. Use Executors.newWorkStealingPool to execute register operation.
  3. Use System.nanoTime to count elapsed time.

Additionally, it logs elapsed time for performance measurement.

kezhuw avatar Mar 12 '22 12:03 kezhuw