# Mongrels servers sharing common memory space

**URL:** <https://www.ruby-forum.com/t/mongrels-servers-sharing-common-memory-space/196646>\
**Category:** Rails\
**Created:** [April 21, 2008, 1:05pm UTC](https://www.ruby-forum.com/t/mongrels-servers-sharing-common-memory-space/196646 "2008-04-21T13:05:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sgudibanda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@sgudibanda](https://www.ruby-forum.com/u/sgudibanda)\
**Post date:** [April 21, 2008, 1:05pm UTC](https://www.ruby-forum.com/t/mongrels-servers-sharing-common-memory-space/196646/1 "2008-04-21T13:05:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sgudibanda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@sgudibanda](https://www.ruby-forum.com/u/sgudibanda)\
**Post date:** [April 21, 2008, 1:45pm UTC](https://www.ruby-forum.com/t/mongrels-servers-sharing-common-memory-space/196646/2 "2008-04-21T13:45:55Z")

</div>

On 21 Apr 2008, at 12:05, Sandeep G. wrote:

> 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?

You can’t without some intermediary (the database, memcached etc…)

Fred

---

<div class="post-metadata">

**Author:** ![sgudibanda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@sgudibanda](https://www.ruby-forum.com/u/sgudibanda)\
**Post date:** [April 21, 2008, 1:52pm UTC](https://www.ruby-forum.com/t/mongrels-servers-sharing-common-memory-space/196646/3 "2008-04-21T13:52:59Z")

</div>

Hi Fred,

I thought of Memcached, but later read somwhere that is just a cached  
replica of DB. Is this true? Or Can memcache contain anything ?

Say i want a variable “Count” to be in memcached that is accessible to  
all mongrel servers. How do i do that?

Any thoughts on sharedmemory?

Regards,  
Sandeep G

---

<div class="post-metadata">

**Author:** ![sgudibanda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@sgudibanda](https://www.ruby-forum.com/u/sgudibanda)\
**Post date:** [April 21, 2008, 1:59pm UTC](https://www.ruby-forum.com/t/mongrels-servers-sharing-common-memory-space/196646/4 "2008-04-21T13:59:05Z")

</div>

On 21 Apr 2008, at 12:52, Sandeep G. wrote:

> Hi Fred,
> 
> I thought of Memcached, but later read somwhere that is just a cached  
> replica of DB. Is this true? Or Can memcache contain anything ?

memcache can contain arbitrary data.

Fred
