Ruby Version ManagerUse it on the server! Multiple isolated Rubies Easy environment variables Easy install with patch integrationsetup/rvm.rb: https://gist.github.com/3946908
Ruby Garbage Collection Mark and Sweep, more or less: Stop the world Traverse and mark reference tree Free all unused objects (lazy = free) Still no free slots? Allocate 1.8 times more slots than on previous alloc
Typical Web Applications Small variations in used slots 100,000 - 200,000 slots in total 2,000 - 10,000 objects per request Most memory occupied by eternal (never freed) objects (code, classes, etc...)
Ruby 1.9.3-p286Ruby 1.9.3 GC is not copy-on-write friendlyBy default, 10,000 slots are allocated onstartup1.8 growth rate means Ruby is likely toallocate a lot more memory than needed!
falcon patchCopy-on-write friendly GCPerformance++ for require and HashSupported in RVM (--patch falcon)
GC ConﬁgurationWe want to allocate enough memory, so that rubynever has to resize it’s heapTypically 100,000 to 200,000 initial slotsRUBY_HEAP_MIN_SLOTS environment variable/usr/bin/time -l rails r "User.first(2000); pp GC.stat"
RAINBOWSServes HTTP over a Unix socketDoes not need rootMaster preloads app and forks workersMultiple net concurrency modelsExample conﬁg: https://gist.github.com/3946921
FOREMANProcess launcherExports to Upstart, launchd and othersKeeps developers happy!