Some days ago, I have introduced you to mod_rails. I totally freaked out by the idea to let RoR running inside of Apache. Just without using FCGI or proxying Mongrel.
Though, I had not much spare time this weekend, I just had to try it out!
First of all:
You guys rock!!! These guys just impressed me how well-thought a first release version can be.
The whole setup and Apache configuration is so damn easy - you can’t go wrong. The setup script even detects missing linux packages and tells you exactly what to do, depending on the hosting distribution.
So I switched one of my RoR applications to mod_rails …..
But after using it for some minutes I got heavely disappointed. It is just no good hosting option for my situation: [My server is a Debian VPS with 265MB-768MB burstable]
The memory consumption the machine went up from 280MB (wo/ mod_rails) to over 700MB. So all my applications started vomiting, because there was no memory left. Only killing apache2 processes helped me to solve the situation.
So I thought, I will be a good guy and RTFM. I stepped across this configuration parameter:
RailsMaxPoolSize <integer>
The manual recommended to set this parameter to “2″ for servers with small memory footprint.
So I did, but it was no help. Same memory consumption by all apache2 processes.
The next step was to not include the mod_rails module in apache. No help, either. So mod_rails wasn’t even running anymore and the memory consumtption was still beyond the pale!
So, the only reason I can imagine, is that one of the newly installed gems (axpr?) and not mod_rails directly is causing that big memory mayhem.
Huh, restoring a backup of my server was the only help to get rid of the situation!!!
What do you think? What might be the cause of my situation?
Hi there.
First of all, thanks for the praise.
I’m not sure what causes the excessive memory usage for you, for you should know that the memory reported by ‘top’ and ‘ps’ aren’t always correct. I wrote a detailed explanation here: http://groups.google.com/group/phusion-passenger/browse_thread/thread/e6dc620227ed7b4c/8e33b6ca17790321
This thread also explains the correct way to measure memory usage, as well as how people can help us track down the problem.
As for excessive memory usage even after mod_passenger.so is unloaded: I’m quite confident in saying that this cannot be Passenger’s fault.
We’re not doing anything weird with the system, so if mod_passenger.so isn’t loaded, then Passenger is not running at all. A possible explanation would be that Apache wasn’t restarted properly.
We’re pretty confident in saying that there are no (large?) memory leaks in Passenger. Resource management is one of the things that we put a lot of work into, and during our tests we’ve never seen anything like the situation described in this blog post. But we’d be really glad if you could help us with tracking down the problem. This might even be a memory fragmentation issue instead of a memory leak.
With kind regards,
Hongli Lai
- phusion.nl
people, don’t get me wrong! I really appreciate the work and do not blame them for any memory leaks.
ok, I have replied to Google Group mentioned above. It took just seconds and Hongli sent me a reply.
I will try out his “memory statistics gathering tool” as soon I am back from vacation.
I am to curious what has happened here!
There’s another possible solution — the first question on the FAQ is “It seems to leak memory like mad during startup. What’s going on?”, and the answer is:
What’s your stack size?
My actual stack size:
stack size (kbytes, -s) 8192
I will follow your hints when I am back at home in 2 weeks.
I did not want to start a flame on ‘mod_rails’, I just wanted to say that it won’t
work out in every kind of server setup, by investing 30 minutes - like I did.
But thank you for the hints, I will try out and will give the Passenger people a statement.
I had the same problems on my VPS with 256MB.
I was using quite much ram:
Apache + mod_rails was about 120MB of ram.
it was swapping more than normal…
So i changed to Thin+nginx, which the pair used half the memory.
I do like mod_rails for a big server with many apps.
Linux: Gentoo/AMD64.
According to recent posts found out there in the RoR community, the mod_rails guys have addressed this issue.
The actual version of mod_rails should run in VPS environments without any RAM problems.
I decided for myself that in my actual running projects I won’t switch to mod_rails in the near future.
Won’t change a running system: Mongrel.
I the next couple of weeks I will set a new project live. mod_rails will be the first choice.