Skip to content

Commit 82a312d

Browse files
ranshidhpatro
andauthored
replace info cluster info in a dedicated new section (valkey-io#2964)
In valkey-io#2876 we added cluster info stats to the info command. However these statistics where added to the "cluster" section which is part of the default info sections. Since the calculation of the cluster info is done "by-demand" it can lead to high server side CPU consumption when many clients are using the "info" command on a large cluster. In this PR we separated the cluster info to a dedicated "cluster_stats" section, which is not enabled by default. Alternatives considered: 1. Revert valkey-io#2876 - this is possible as the information is available via `CLUSTER INFO` command. The only downside is that some "control plane" adaptations need to be placed in order to gather this information in addition to the "already collected" server wide `INFO` data. 2. Optimize cluster info status collection - We could dynamically update and maintain these statistics during cluster topology state changes. The main "expensive" statistics which are needed to be collected are: slots_assigned, slots_ok, slots_pfail, slots_fail, nodes_pfail, nodes_fail, voting_nodes_pfail, voting_nodes_fail We could track and constantly update these during cluster pings. The main downside is potential bugs and bad accounting which might be caused by additional complexity and unhandled edge cases. --------- Signed-off-by: Ran Shidlansik <ranshid@amazon.com> Co-authored-by: Harkrishn Patro <bunty.hari@gmail.com>
1 parent dbe07b7 commit 82a312d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/server.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6431,6 +6431,12 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) {
64316431
"# Cluster\r\n"
64326432
"cluster_enabled:%d\r\n",
64336433
server.cluster_enabled);
6434+
}
6435+
6436+
/* Cluster Info */
6437+
if (all_sections || (dictFind(section_dict, "cluster_info") != NULL)) {
6438+
if (sections++) info = sdscat(info, "\r\n");
6439+
info = sdscatprintf(info, "# Cluster Info\r\n");
64346440
if (server.cluster_enabled) info = genClusterInfoString(info);
64356441
}
64366442

0 commit comments

Comments
 (0)