-
Notifications
You must be signed in to change notification settings - Fork 4.1k
perf: remove locking from hlc.PhysicalNow/hlc.PhysicalTime #30520
Copy link
Copy link
Closed
Labels
C-performancePerf of queries or internals. Solution not expected to change functional behavior.Perf of queries or internals. Solution not expected to change functional behavior.
Description
hlc.PhysicalNow and hlc.PhysicalTime provide access to the hybrid logical clock's physical component. Accessing the hlc's state is expensive because it requires a lock acquisition for a lock which is fairly contended. As such, we should be deliberate when using the hlc and avoid using it when possible.
In a lot of cases, a system clock is more than sufficient and should be a lot cheaper. These cases include access to time in the:
-
StorePool - (storage: Eliminate use of hlc.Clock in replicaStats #30651/@a-robinson)
replicaStats - (TODO/@nvanbenschoten)
replica.lastUpdateTimes - (TODO/@andreimatei)
TxnCoordSender.SendandTxnCoordSender.maybeSleepForLinearizable -
rpc/breakerClockandrpc/Context -
connExecutorall over the place -
RuntimeStatSampler -
MetricsRecorder -
authenticationServer -
log.selectEventTimestamp
... maybe others ...
We should audit uses of the hlc clock and make sure they actually need the added semantics it provides.
EDIT: the direction of this issue has changed. See #30520 (comment).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-performancePerf of queries or internals. Solution not expected to change functional behavior.Perf of queries or internals. Solution not expected to change functional behavior.