amir20 / dozzle

Realtime log viewer for docker containers.
https://dozzle.dev/
MIT License
5.7k stars 287 forks source link

CPU percentage #3134

Closed Mephisto090 closed 1 month ago

Mephisto090 commented 1 month ago

Hi

It would also be great to have a setting to show the CPU percentage as 400% or 100% for 4 CPUs. It is sometimes a bit confusing when you have 120% utilization, but that is not so bad

image

somehow the progress bar only has 100%. This should be designed for 400% and also display with the setting at 100% or max in our example 400%

amir20 commented 1 month ago

I am not understanding this question. Are you saying at 4 cores it should be max 400%?

It used to be like that, but that led to a lot of confusion. See https://github.com/amir20/dozzle/issues/2944#issuecomment-2106040112 Majority of users have CPU less than 100% so it led to a lot of confusion with folks with 16 cores to see a very little bar.

I don't know of a better solution. Open to suggestions for a solution that would work for all. Not going to make configurations for this.

githubbiswb commented 1 month ago

I am not sure if this will be helpful, so if its more just confusing ignore the comment completely.

You should look at this utility

https://github.com/bcicen/ctop

It makes an htop like display of your running containers on a docker host, very useful tool.

The reason I bring it up is because it shows the CPU and MEM usage of the containers as a full picture of the host. So if you have 4 CPUs and a container is using one of them completely, your CPU usage is coming in at 25%.

When you set limits on your containers, the graph respects that as well. I run a telegraf agent, and limit it to 100M of memory, and as you see in my picture, the graph fills right up to that line at 88M, although my host has 16GB. Other containers, without limits show it as much lower.

Perhaps ctop is poking at the docker api in a different spot to get the info it needs and dozzle could as well.

Also, ctop is fantastic, if you don't know about it, take a look, I bet you both will find it very useful.

Capture

amir20 commented 1 month ago

I am very familiar with ctop. I actually collaborated with the author a little bit. Sadly, ctop hasn't been updated in a very long time and breaks on my arm64 laptop.

In Dozzle, memory works identical to ctop and docker stats. Docker reports a % which is memory used / memory limit. For your 100M containers, you should see the % reported correctly.

For CPU, Docker just reports CPU used. There is no limit that I am aware of. I would have to calculate number of cores myself and show a smaller progress bar.

As I said before, it used to be like that. But since the majority of people use less than 100%, it led to a lot of confusion.

Even in your screenshot, it would be confusing. If CPU goes to 10% and I only show 1% on a 10 core machine, it is confusing.

Going to close this since I don't think there is a better solution.

There is another open issue #3128 which would show total configured memory. That would bring the UI closer to docker stats and ctop.