Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add acquire shard time metric #2912

Merged
merged 3 commits into from
Dec 16, 2019
Merged

Add acquire shard time metric #2912

merged 3 commits into from
Dec 16, 2019

Conversation

vitarb
Copy link
Contributor

@vitarb vitarb commented Dec 16, 2019

Record a metric that measures time since last shard update each time when ownership changes.

@coveralls
Copy link

coveralls commented Dec 16, 2019

Coverage Status

Coverage increased (+0.3%) to 68.276% when pulling 552b401 on vitarb:shard-acquisition-time into e5ceaa2 on uber:master.

@@ -127,6 +129,7 @@ type (

// exist only in memory
standbyClusterCurrentTime map[string]time.Time
shardOwnershipChanged bool
Copy link
Contributor

Choose a reason for hiding this comment

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

ownershipChanged is a bit confusing to me - (1) does it mean this shard is no longer valid because ownership has moved to another host or (2) does it mean this shard is loaded because of a previous ownership change. If I understand right, you want (2) ? Is that right ? If that's the case, how do you feel about storing "previousOwner" here instead of this flag.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This flag means that while we were trying to acquire a shard, record that we've loaded from the database had a different owner than the current host's identity. Hence it means that shard ownership has changed and this is the first time that we've discovered it.

if context.ShardOwnershipChanged() {
i.GetMetricsClient().RecordTimer(metrics.ShardInfoScope, metrics.ShardItemAcquisitionLatency,
context.GetCurrentTime(i.GetClusterMetadata().GetCurrentClusterName()).Sub(context.GetLastUpdatedTime()))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure if this can give you accurate value for shard_ownership_change time - UpdateShard is called only every minute unless we run out of rangeID space, in which case, it is immediately invoked.

Copy link
Contributor Author

@vitarb vitarb Dec 16, 2019

Choose a reason for hiding this comment

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

Yep this is an approximation, however it would provide an upper boundary for the time when shard is not owned by anyone, I plan to also add code to ensure that shards are updated during shutdown to ensure most up to date timestamps.

@vitarb vitarb merged commit 3c37236 into uber:master Dec 16, 2019
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