Reputation: 1865
I have some code that both loads largish objects (1-10 mb, let's say) and then sends them out to the browser. Naturally, it can also receive them from users and write them to disk.
I understand that that's going to take up some memory but the problem is that it keeps that memory around, and I am getting processes ballooning to something like a gig, which is absurd.
xxxx 3449 3.0 29.9 639156 620304 ? R 20:22 0:23 Rack: /var/www/xxxxxx.com/xxxxxxx
This one has only been around for a few minutes! Ouch!
Any ideas how to keep the size down? This is Rails 3, and the latest passenger. ActiveRecord is used for DB access.
Is there a way I can make Rails free up that space after each request?
Upvotes: 1
Views: 105
Reputation: 6241
What kind of objects are this?
If it are files from harddisk and you are running Apache you can use mod_xsendfile for Apache2/Apache2.2 to avoid your program to touch these files at all.
Upvotes: 1