I've just started using REE in production, and I couldn't be happier.
I'm trying to get the most out of the memory savings, though, and I'm
not clear on some points.
The way I read it, REE would be able to share the Rails code between
different applications provided that they use the same gem version of
Rails. Is that right? If I have 3 apps all using Rails 2.1 (or
whatever), are they able to save memory by sharing the code from that
gem?
Then, as a follow-up, what if you're using a frozen copy of Rails in
vendor/rails? My guess would be that a single application can share
the Rails code found in vendor/rails, but that this copy of Rails
would not be shared between applications.
Can you explain this in a bit more detail, or point me to a place that
explains this? I'm sorry to be a bother, but I just haven't been able
to determine the details of how this works.
> Can you explain this in a bit more detail, or point me to a place that > explains this? I'm sorry to be a bother, but I just haven't been able > to determine the details of how this works.
Basically, you load up several copies of the code, and in the parts where they don't differ, they share memory. If all your copies of Rails reference a string "FOOBAR" for instance, they might as well all keep it in the same memory on your computer as long as they're only reading from it. If one writes to it, changing it, that means that it has to now keep a separate copy, because it's now different from the other copies.
Trevor Turk wrote: > Then, as a follow-up, what if you're using a frozen copy of Rails in > vendor/rails? My guess would be that a single application can share > the Rails code found in vendor/rails, but that this copy of Rails > would not be shared between applications.
This is correct. There's no way to fix this. If you vendor Rails, then the framework memory won't be shared between different applications (though each application instance still shares memory with other instances of the same application).
No way to solve this, other than not vendoring Rails.
-- Phusion | The Computer Science Company
Web: http://www.phusion.nl/ E-mail: i...@phusion.nl Chamber of commerce no: 08173483 (The Netherlands)
On Nov 18, 2:57 pm, Hongli Lai <hon...@phusion.nl> wrote:
> If you vendor Rails, then
> the framework memory won't be shared between different applications
> (though each application instance still shares memory with other
> instances of the same application).
Thanks very much for your responses.
Just to clarify - please correct me if I'm wrong:
1) Multiple instances of the same application will share a gem OR
vendored version of Rails.
2) Multiple instances of different applications will share a gem
version of Rails, but NOT a vendored version of Rails (even if they're
the same version).
Trevor Turk wrote: > Thanks very much for your responses.
> Just to clarify - please correct me if I'm wrong:
> 1) Multiple instances of the same application will share a gem OR > vendored version of Rails. > 2) Multiple instances of different applications will share a gem > version of Rails, but NOT a vendored version of Rails (even if they're > the same version).
Correct.
-- Phusion | The Computer Science Company
Web: http://www.phusion.nl/ E-mail: i...@phusion.nl Chamber of commerce no: 08173483 (The Netherlands)