-
Notifications
You must be signed in to change notification settings - Fork 26
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
[enh] Measure and display app's base install average resource consumption (HDD+RAM+CPU) #139
Comments
In fact manifest/packaging version 2 includes such an info, and we merged yesterday a change in package check to add metrics displayed after install/upgrade/restore : #136 though sometimes it reports a negative RAM usage so there might be some things to improve 😅 But having such metrics was the missing piece to easily add a non-dummy info in the manifest for v2 apps YunoHost will complain if there's insufficient RAM before installing an app versus what's declared in the manifest |
Exactly the UX behavior proposal I was adding to my initial message just while you were answering (cf. [edit] tag)... What a fast move from YNH! 😉 I see the merged changes focus on RAM. Could we imagine similar metrics for HDD & CPU ?
|
CPU seems kinda hard imho because it's really not a well-defined quantity ... It depends too much on cores and clock frequency and probably other stuff ... HDD is okay and yeah a metric would be nice. There's already a key for this in the manifest. RAM really is the biggest deal because there's typically a peak RAM usage during build that make the install crash, and that's really the main focus point to have with this topic. And then "usage RAM" is nice to have, but like HDD is not super well defined because it depends on the load on the server, etc |
Indeed. I found some documentation on related topic but I need to read further to see if I can understand something simple enough out of this.
We could have base usage RAM & HDD space, i.e. base use of resources post-install without any users. For a server with little resources it already gives a good hint on whether you want to install a given app or not if for example it would account for more than half your total resources without any user. |
Bonjour @alexAubin,
I will work on a PR on this topic based on the implementation of the RAM metrics you pointed out to me.
So I read more on the topic. Complex task indeed to compare CPU, as it depends as far as I understood mainly on number of cycles per clock tick (which the number of cores impacts), clock frequency and CPU optimization schemes in the treatment of instructions (several instructions may be treated within the same cycle). To go further, one could even imagine that YNH core would extract the name of local machine's CPU model (or perform a small CPU benchmark - many open source tools already exist for this) and compare it to a (local ?) benchmarking database (several online open CPU benchmark databases exists), to ponderate the app's CPU score/profile according to he gap between the CPU model of the test machine on which the score/profile was initially defined and local machine's CPU model. Need help to be sure to understand correctly
|
If you want to have fun with the CPU thing, be my guest, but I reiterate that it sounds like a very ill-defined notion, and even if it was, it looks like a lore of effort for something which is gonna be virtually useless for the average yunohost admin and doesn't solve any actual issue (cf the discussion about RAM which is causing install crashes and therefore is quite important). I don't know what you hope to measure, considering that an app which just got installed should basically use 0 CPU because it doesn't receive any request ... Or maybe measuring the CPU usage of the app build, but then good luck differentiating the CPU usage of the processes related to the app build from the ones related to the basic YunoHost system stack @_@ |
Not my intention to do it for fun :)
I indeed thought about measuring both
Good point, which was actually missing from my reasoning...
Well I thought about using the same approach than the one currently used for RAM: measuring before install (that should gives CPU load of basic YNH system?), measuring peak and average value during install and calculate the difference with initial state get a rough CPU load. Would that sound relevant to you? If not I don't mind dropping the idea of CPU metrics. Regarding HDD space metrics though, this is quite easy to implement, but I wonder whether if the current app tested is let's say Nextcloud, |
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.
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:
find / -user $user_id -type d -exec du -scm {} + -prune | grep -Po '\d*(?=\Dtotal)'
(outputs size in megabytes according toman du
). This command would need further testing to make sure the result is accurate.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 megabytesfree -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.What do you think ?
Does the current workflow at YNH makes would make the package_check's script as the one to modify?
The text was updated successfully, but these errors were encountered: