Skip to content

Expose Redis/RedisAI main thread cpu usage via modules info #530

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 3 commits into from
Dec 4, 2020

Conversation

filipecosta90
Copy link
Collaborator

The following PR exposes the main thread CPU info via info modules ( linux systems only ). In that manner we will have:

  • ai_self_used_cpu_sys and ai_self_used_cpu_user: which is the sum of resources used by all threads in the process
  • ai_children_used_cpu_sys and ai_children_used_cpu_user: resource usage statistics for all of redis terminated child processes
  • ai_main_thread_used_cpu_sys and ai_main_thread_used_cpu_user: resource usage statistics for the main thread which in this case is Redis/RedisAI main thread

Sample output:

$ redis-cli info modules
# Modules
module:name=ai,ver=999999,api=1,filters=0,usedby=[],using=[],options=[]

# ai_git
ai_git_sha:ffd7e8e7db02ba97d0472493d4dc626a2703eb09

# ai_load_time_configs
ai_threads_per_queue:1
ai_inter_op_parallelism:0
ai_intra_op_parallelism:0

# ai_cpu
ai_self_used_cpu_sys:9.682204
ai_self_used_cpu_user:150.129278
ai_children_used_cpu_sys:0.000000
ai_children_used_cpu_user:0.000000
ai_main_thread_used_cpu_sys:5.129278
ai_main_thread_used_cpu_user:2.682204
ai_queue_CPU_bthread_#1_used_cpu_total:0.000856

@codecov
Copy link

codecov bot commented Dec 3, 2020

Codecov Report

Merging #530 (0d68a93) into master (665b358) will increase coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #530      +/-   ##
==========================================
+ Coverage   75.25%   75.29%   +0.04%     
==========================================
  Files          22       22              
  Lines        5217     5226       +9     
==========================================
+ Hits         3926     3935       +9     
  Misses       1291     1291              
Impacted Files Coverage Δ
src/redisai.c 79.59% <100.00%> (+0.28%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 665b358...0d68a93. Read the comment docs.

rafie
rafie previously approved these changes Dec 3, 2020
DvirDukhan
DvirDukhan previously approved these changes Dec 3, 2020
…rom nsec to ms and it's supposed to be from nsec to micros )
@filipecosta90 filipecosta90 dismissed stale reviews from DvirDukhan and rafie via c8a2757 December 3, 2020 19:54
DvirDukhan
DvirDukhan previously approved these changes Dec 3, 2020
@filipecosta90 filipecosta90 merged commit 50b4b45 into master Dec 4, 2020
@filipecosta90 filipecosta90 deleted the main.thread.cpu branch December 4, 2020 15:27
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants