Skip to content
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

Add configurable interval for monitor mode #87

Closed
Memphizzz opened this issue Feb 1, 2019 · 11 comments
Closed

Add configurable interval for monitor mode #87

Memphizzz opened this issue Feb 1, 2019 · 11 comments
Assignees

Comments

@Memphizzz
Copy link

Hi,

first of all, thank you very much for dry! It's an amazing piece of software. I especially like the monitor mode.

Would it be possible to add a configurable interval on how quickly the monitor refreshes? Because if you have dry running for a few days, the consumed CPU time (TIME+) is huge, I guess by limiting the refresh rate to lets say every 30 seconds would improve that.

Thanks in advance and keep up the great work!

@moncho
Copy link
Owner

moncho commented Feb 2, 2019

Hey,

Great that you like the tool and thanks for your kind words!!

Current refresh rate is half a second, making it configurable is a nice idea, it will be added.

The increase in CPU time consumption when running for a long period of time is most likely an indication of dry misusing resources, could you please share some rough numbers? So, how much CPU is used when dry starts in monitor mode vs CPU usage after a few days when it gets huge.

Cheers

moncho added a commit that referenced this issue Feb 3, 2019
By default refresh rate is set to 500 ms, but it can now be changed by
the user. refs #87.
@Memphizzz
Copy link
Author

Memphizzz commented Feb 4, 2019

Hi,

thanks, that will help it think.
I've just tested this:

Started both htop and dry in a horizontally tiled tmux window and let them run for a few hours:
After 21.86h this was the result:

PID USER      PRI  NI  VIRT   RES   SHR S CPU% MEM%   TIME+  Command
68710 memphiz   20   0  114832  15996   8984 S   1.7  0.4  23:40.15 dry
68708 root      20   0   28528   5080   3892 S   0.7  0.1  11:05.88 htop

You can see that dry used more than double the cpu time of htop. It's usually using 2% CPU on this particular VM constantly (Ubuntu Server 18.04.1 LTS - 8 Cores/4GB RAM). My guess is that by reducing the amount of refreshes this will reduce the constant CPU usage to about 0-1% and reduce overall CPU time to be even below htop.

increase in CPU time consumption when running for a long period of time is most likely an indication of dry misusing resources

I don't know if I agree with this. Isn't CPU time the total time the CPU used for this process from start until now and must go up over a long period of time? This would make sense to me if we would be talking about RAM usage but any process's CPU time will be huge if you let it run long enough (and it actually does something). The only question is how quickly that happens, which depends on how much work is being done. So by being able to set the screen refresh interval manually, anyone should be able to meet his/her prefered CPU usage/time limit, right?

Regards,
MemphiZ

moncho added a commit that referenced this issue Feb 6, 2019
StatsChannel now has a refresh channel on which to receive petitions to
refresh stats. On message, stats are read from the Docker stats stream
and sent on the stats channel of StatsChannel.

refs #87
@moncho
Copy link
Owner

moncho commented Feb 6, 2019

Thanks for the test @Memphizzz!!

I don't know if I agree with this. Isn't CPU time the total time the CPU used for this process from start until now and must go up over a long period of time? This would make sense to me if we would be talking about RAM usage but any process's CPU time will be huge if you let it run long enough (and it actually does something). The only question is how quickly that happens, which depends on how much work is being done. So by being able to set the screen refresh interval manually, anyone should be able to meet his/her prefered CPU usage/time limit, right?

I misunderstood your initial comment and thought you were saying that when left running for a while dry average CPU usage was increasing but you were actually talking about total CPU time, which as you said it always increases with time :)

Anyway, I agree that reducing the refresh interval might help a bit with the CPU usage. Next release will include this.

Cheers

@Memphizzz
Copy link
Author

Awesome, thank you very much!

@moncho moncho self-assigned this Feb 19, 2019
@moncho
Copy link
Owner

moncho commented Mar 3, 2019

Added in v0.9-beta.9.

@moncho moncho closed this as completed Mar 3, 2019
@Memphizzz
Copy link
Author

Would it be possible to give this a command line parameter as well? For example: dry -m -r 5000 ?

@Memphizzz
Copy link
Author

Also please make it refresh once, after you've entered a value..

@moncho
Copy link
Owner

moncho commented Mar 4, 2019

Would it be possible to give this a command line parameter as well? For example: dry -m -r 5000 ?

@Memphizzz Could you please open a new Issue for this?

@Memphizzz
Copy link
Author

@moncho Sure thing. Here you go: #94

@Memphizzz
Copy link
Author

Now that this is added, here is a updated performance overview with the refresh interval set to 5000ms.

 PID CMD                                          STARTED     TIME %MEM %CPU
48339 htop                        Sun Mar  3 18:15:34 2019 00:15:09  0.0  1.3
48340 dry                         Sun Mar  3 18:15:34 2019 00:04:08  0.2  0.3

Very good improvements in terms of both, constant CPU usage and CPU time. Memory consumption unchanged (good).

@moncho
Copy link
Owner

moncho commented Mar 4, 2019

Thanks for sharing!!

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

No branches or pull requests

2 participants