Skip to content

metrics: add loading region cache duration#502

Merged
sticnarf merged 3 commits intotikv:masterfrom
you06:region-cache-duration
May 16, 2022
Merged

metrics: add loading region cache duration#502
sticnarf merged 3 commits intotikv:masterfrom
you06:region-cache-duration

Conversation

@you06
Copy link
Contributor

@you06 you06 commented May 16, 2022

Signed-off-by: you06 you1474600@gmail.com

This PR record the latency when loading the region cache.

Signed-off-by: you06 <you1474600@gmail.com>
@you06 you06 force-pushed the region-cache-duration branch from b0a7e48 to 37d17e1 Compare May 16, 2022 05:52
@you06 you06 changed the title metrics: add latency for loading region region metrics: add loading region cache duration May 16, 2022
you06 added 2 commits May 16, 2022 14:54
Signed-off-by: you06 <you1474600@gmail.com>
Signed-off-by: you06 <you1474600@gmail.com>
@sticnarf sticnarf merged commit 79f010d into tikv:master May 16, 2022
} else {
reg, err = c.pdClient.GetRegion(ctx, key, pd.WithBuckets())
}
metrics.LoadRegionCacheHistogramWhenCacheMiss.Observe(time.Since(start).Seconds())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoadRegionCacheHistogramWhenCacheMiss observes the time for every round of getting region cache from PD. It is meaningful.
Do we need observe the total backoff time of getting region cache? The total time may be more clearly for users.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users may have interest in the total loading region cache time, and I think such time can be recorded in execution details and printed in slow log.

Because loading region cache can be concurrent, the total time does not stand for the wall time. I don't think it's a clear metric.

}
start := time.Now()
reg, err := c.pdClient.GetRegionByID(ctx, regionID, pd.WithBuckets())
metrics.LoadRegionCacheHistogramWithRegionByID.Observe(time.Since(start).Seconds())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

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.

3 participants