Hi,
Would someone be able to explain how ruby class/object contexts work
from the point of view of a deployed rails application using FASTCGI and
noting there are multiple Ruby processes running (say on dreamhost for
example). Some questions to help clarify what I’m trying to understand:
a) how do incoming URL requests get spread across the multiple Ruby
processes (let’s say there are 5 processes)?
b) What component organising/manages this? (e.g. plugin in apache?)
c) is there any ‘stickness’ that occurs? i.e. where a request from
person A that goes to ruby process 2 the first time will go to process 2
again for the next person A request (I assume no?)
d) is there any sharing of contexts between the ruby processes? i.e.
Can a ruby class variable be “seen” across processes?
e) is there any equivalent to the java static class variable (which can
be accessed from any user request coming in which is being hosted within
the same web-container on the same JVM)? I understand there isn’t an
equivalent in ruby?
f) does the running ruby process handle multiple simultaneous user
requests at the same time? i.e. is it operating in a multi-threaded
mode?
g) If so (for last question) is there any scope for collisions when
using class variables (@@variable), or is each user request (i.e. each
HTTP request) totally isolated from every other request at the
ruby/rails application level? (of course the database would be shared).
i.e. could both users/requests share the same class variable somehow??
h) what non-database caching raw ruby techniques are there for same
caching a bunch of constants stored in a properties type file - perhaps
put the properties/configuration setting in a ruby file itself as
constants. Is it effectively already “cached” once it is "require"ed
via ruby then holding it in memory? or does ruby re-load that file each
time?
i) what would be simplest / rudimentory way to load/cache a bunch of
properties/configuration parameters for an application? (would it be as
per my suggestion in item h)
Signed
Still a bit confused about ruby/rails contexts
Thanks in advance