Does Rails persist in RAM between requests?

On 10/27/07, Greg W. [email protected] wrote:

pack of mongrels, the global variable will not persit from one mongrel
max. So, each process instance can create it’s own global, that’s not
a problem.

But you can’t count on two subsequent requests from the same user
being handled by the same process instance.

Or the same process instance not interleaving requests from two
different users.


Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/

Hi Greg

On Oct 26, 11:40 am, Greg W. [email protected] wrote:

I’m trying to implement a data caching system and getting nowhere
because I cannot get a ruby global variable to persist across page
requests.*

cch: Stay away from global variables. Even if you managed to get it to
work in development mode, the moment you run it in production with a
pack of mongrels, the global variable will not persit from one mongrel
process to another.

CCH

On Oct 27, 2007, at 7:14 AM, Rick DeNatale wrote:

it to
doesn’t change.

We’re talking about a relatively small amount of data–50 to 100 KB
max. So, each process instance can create it’s own global, that’s not
a problem.

But you can’t count on two subsequent requests from the same user
being handled by the same process instance.

Or the same process instance not interleaving requests from two
different users.

That’s not a factor. The data is lazy loaded. If process A has
$configCache[‘whatever’] and on the very next page request on process
B doesn’t have that in the cache, then it will get loaded into the
cache for process B, and the request will finish serving just fine.

The data is fixed config stuff. It’s not changing from user to user
or process to process. As each process needs it, it will create it’s
own global and load the data in.

– gw

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs