kvclient: add x-region, x-zone metrics to DistSender#103963
kvclient: add x-region, x-zone metrics to DistSender#103963craig[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
|
I used the |
|
I made the assumption that that if batch requests sent are cross-region, batch response received later should also be cross-region to avoid redundant check. But I'm not sure if this assumption always holds. |
|
I found it necessary to use this map to store the node metrics before sending the request for comparison in order for |
4eb8949 to
14bc503
Compare
|
I’m not certain about the appropriate location to update the metrics. Currently, I am incrementing the metrics within |
1b54c76 to
2bd4d1d
Compare
kvoli
left a comment
There was a problem hiding this comment.
Reviewed 3 of 4 files at r1, 1 of 4 files at r3, 3 of 3 files at r5, 3 of 3 files at r6, all commit messages.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @wenyihu6)
-- commits line 15 at r5:
You should mention the limitation/requirement that the node has a locality with a region key.
pkg/kv/kvclient/kvcoord/dist_sender.go line 390 at r2 (raw file):
Previously, wenyihu6 (Wenyi Hu) wrote…
I added these two testing knobs to capture the number of bytes of batch request accurately in DistSender. Alternatively, we can simply ensure that the metrics are non-zero. Do you have a preference between these approaches?
This looks good, could be re-used for cross-zone (same region) metrics if added.
pkg/kv/kvclient/kvcoord/dist_sender.go line 2490 at r2 (raw file):
Previously, wenyihu6 (Wenyi Hu) wrote…
I made the assumption that that if batch requests sent are cross-region, batch response received later should also be cross-region to avoid redundant check. But I'm not sure if this assumption always holds.
Seems like a fine assumption.
pkg/kv/kvclient/kvcoord/dist_sender.go line 2493 at r2 (raw file):
Previously, wenyihu6 (Wenyi Hu) wrote…
I used the
DistSender.NodeDescStoreto retrieve the gateway node's descriptor via gossip here. Alternatively, we can rely on theDistSenderlocality, which is populated through theDistSenderConfig. I thought the current approach might reduce errors thrown here since setting locality explicitly isn't required when creating the struct forDistSenderConfig. But I wasn't sure.
There can be SQL only nodes, such as in serverless where each tenant has its own dedicated SQL node.
Did you update since your previous comment?
pkg/kv/kvclient/kvcoord/dist_sender.go line 2207 at r4 (raw file):
Previously, wenyihu6 (Wenyi Hu) wrote…
I’m not certain about the appropriate location to update the metrics. Currently, I am incrementing the metrics within
sendToReplicas, which is where batches have already been divided and is now forwarding to a specific replica for the range. We have another function that increments batch counts wheneverDistSenderreceives a batch request before subdividing. Ideally, we would want these metrics to measure similar aspects. However, we do not know the destination node in advance (as far as I understand), and we cannot determine which batch is cross-region until this point where we determine which replicas each sub-batch should be sent to. But I'm not sure if I misunderstood or if there is a better approach here.
This approach seems reasonable. If there isn't already a total "divided" batch bytes metric, then we could add it in order to get a % in timeseries queries.
pkg/kv/kvclient/kvcoord/dist_sender.go line 2207 at r5 (raw file):
} isCrossRegion, error := ds.maybeIncrementCrossRegionBatchMetrics(ba)
nit: rename to err
fb4fcab to
8a24fc3
Compare
Previously, kvoli (Austen) wrote…
Done. |
|
Previously, kvoli (Austen) wrote…
Done. |
0ef55f5 to
ae930a3
Compare
|
Build failed: |
|
bors retry The failure was due to an irrelevant flaky test that has been fixed on master. |
|
bors r- |
|
Canceled. |
|
bors r+ |
|
bors single off |
|
Thank you : )! |
|
Build succeeded: |
cockroachdb#103963 accidentally removed a testing knob which caused cockroachdb#104865. This commit adds the testing knob back. Fixes: cockroachdb#104865 Release note: none
104658: kvserver: attempt to explain ProposalData lifecycle r=tbg a=tbg Epic: CRDB-25287 Release note: None 104867: kvnemesis: add TestingKnobs.OnRangeSpanningNonTxnalBatch back r=tbg a=wenyihu6 #103963 accidentally removed a testing knob which caused #104865. This commit adds the testing knob back. Fixes: #104865 Release note: none Co-authored-by: Tobias Grieger <tobias.b.grieger@gmail.com> Co-authored-by: Wenyi <wenyi.hu@cockroachlabs.com>
The X-locality log events were added in cockroachdb#103963 for the dist sender, to alert when localities were misconfigured. In some clusters, especially test clusters, these events are unnecessarily verbose in traces. Change the log from `VEvent(5)` to `VInfo(5)` in the dist sender path. Resolves: cockroachdb#110648 Epic: none Release note: None
111140: roachtest: harmonize GCE and AWS machine types r=erikgrinaker,herkolategan,renatolabs a=srosenberg Previously, same (performance) roachtest executed in GCE and AWS may have used a different memory (per CPU) multiplier and/or cpu family, e.g., cascade lake vs ice lake. In the best case, this resulted in different performance baselines on an otherwise equivalent machine type. In the worst case, this resulted in OOMs due to VMs in AWS having 2x less memory per CPU. This change harmozines GCE and AWS machine types by making them as isomorphic as possible, wrt memory, cpu family and price. The following heuristics are used depending on specified `MemPerCPU`: `Standard` yields 4GB/cpu, `High` yields 8GB/cpu, `Auto` yields 4GB/cpu up to and including 16 vCPUs, then 2GB/cpu. `Low` is supported _only_ in GCE. Consequently, `n2-standard` maps to `m6i`, `n2-highmem` maps to `r6i`, `n2-custom` maps to `c6i`, modulo local SSDs in which case `m6id` is used, etc. Note, we also force `--gce-min-cpu-platform` to `Ice Lake`; isomorphic AWS machine types are exclusively on `Ice Lake`. Roachprod is extended to show cpu family and architecture on `List`. Cost estimation now correctly deals with _custom_ machine types. Finally, we change the default zone allocation in GCE from exclusively `us-east1-b` to ~25% `us-central1-b` and ~75% `us-east1-b`. This is inteded to balance the quotas for local SSDs until we eventually switch to PD-SSDs. Epic: none Fixes: #106570 Release note: None 111442: server,kvcoord: change x-locality log from vevent to vinfo r=arulajmani a=kvoli The X-locality log events were added in #104585 to the Node batch receive path, to alert when localities were misconfigured. In some clusters, especially test clusters, these events are unnecessarily verbose in traces. Change the log from `VEvent(5)` to `VInfo(5)` in the node batch path. The X-locality log events were added in #103963 for the dist sender, to alert when localities were misconfigured. In some clusters, especially test clusters, these events are unnecessarily verbose in traces. Change the log from `VEvent(5)` to `VInfo(5)` in the dist sender path. Resolves: #110648 Epic: none Release note: None 111475: server,settingswatcher: fix the local persisted cache r=stevendanna,aliher1911 a=knz There's two commits here, fixing 2 separate issues. Epic: CRDB-6671 ### server,settingswatcher: properly evict entries from the local persisted cache Fixes #70567. Supersedes #101472. (For context, on each node there is a local persisted cache of cluster setting customizations. This exists to ensure that configured values can be used even before a node has fully started up and can start reading customizations from `system.settings`.) Prior to this patch, entries were never evicted from the local persisted cache: when a cluster setting was reset, any previously saved entry in the cache would remain there. This is a very old bug, which was long hidden and was recently revealed when commit 2f5d717 was merged. In a nutshell, before this recent commit the code responsible to load the entries from the cache didn't fully work and so the stale entries were never restored from the cache. That commit fixed the loader code, and so the stale entries became active, which made the old bug visible. To fix the old bug, this present commit modifies the settings watcher to preserve KV deletion events, and propagates them to the persisted cache. (There is no release note because there is no user-facing release where the bug was visible.) ### settingswatcher: write-through to the persisted cache Fixes #111422. Fixes #111328. Prior to this patch, the rangefeed watcher over `system.settings` was updating the in-RAM value store before it propagated the updates to the persisted local cache. In fact, the update to the persisted local cache was lagging quite a bit behind, because the rangefeed watcher would buffer updates and only flush them after a while. As a result, the following sequence was possible: 1. client updates a cluster setting. 2. server is immediately shut down. The persisted cache has not been updated yet. 3. server is restarted. For a short while (until the settings watcher has caught up), the old version of the setting remains active. This recall of ghost values of a setting was simply a bug. This patch fixes that, by ensuring that the persisted cache is written through before the in-RAM value store. By doing this, we give up on batching updates to the persisted local store. This is deemed acceptable because cluster settings are not updated frequently. Co-authored-by: Stan Rosenberg <stan.rosenberg@gmail.com> Co-authored-by: Austen McClernon <austen@cockroachlabs.com> Co-authored-by: Raphael 'kena' Poss <knz@thaumogen.net>
The X-locality log events were added in cockroachdb#103963 for the dist sender, to alert when localities were misconfigured. In some clusters, especially test clusters, these events are unnecessarily verbose in traces. Change the log from `VEvent(5)` to `VInfo(5)` in the dist sender path. Resolves: cockroachdb#110648 Epic: none Release note: None
Previously, there were no metrics to observe cross-region, cross-zone traffic in
batch requests / responses at DistSender.
To improve this issue, this commit introduces six new distsender metrics -
The first two metrics track the total byte count of batch requests processed and
batch responses received at DistSender. Additionally, there are four metrics to
track the aggregate counts processed and received across different regions and
zones. Note that these metrics only track the sender node and not the receiver
node as DistSender resides on the gateway node receiving SQL queries.
Part of: #103983
Release note (ops change): Six new metrics -
"distsender.batch_requests.replica_addressed.bytes",
"distsender.batch_responses.replica_addressed.bytes",
"distsender.batch_requests.cross_region.bytes",
"distsender.batch_responses.cross_region.bytes",
"distsender.batch_requests.cross_zone.bytes",
"distsender.batch_responses.cross_zone.bytes"- are now added to DistSender
metrics.
For accurate metrics, follow these assumptions: