Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -2609,6 +2609,7 @@ void resetServerStats(void) {
server.stat_fork_time = 0;
server.stat_fork_rate = 0;
server.stat_total_forks = 0;
server.stat_last_fork_start_time = 0;
server.stat_rejected_conn = 0;
server.stat_sync_full = 0;
server.stat_sync_partial_ok = 0;
Expand Down Expand Up @@ -5843,6 +5844,7 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) {
"pubsubshard_channels:%llu\r\n", kvstoreSize(server.pubsubshard_channels),
"latest_fork_usec:%lld\r\n", server.stat_fork_time,
Copy link
Member

@madolson madolson Feb 3, 2025

Choose a reason for hiding this comment

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

Not specifically related to this PR, but this info field is confusing. We thought it was how long the fork latest, but apparently it just covers the system call time. This made the info name you proposed a bit odd since it also used fork.

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, it is indeed confusing at the first time. A field show how long the fork latest also will be helpful.

"total_forks:%lld\r\n", server.stat_total_forks,
"last_fork_start_time:%lld\r\n", server.stat_last_fork_start_time,
"migrate_cached_sockets:%ld\r\n", dictSize(server.migrate_cached_sockets),
"slave_expires_tracked_keys:%zu\r\n", getReplicaKeyWithExpireCount(),
"active_defrag_hits:%lld\r\n", server.stat_active_defrag_hits,
Expand Down Expand Up @@ -6435,6 +6437,7 @@ int serverFork(int purpose) {
server.stat_fork_time = ustime() - start;
server.stat_fork_rate =
(double)zmalloc_used_memory() * 1000000 / server.stat_fork_time / (1024 * 1024 * 1024); /* GB per second. */
server.stat_last_fork_start_time = start;
latencyAddSampleIfNeeded("fork", server.stat_fork_time / 1000);

/* The child_pid and child_type are only for mutually exclusive children.
Expand Down
1 change: 1 addition & 0 deletions src/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -1808,6 +1808,7 @@ struct valkeyServer {
long long stat_fork_time; /* Time needed to perform latest fork() */
double stat_fork_rate; /* Fork rate in GB/sec. */
long long stat_total_forks; /* Total count of fork. */
long long stat_last_fork_start_time; /* Last us time to start a successful fork(). */
long long stat_rejected_conn; /* Clients rejected because of maxclients */
long long stat_sync_full; /* Number of full resyncs with replicas. */
long long stat_sync_partial_ok; /* Number of accepted PSYNC requests. */
Expand Down
Loading