Heimdall icon indicating copy to clipboard operation
Heimdall copied to clipboard

Memory usage leak? Systematic CPU usage spikes

Open ChrisThePCGeek opened this issue 4 years ago • 2 comments

I am noticing my Heimdall in docker on ubuntu server 20.04 is not only steadily increasing in ram usage up to around 500MB, as well as a 3-5 second process running for php-fpm. I disabled all the external API calls for my added panel icons. Still seeing the slow rise in ram usage as well as that php-fpm process. 2021-01-16 17_57_19-Portainer _ local

ChrisThePCGeek avatar Jan 16 '21 22:01 ChrisThePCGeek

Same for me, jumping from 0,2% to 10%-18% of 1 CPU. top says 3 times php-fpm7 using most CPU. All enhanced features allready disabled.

gdshadow01 avatar Jan 18 '21 16:01 gdshadow01

Heimdall uses more RAM (~120mb) than some of my more complex docker containers like influxdb and consumes more than most of my other containers added together. Considering how simple Heimdall is (it's a bunch of HTML with occasional polling of REST endpoints for the interactive type cards) ...it's a little bit absurd how much RAM it needs!

timdonovanuk avatar May 10 '21 10:05 timdonovanuk

@ChrisThePCGeek @timdonovanuk On memory usage: Heimdall is running on the Laravel PHP Framework. With default settings php-fpm uses around 60-100 MB of ram even when it is not serving anything at all. Nginx another few Megabytes...

If you want to optimize the RAM usage to be even lower, you could adjust the php fpm config. In case of the Heimdall docker image it is located in: config/php/www2.conf

and play with this settings, for example:

[www]
pm = ondemand
pm.max_children = 1
pm.process_idle_timeout = 10s
pm.max_requests = 100

With the above config I could get the php fpm process to fit in 50mb of ram. Obviously the above settings will have an impact on the response time / availability of the service. If you are only using it as a single user on your local network, you should have no problems with the above settings.

keriati avatar Nov 17 '22 10:11 keriati

The CPU spike issue should be resolved with v2.5.4. Closing

keriati avatar Dec 15 '22 20:12 keriati

@keriati thanks a lot for sharing the php pool config above. Memory usage came down from ~200M to <50M. Is it possible to include that in the docker image? Thanks!

erlisdhima avatar Jul 15 '23 18:07 erlisdhima