schneems / puma_auto_tune

Puma performance without all the (T)pain
227 stars 19 forks source link

Fix worker growth to actually check est. memory #12

Closed bdmac closed 10 years ago

bdmac commented 10 years ago

I believe that :cycle was always intended to grow workers by calling :under_memory if the estimate of how much memory we would use by adding a worker is safe given constraints of PumaAutoTune.ram. The existing if check in :cycle did not actually check anything I don't believe.

bdmac commented 10 years ago

Ugh, missed that this was checked in :under_memory. I'm still curious though what the point of the conditional was then?

auto.call(:under_memory) if memory + workers.last.memory

What was that intended to do? I mean if x + y should always be truthy right?

schneems commented 10 years ago

Hmm. Seems like if memory + workers.last.memory was a fragment as it will always return true. I've updated some of the algorithm on master. The reap_cycle was not running multiple times as it should which is what likely caused the problem you were seeing.