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 last_fork_start_time to INFO STATS #978

Open
wants to merge 4 commits into
base: unstable
Choose a base branch
from
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,
"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