Skip to content

[enh] Measure and display app's base install average resource consumption (HDD+RAM+CPU) #139

@oleole39

Description

@oleole39

Hello,

Idea

I would find it quite useful to see in the web admin an indication of the resources required to install a given app.

  • This information would be added for instance in the app manifest of each app so that it would be visible at least on the install screen.
  • A trigger would be shown in case the current available resources of the server are lower or barely equal than the one required by the app the admin is looking to install.

To do so, either appropriate values could be written manually by each app packager, or more conveniently it could be checked automatically within a testing script such as package_check.sh.

Use case

This comes from a uncomfortable experience I had installing an app which was using much more RAM than I would have thought, and took my server to its limit, making it unresponsive.

Approach

I am unsure of what would be the best approach to do so. If I have not dug much in package_check script, I am under the impression it could perform the measurement by checking what refers to $user_id, the dedicated system user created for the app during its installation:

  1. creating an install of the app to measure. [edit] Ideally, it would measure the resources required for the installation (RAM in particular) for the installation processes involving compiling. [/edit]
  2. measure disk space used by the app and the added components
    • find / -user $user_id -type d -exec du -scm {} + -prune | grep -Po '\d*(?=\Dtotal)' (outputs size in megabytes according to man du). This command would need further testing to make sure the result is accurate.
  3. measuring base (i.e. at post-install, without any active of the app) CPU & RAM consumption; maybe those measurements should be done a few times and an average be calculated for better accuracy.
    a. RAM:
    • ps aux | egrep ^$user_id | awk 'BEGIN{total=0}; {total += $4};END{print total}' (outputs % of RAM used), to be multiplied with the amount of RAM available in megabytes free -m | egrep ^Mem: | awk '{ print $2 }'
      b. CPU:
    • ps aux | egrep ^$user_id | awk 'BEGIN{total=0}; {total += $3};END{print total}' (outputs % of CPU used) - not sure how this could be meaningful for our purpose though.
  4. Save values as minimum required resources within the manifest. [edit] Those values would then be displayed in each catalog's app description page, and when a user would launch an install, a quick check would be performed before starting the install script comparing those values with the one available on the target server. In case of mismatch, a warning pop-up would be displayed waiting for confirmation of the user to continue further or stop here.[/edit]

What do you think ?
Does the current workflow at YNH makes would make the package_check's script as the one to modify?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions