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
on 2008-04-21 08:39
on 2008-04-21 15:45
> 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
on 2008-04-21 15:57
Any this really isn't a "mongrel" issue, but more an issue with the framework you're using.
on 2008-04-21 17:31
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
on 2009-04-28 07:53
Sandeep's question initial really simple, yet nobody has given him a satisfactory answer. I wonder if Rails 2.2 or later provides built in support to share memory between multiple mongrel servers. I read that Rails 2.2 was multi-threaded so technically shared memory should be an optin. If not, Phusion Passenger makes similar claims, yet when I go through it's doco I can't find any relevant pointers. Pete
on 2009-04-28 18:18
There is no such facility. Passenger can't do it either, copy-on-write is an optimization, not a shared memory space. Using a local memcached instance is the easiest way. Multithreading is not shared memory across processes, but might give you enough throughput that you only need to run one mongrel; then the threads themselves will all share the same heap. Evan
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.