schneems / puma_auto_tune

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

Proposed fix for reap-cycle cycling #11

Closed bdmac closed 7 years ago

bdmac commented 10 years ago

Added in a cache for our wrapped Puma::Worker objects so that whenever we call PumaAutoTune::Master#workers we will always get the same PumaAutoTune::Worker objects. This lets the concept of restarting a worker persist through calls to reset on PumaAutoTune::Memory. We want resetting the memory to recalculate the memory EXCEPT for the fact that we want the restarting worker to still return 0.

This is a proposed fix for the problem outlined in schneems/puma_auto_tune#10

schneems commented 10 years ago

I added this while I was flying: https://github.com/schneems/puma_auto_tune/blob/master/lib/puma_auto_tune/master.rb#L37 which i think takes care of this. Even though i'm saying the worker is "restarting" it's really being killed and Puma is automatically bringing up another, i'm thinking we can just ignore all workers that have been termed

bdmac commented 10 years ago

That looks like it could work if that instance var is set immediately by Puma. The only other thing I'd say is that the workers method in Memory is still not memoizing which it looks like was intended.