zombocom / puma_worker_killer

Automatically restart Puma cluster workers based on max RAM available
747 stars 77 forks source link

The memory reported doesn't match with the memory in Heroku metric #95

Closed imrubyist closed 3 years ago

imrubyist commented 3 years ago

For example, when PumaWorkerKiller reports it's using more than 512MB, the memory_total in Heroku metrics on both CLI and dashboard reported only 53% of 512MB

Is there a way to make it more accurate or even match with Heroku metrics? Or is this still relating to https://github.com/schneems/get_process_mem/issues/7 ?

Anyway, thanks for this useful gem

imrubyist commented 3 years ago

here's the test app (using the same gems as production app): https://github.com/kevinhq/jemalloc-test-heroku

I can run it with 15 workers (min thread 8, max threads 32)

PumaWorkerKiller: Consuming 2221.50390625 mb with master and 15 workers.

That's a report from PumaWorkerKilller. It consumes more than 2 gb memory, but no R14 error (run it on free dyno)

At the same time, here's the report from Heroku's metric:

source=web.1 dyno=heroku.210462585.db88a779-6118-4b99-9867-c362c3c09f7b 
sample#memory_total=449.35MB 
sample#memory_rss=449.34MB 
sample#memory_cache=0.01MB 
sample#memory_swap=0.00MB 
sample#memory_pgpgin=122112pages 
sample#memory_pgpgout=7078pages 
sample#memory_quota=512.00MB

memory_total=449.35MB vs 2221 mb from PumaWorkerKiller.

schneems commented 3 years ago

https://github.com/schneems/puma_worker_killer#turn-on-rolling-restarts---heroku-mode