cockroachdb / cockroachdb/cockroach

allocator: high amount of CPU usage for storepool logging

Open
#104,919 0 comments 0 reactions 0 assignees View on GitHub
C-bug
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

In an internal test cluster running 23.1.2 with 48 nodes we see that allocator logging is using 4% of CPU (32vCPU).

![image](https://github.com/cockroachdb/cockroach/assets/39606633/a8c0f8cf-91a4-489f-add2-238c496fb8ab)

The CPU usage is from here:

https://github.com/cockroachdb/cockroach/blob/fdf04ffe5403daab580ab0a6fb0ad407ccc23c2e/pkg/kv/kvserver/allocator/storepool/store_pool.go#L1421-L1427

When grabbing another profile the CPU time disappears. The suspect part is the number of string operations - which eat the majority of CPU shown above.

Details

![image](https://github.com/cockroachdb/cockroach/assets/39606633/4b342311-a674-4fa4-9fdb-45284cfa7f20)


It appears possible redact printing `status` is eating most of the CPU, however I'm not certain. Also these log statements are at `v=3`, meaning that tracing must have been enabled consistently - which I suppose makes sense given:

https://github.com/cockroachdb/cockroach/blob/fdf04ffe5403daab580ab0a6fb0ad407ccc23c2e/pkg/kv/kvserver/replicate_queue.go#L721-L723

Jira issue: CRDB-28774

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.