I found many references on the Web to the fact
that “Rails is not thread-safe”.
However, I have not found an explanation why it isn’t?
What happens if multiple requests are handled concurrently
Assuming that the code I execute in my controller methods
is thread safe, is this ok?
If not – what happens?
The following makes it sound like the issue is
whether the app is thread-safe:
# Controls whether the application is thread-safe, so multi-threaded
servers like WEBrick know whether to apply a mutex
# around the performance of each action. Action Pack and Active
Record are by default thread-safe, but many applications
# may not be. Turned off by default.
@@allow_concurrency = false
@@allow_concurrency is apparently only used in caching.rb,
which makes sense…
Anyway - I am working on an app that needs to preserve state
from request to request, so I can’t have multiple processes
to allow for concurrency; it has to be done within
one ruby process using threads.
If there is a problem, I’m willing to put some time and effort
into fixing this, so I would appreciate any pointers.
Right now I don’t really see what the problem is.