Search code examples
rubyheap-memorysharing

Sharing heap between ruby processes


I'm loading a large object in the heap in a static variable. So when my ruby instance starts, it takes a while to transfer 70MB or so of data from redis into the instance's heap.

I'm running Sinatra to host a the web service that uses this data, so when the application receives a lot of requests, other instances spawn up and also transfer 70MB of data over to their heap.

Is there any way that this static variable can be shared between instances?

Thanks!


Solution

  • So I figured out this was not possible. Java can do this because of its virtual machine, but unfortunately ruby can't.