# Script/Runner

**URL:** <https://www.ruby-forum.com/t/script-runner/152010>\
**Category:** Rails\
**Created:** [October 28, 2008, 11:05pm UTC](https://www.ruby-forum.com/t/script-runner/152010 "2008-10-28T23:05:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hypnos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/8797f3/32.png) [@hypnos](https://www.ruby-forum.com/u/hypnos)\
**Post date:** [October 28, 2008, 11:05pm UTC](https://www.ruby-forum.com/t/script-runner/152010/1 "2008-10-28T23:05:01Z")

</div>

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

Thanks

---

<div class="post-metadata">

**Author:** ![hypnos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/8797f3/32.png) [@hypnos](https://www.ruby-forum.com/u/hypnos)\
**Post date:** [October 28, 2008, 11:24pm UTC](https://www.ruby-forum.com/t/script-runner/152010/2 "2008-10-28T23:24:43Z")

</div>

On 28 Pa¼, 23:05, Oliver Nightingale \<rails-mailing-l…@andreas-  
[s.net](http://s.net)\> wrote:

> store btw).
> 
> Any help is appreciated

Have you checked what is consuming the memory?  
The environment should take about 60mb (not 100% about that).  
From my experience most memory consuming operations are related with  
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.

cheers
