I have a production site that has a couple of batch jobs, I have used script/runner and cron to run these jobs. This works ok for jobs that only run once overnight during off peak.

I am expiring sessions older than 30 mins every 15 mins using script/runner, but I'm concerned about the hit of script/runner loading up the whole rails environment, specifically since I only have a 256MB slice, at such regular intervals.

What is a more efficient way of clearing down these sessions (using AR store btw).

Any help is appreciated


Have you checked what is consuming the memory? The environment should take about 60mb (not 100% about that). creating objects from find(:all, ....) queries. Can you change the ActiveRecord find into raw sql queries and compare results? I remember case with my code - memory usage jumped from 600mb do 180mb after changing find(:all, ...) into sql.

The other thing is the script/runner - I don't know if it will make any difference but you could try with rake task's instead of script/ runner.