Threading means that you are running code in another thread in the same process, while forking means that you are deploying a separate process.
Threading generally means that you will use less memory since you will not have a separate instance of the application (this advantage is reduced if you have a copy for recording a friendly ruby โโsuch as ree). Communication between threads is also a bit easier.
Depending on your ruby โโinterpreter, ruby โโcannot effectively use additional kernels (jruby is good, MRI is much worse), so the appearance of many additional threads will affect the performance of your web application and will not fully utilize your resources - MRI only launches one stream at a time
Forking creates separate instances of ruby, so you can better use multiple cores. You are also less likely to adversely affect the main application. You should be a little careful when branching when sharing open file descriptors when you use fork, so usually you want to reopen database connections, memcache connections, etc.
With MRI, I would use forking, with jruby there is more to do that you had to do for threading
Frederick cheung
source share