4 ms·
if you're running multiple rails processes on a server like this, couldn't you somehow do the initialization in one process, then fork off the new processes? wo
by surfmike 11y ago
if you're running multiple rails processes on a server like this, couldn't you somehow do the initialization in one process, then fork off the new processes? wouldn't that prevent the base libraries from being copied in memory?
- lotyrin 11y agoYes. Many app servers do this. (Not being super familiar with the Ruby ecosystem, I am not sure specifically which ones.)
- paulannesley 11y agoYes, http://unicorn.bogomips.org/ http://unicorn.bogomips.org/ popularized this for ruby / rack / rails with its forking model and preload_app option. http://puma.io/ http://puma.io/ does the same thing, but additionally runs multiple threads in each process. The garbage collector in Ruby 1.8 / 1.9 negated the benefits of copy-on-write forking, but that's fixed since Ruby 2.0