bear-metal / tunemygc

TuneMyGC - optimal MRI Ruby 2.1+ Garbage Collection
https://www.tunemygc.com
346 stars 25 forks source link

Manual config tips for non-Rails? #2

Open subvertallchris opened 9 years ago

subvertallchris commented 9 years ago

I'm trying to tune GC for a Sinatra/Padrino app, so it looks like I need to setup the manual agent. Do you have any recommendations for this?

methodmissing commented 9 years ago

Hi @subvertallchris , we can create a new Spy that plugs into Sinatra during the next few days

methodmissing commented 9 years ago

Alternatively, if there's a really urgent need, there's a few example spies in https://github.com/bear-metal/tunemygc/tree/master/lib/tunemygc/spies (minitest and active_job are good base examples for this use case I think). What's most important is hooks for:

I documented these important lifecycle events in https://github.com/bear-metal/tunemygc/blob/master/doc/protocol.md#tunemygc-protocol . The above 3 needs to be covered, the GC specific ones are covered by tracepoints.

subvertallchris commented 9 years ago

Perfect, thank you! This is a really cool gem, thank you for making this available.

subvertallchris commented 9 years ago

I threw together a spy for RSpec but receive this upon completion:

Ruby version 2.2.0 or Rails version 0.0 not supported. Failed to sync 211 snapshots

It works if I tell it I'm running Rails 4.1.7, though I guess those results might not be optimal. ;-)

Happy to send a PR with this once it's working, if you'd like.

methodmissing commented 9 years ago

Send! :-)

subvertallchris commented 9 years ago

Will do once I'm home. It's pretty crude, really just the minitest class with the hooks swapped out. Is there a change I need to make to fix that Rails version error?

On Saturday, February 28, 2015, Lourens Naudé notifications@github.com wrote:

Send! :-)

— Reply to this email directly or view it on GitHub https://github.com/bear-metal/tunemygc/issues/2#issuecomment-76551997.

methodmissing commented 9 years ago

I can take a stab at it

subvertallchris commented 9 years ago

I'm a little short on time and haven't worked with minitest much, so please excuse my lack of tests.

It might be nice if there was a BaseSpy class, since there's so much shared behavior. The unique qualities of each subclass could be defined in methods or constants within the subclasses, then users could override or add behavior as needed. The instance variables @tests_processed and @tests_limit could be generalized. It'd make it very easy to add new spies.