Skip to content

Use System.currentTimeMillis() instead of System.nanoTime() to measure wall clock duration#7865

Closed
mqliang wants to merge 1 commit intoapache:masterfrom
mqliang:nano-millis
Closed

Use System.currentTimeMillis() instead of System.nanoTime() to measure wall clock duration#7865
mqliang wants to merge 1 commit intoapache:masterfrom
mqliang:nano-millis

Conversation

@mqliang
Copy link
Contributor

@mqliang mqliang commented Dec 4, 2021

Description

OS have an in memory counter/clock which provides millisecond accuracy. For nanosecond accuracy OS have to
read a hardware counter. Communicating with hardware is much slower then reading some value already in memory,
this will cause some performance problem as we measure for each query, especially when QPS is high. Thus, use
System.currentTimeMillis() instead of System.nanoTime() to measure wall clock duration. It will give us
millisecond resolution but that's fine, as most of queries takes > 1ms, if a query takes < 1ms, we can assume
systemActivitiesCpuTimeNs = 0.

Upgrade Notes

Does this PR prevent a zero down-time upgrade? (Assume upgrade order: Controller, Broker, Server, Minion)

  • Yes (Please label as backward-incompat, and complete the section below on Release Notes)

Does this PR fix a zero-downtime upgrade introduced earlier?

  • Yes (Please label this as backward-incompat, and complete the section below on Release Notes)

Does this PR otherwise need attention when creating release notes? Things to consider:

  • New configuration options
  • Deprecation of configurations
  • Signature changes to public methods/interfaces
  • New plugins added or old plugins removed
  • Yes (Please label this PR as release-notes and complete the section on Release Notes)

Release Notes

Documentation

@mqliang mqliang closed this Dec 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant