I've got a controller that I'm using as a check for monit to verify my website is up and functioning. Right now it just is a simple index page that just renders success. It seems that overnight, this controller is leaking memory, to the point that after 8 hours, the mongrel packs are restarted twice after reaching a 50mb size limit. There is nothing else running on the site except this monitoring action, as it's in development. I've run this in both mongrel and webrick, and they both exhibit the same behavior, a slow growth over time with no release of memory. The same issue occurs if I render the string directly (render :text => 'success'). Also, how can I turn off logging for this controller, as every 60 seconds, I get 4 hits in my log file letting me know that the controller was hit. I stated in a previous post that logger.silence wasn't working as expected for me, and now that I'm using an rhtml file, I don't see where I would put the silence command. I tried it around the render text when I was using that method, but it didn't work either. Any help is appreciated. Thanks. >>monit_controller.rb class MonitController < ActionController::Base session :off ## this is used by the monitoring scripts to see if the mongrel is up and running def index end end >>index.rhtml success
on 2007-02-02 16:01
on 2007-02-02 20:41
Hi~ On Feb 2, 2007, at 7:01 AM, firstname.lastname@example.org wrote: > same behavior, a slow growth over time with no release of memory. The > > end > >>> index.rhtml > success A few things here.. Are you running the site in development mode? If so be aware that rails leaks memory in development mode because of all the reloading of classes and such. So if you are in dev mode then this is to be expected, mongrel, fcgi or webrick will all exhibit the same symptoms and leak memory. If you have to run in dev mode then tell monit to restart the mongrels every 1 hour or so to keep them from leaking. Also if you have monit set to restart mongrel if its memory goes over 50Mb then be prepared for a lot of restarts. Rails apps can take up anywhere from 40-100Mb per mongrel in my experience sometimes even more. In my monit config I don't have mongrel restart until its memory gets to 130Mb or more. HTH- -- Ezra Zygmuntowicz -- Lead Rails Evangelist -- email@example.com -- Engine Yard, Serious Rails Hosting -- (866) 518-YARD (9273)
on 2007-03-24 22:17
I was able to shut off logging for the monit controller by adding a def logger end to the controller, and in so doing, it also seems to have fixed my memory usage issues...