Rémi Nuyts
2013-Apr-08 06:07 UTC
Rails app + Apache Passenger + Postgres : memory consumption
Hi all, I''ve a Rails 3.0 application that have a problem with the memory consumption. The application works in production mode on Apache + passenger mod on a Debian machine. It''s a virtual machine with 6 Gb RAM and 2 CPU (1 core 3GHz). It''s a mailing application and a simple click on a link to read a mail requires a series of operations on the server to render the page. This simple click needs about 50% of CPU during 2 or 3 seconds (I see it with "top" command). It seems that ruby processes allocate memory for jobs. But when the job is finished, the allocated memory seems to not be freed (unlike the CPU usage). The problem is that I''ve about 150 users on the system and the Postgresql database is installed on the same machine. When several users make operations at same time, memory usage increases until 100% and Postgres can''t accept request any more (then Postgres stops to log). Is there any configuration that I can make (Apache? Passenger? Rails?) to prevent memory usage increasing (Why it isn''t decreasing with the CPU?) and Postgresql crash? Thank you in advance. Rémi -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Jim
2013-Apr-08 12:09 UTC
Re: Rails app + Apache Passenger + Postgres : memory consumption
> > Is there any configuration that I can make (Apache? Passenger? Rails?) > to prevent memory usage increasing (Why it isn''t decreasing with the > CPU?) and Postgresql crash? >What version of ruby are you using? If possible, you may want to consider using http://www.rubyenterpriseedition.com. There are Passenger configuration variables you can use to adjust how long processes stay alive to continue serving requests, how many requests they serve, the max number of processes, etc. http://www.modrails.com/documentation/Users%20guide%20Apache.html#_resource_control_and_optimization_options Also, you can check the status and memory usage of your Passenger/Rails processes using the commands documented here: http://www.modrails.com/documentation/Users%20guide%20Apache.html#_analysis_and_system_maintenance Jim -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/Ib_ks4RCGOQJ. For more options, visit https://groups.google.com/groups/opt_out.
Rémi Nuyts
2013-Apr-09 08:15 UTC
Re: Rails app + Apache Passenger + Postgres : memory consumption
Thank you for your answer.> What version of ruby are you using? If possible, you may want to > consider > using http://www.rubyenterpriseedition.com.I use Ruby 1.8.7 . I will inquire about Ruby Enterprise Edition.> There are Passenger configuration variables you can use to adjust how > long > processes stay alive to continue serving requests, how many requests > they > serve, the max number of processes, etc. > >http://www.modrails.com/documentation/Users%20guide%20Apache.html#_resource_control_and_optimization_options This is my actual Passenger config : <IfModule mpm_worker_module> StartServers 4 MinSpareThreads 25 MaxSpareThreads 100 ThreadLimit 64 ThreadsPerChild 25 MaxClients 300 MaxRequestsPerChild 900 </IfModule> -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.