Skip to content

Conversation

ricab
Copy link
Collaborator

@ricab ricab commented Apr 5, 2024

Introduce the parallelization of the SSH commands that are used for info within VMs with multiple cores.

With the exception of the command to fetch IPs (which follows a different scheme that is used also for list), all the necessary commands are combined into a single one and executed in one go on the instane over SSH. Two versions of this single combined command are derived: one sequential and one parallel. The parallel version is used when the VM has multiple cores. On single-core VMs, the sequential version is used.

For organization, and to avoid polluting the unnamed namespace in daemon.cpp any further, the code is now in a new helper class: RuntimeInstanceInfoHelper.

Credit goes to @andrei-toterman for the idea implemented here. Thanks!

Copy link

codecov bot commented Apr 5, 2024

Codecov Report

Attention: Patch coverage is 24.32432% with 28 lines in your changes are missing coverage. Please review.

Project coverage is 88.82%. Comparing base (7473d6b) to head (ebb3b0a).

Files Patch % Lines
src/daemon/runtime_instance_info_helper.cpp 25.00% 21 Missing ⚠️
src/utils/utils.cpp 16.66% 5 Missing ⚠️
src/daemon/daemon.cpp 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3465      +/-   ##
==========================================
- Coverage   88.87%   88.82%   -0.06%     
==========================================
  Files         253      254       +1     
  Lines       14104    14115      +11     
==========================================
+ Hits        12535    12537       +2     
- Misses       1569     1578       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

townsend2010
townsend2010 previously approved these changes Apr 25, 2024
Copy link
Contributor

@townsend2010 townsend2010 left a comment

Choose a reason for hiding this comment

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

Hey @ricab!

Good work here! Testing went fine for me, 👍


Edit: lol, I put this in the wrong PR 😅

@townsend2010 townsend2010 dismissed their stale review April 25, 2024 12:48

I put my review comments in the wrong PR...

@townsend2010
Copy link
Contributor

Hey @ricab,

Could you please rebase and fix the conflicts here at your earliest convenience? I'm ready to functionally test this and get it in! Thanks!

ricab added 9 commits April 26, 2024 16:38
Use a single, composite, and sequential command to obtain all the
runtime info we need from the VM over SSH. Structure the code such that
it can be reused for a parallel command.
Use a parallel single composite command to obtain runtime information
from VMs that have more than one CPU. Continue using the sequential
version for VMs with a single CPU.
Add a placeholder helper class meant to house the code to populate
runtime instance info, with corresponding header and compilation unit,
to avoid polluting the unnamed namespace in the daemon compilation unit
any further.
Move utility to verify the validity of IPv4 addresses to the generally
accessible Utils singleton, in preparation for its use in the
RuntimeInstanceInfoHelper class.
Shorten the name of implementation-detail classes whose scope is now
contained.
@ricab ricab force-pushed the parallelize-info-intra-vm branch from 10de80a to ebb3b0a Compare April 26, 2024 15:38
@ricab
Copy link
Collaborator Author

ricab commented Apr 26, 2024

Hey @townsend2010, just to let you know I've rebased.

Copy link
Contributor

@townsend2010 townsend2010 left a comment

Choose a reason for hiding this comment

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

Hey @ricab!

Nice, great work here! Works well in practice and the code is code. 👍

@townsend2010 townsend2010 enabled auto-merge April 26, 2024 17:00
@townsend2010 townsend2010 added this pull request to the merge queue Apr 26, 2024
Merged via the queue into main with commit 84878a6 Apr 26, 2024
@townsend2010 townsend2010 deleted the parallelize-info-intra-vm branch April 26, 2024 18:56
Comment on lines -3548 to -3549
instance_info->set_cpu_times(vm.ssh_exec("head -n1 /proc/stat"));
instance_info->set_uptime(vm.ssh_exec("uptime -p | tail -c+4"));
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh no, I just realized these were not carried into populate_runtime_info()!!!!! And now the CPU usage meter is missing in the GUI!!!!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Bah, I must have missed it during a rebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants