# ActiveRecord load time

**URL:** <https://www.ruby-forum.com/t/activerecord-load-time/109684>\
**Category:** Rails\
**Created:** [July 17, 2007, 9:50pm UTC](https://www.ruby-forum.com/t/activerecord-load-time/109684 "2007-07-17T21:50:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![eclubb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ecc23a/32.png) [@eclubb](https://www.ruby-forum.com/u/eclubb)\
**Post date:** [July 17, 2007, 9:50pm UTC](https://www.ruby-forum.com/t/activerecord-load-time/109684/1 "2007-07-17T21:50:51Z")

</div>

I’m using ActiveRecord outside of Rails. The time for a script to  
execute “require ‘active\_record’” is about 2.5 seconds on my 666 MHz  
machine. Is there any way to speed it up (aside from a faster  
processor)? Maybe some way to pre-load ActiveRecord? The script is  
invoked by a user action, so it needs to start quickly.

Thanks,  
Earle

---

<div class="post-metadata">

**Author:** ![eclubb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ecc23a/32.png) [@eclubb](https://www.ruby-forum.com/u/eclubb)\
**Post date:** [July 18, 2007, 4:21pm UTC](https://www.ruby-forum.com/t/activerecord-load-time/109684/2 "2007-07-18T16:21:12Z")

</div>

Get a faster machine.

---

<div class="post-metadata">

**Author:** ![eclubb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ecc23a/32.png) [@eclubb](https://www.ruby-forum.com/u/eclubb)\
**Post date:** [July 18, 2007, 4:40pm UTC](https://www.ruby-forum.com/t/activerecord-load-time/109684/3 "2007-07-18T16:40:14Z")

</div>

On 7/17/07, Earle C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’m using ActiveRecord outside of Rails. The time for a script to  
> execute “require ‘active\_record’” is about 2.5 seconds on my 666 MHz  
> machine. Is there any way to speed it up (aside from a faster  
> processor)? Maybe some way to pre-load ActiveRecord? The script is  
> invoked by a user action, so it needs to start quickly.

You can run it as a separate DRB process, and the user action just  
connects with DRB and invokes the action. Here’s a simple Daemon  
module so you can manage pids and all that:  
[http://snippets.dzone.com/posts/show/2265](http://snippets.dzone.com/posts/show/2265)

This is how rails (using mongrel/http or fcgi instead of drb of  
course) pre-loads the framework.

–  
Rick O.  
[http://lighthouseapp.com](http://lighthouseapp.com)  
[http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
[http://mephistoblog.com](http://mephistoblog.com)
