Ruby Forum Mongrel > Shared memory across mongrels

Posted by Sandeep Gudibanda (sgudibanda)
on 21.04.2008 08:39
Hi,

I have written an application which on initiliazation calculates a graph
based on data in DB. And then any updates on the graph(global variable)
, i am doing both on graph and db.

Everything works fine as long as i work on single mongrel. When i use 2
mongrels, second mongrel cannot see graph in the memory. It gets a null
variable.

How do i do this so that graph built in the memory is accessible to all
mongrels?

Regards,
Sandeep G
Posted by Roger Pack (rogerdpack)
on 21.04.2008 15:45
(Received via mailing list)
>  How do i do this so that graph built in the memory is accessible to all
>  mongrels?
Save data to a DB, or to a session variable ?
remember it's like having two separate processes--they don't share
memory at all by default.
-R
Posted by Joey Geiger (jgeiger)
on 21.04.2008 15:57
(Received via mailing list)
Any this really isn't a "mongrel" issue, but more an issue with the
framework you're using.
Posted by Piyush Ranjan (Guest)
on 21.04.2008 17:31
(Received via mailing list)
Sandeep
you may use a different ruby process to contain this graph and your 
mongrel
based rails processes may talk to this drb instance and access the 
graph. 2
or more mongrel process do not share any data as they are completely
different processes.

Piyush