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 via http://www.ruby-forum.com/.
> 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
Any this really isn''t a "mongrel" issue, but more an issue with the framework you''re using. On Mon, Apr 21, 2008 at 8:43 AM, Roger Pack <rogerpack2005 at gmail.com> wrote:> > 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 > > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users >
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 Mon, Apr 21, 2008 at 7:26 PM, Joey Geiger <jgeiger at gmail.com> wrote:> Any this really isn''t a "mongrel" issue, but more an issue with the > framework you''re using. > > On Mon, Apr 21, 2008 at 8:43 AM, Roger Pack <rogerpack2005 at gmail.com> > wrote: > > > 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 > > > > > > _______________________________________________ > > Mongrel-users mailing list > > Mongrel-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/mongrel-users > > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20080421/7b51c02b/attachment.html
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 -- Posted via http://www.ruby-forum.com/.
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 On Mon, Apr 27, 2009 at 10:53 PM, Peter Hug <lists at ruby-forum.com> wrote:> 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 > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users >-- Evan Weaver