Expose Redis main thread cpu time, and scrape system time via INFO command. #8132
Expose Redis main thread cpu time, and scrape system time via INFO command. #8132oranagra merged 1 commit intoredis:unstablefrom
Conversation
|
@redis/core-team please approve new info fields.. |
|
Thanks @filipecosta90 - it would be awesome if you make a PR that updates info.md in the redis-doc repo. |
|
@filipecosta90 I've pushed two suggestions -
|
@yossigo agree 👍 IMO it's better to omit than to present non numeric or negative. Should we do that change? |
|
@yossigo @itamarhaber @oranagra can you check it now with the suggestions added? |
oranagra
left a comment
There was a problem hiding this comment.
@filipecosta90 you have a memory leak (missing sdsfree(m_cpu);)
p.s. other segments in the info string take different approach of putting a whole block of sdscatprintf inside a condition (rather than using %s in an existing segment). see the various blocks inside "info replication".
or alternatively, since that's an #ifdef, we can just use 3 ifdefs (one on getting the data, one on the top part of the printf, and one on the bottom part).
not sure if that's cleaner or dirtier in this case.
4a6f0df to
245c5ac
Compare
Agree @oranagra. I was missing the part that we can only require one #ifdef . Can you check it now? |
9933aa6 to
a5337ed
Compare
8dda67b to
df0a020
Compare
a31e395 to
e8c41a4
Compare
done @oranagra . please revise.
Agree that we might be over optimizing =) |
|
@filipecosta90 sorry I just realized that when I suggested to change |
|
Considering |
|
come to think of it, a single number in the |
f4aef75 to
c44a11c
Compare
…mmand. (redis#8132) Exposes the main thread CPU info via info modules ( linux specific only ) (used_cpu_sys_main_thread and used_cpu_user_main_thread). This is important for: - distinguish between main thread and io-threads cpu time total cpu time consumed ( check what is the first bottleneck on the used config ) - distinguish between main thread and modules threads total cpu time consumed Apart from it, this commit also exposes the server_time_usec within the Server section so that we can properly differentiate consecutive collection and calculate for example the CPU% and or / cpu time vs wall time, etc...
The following PR exposes the main thread CPU info via info modules ( linux specific only ) (
used_cpu_sys_main_threadandused_cpu_user_main_thread). This is important for:Apart from it, this PR also exposes the
server_time_in_microsecondswithin the Server section so that we can properly differentiate consecutive collection and calculate for example the CPU% and or / cpu time vs wall time, etc...Note: given that I was already touching the CPU time collection code I've moved it to be called within the cpu section ( no need to measure cpu time if we're not outputting it ).
Here is a sample output of the proposed #CPU section on a 1 and 4 io-threads config ( while running a simple benchmark ):
1 io-thread (default)
We should see a small difference between main thread / all threads cpu time. Not very usefull for this simple scenario
4 io-threads
We should see a large difference between main thread / all threads cpu time, and be able to properly identify the main/bg threads cpu usage.
Regarding server time
Sample #SERVER section output: