# How to speed up ActiveResource?

**URL:** <https://www.ruby-forum.com/t/how-to-speed-up-activeresource/162107>\
**Category:** Rails\
**Created:** [March 5, 2009, 8:19pm UTC](https://www.ruby-forum.com/t/how-to-speed-up-activeresource/162107 "2009-03-05T20:19:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![roa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8e7dd6/32.png) [@roa](https://www.ruby-forum.com/u/roa)\
**Post date:** [March 5, 2009, 8:19pm UTC](https://www.ruby-forum.com/t/how-to-speed-up-activeresource/162107/1 "2009-03-05T20:19:13Z")

</div>

Hi all,

I’ve been experimenting with sharing resources between 2 rails apps with  
AR and I just love it. The only downside is that when using AR, my app  
slows down dramastically.

Is there a way to speed things up? Some special caching mechanisme that  
needs to be enabled?

Thank you in advance for the information.

---

<div class="post-metadata">

**Author:** ![roa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8e7dd6/32.png) [@roa](https://www.ruby-forum.com/u/roa)\
**Post date:** [March 5, 2009, 8:24pm UTC](https://www.ruby-forum.com/t/how-to-speed-up-activeresource/162107/2 "2009-03-05T20:24:20Z")

</div>

Michael R. wrote:

> Hi all,
> 
> I’ve been experimenting with sharing resources between 2 rails apps with  
> AR and I just love it. The only downside is that when using AR, my app  
> slows down dramastically.
> 
> Is there a way to speed things up? Some special caching mechanisme that  
> needs to be enabled?
> 
> Thank you in advance for the information.

Are you running in development mode or production mode?

Just need to get this question out of the way first.

---

<div class="post-metadata">

**Author:** ![roa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8e7dd6/32.png) [@roa](https://www.ruby-forum.com/u/roa)\
**Post date:** [March 5, 2009, 8:49pm UTC](https://www.ruby-forum.com/t/how-to-speed-up-activeresource/162107/3 "2009-03-05T20:49:58Z")

</div>

Robert W. wrote:

> Michael R. wrote:
> 
> > Hi all,
> > 
> > I’ve been experimenting with sharing resources between 2 rails apps with  
> > AR and I just love it. The only downside is that when using AR, my app  
> > slows down dramastically.
> > 
> > Is there a way to speed things up? Some special caching mechanisme that  
> > needs to be enabled?
> > 
> > Thank you in advance for the information.
> 
> Are you running in development mode or production mode?
> 
> Just need to get this question out of the way first.

Hi Robert

I’ running in production. I have noticed that development is slower then  
production, but the production speed is still far from acceptable. The  
diffrence between using ActiveRecord and ActiveResource is huge.

---

<div class="post-metadata">

**Author:** ![roa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8e7dd6/32.png) [@roa](https://www.ruby-forum.com/u/roa)\
**Post date:** [March 5, 2009, 10:55pm UTC](https://www.ruby-forum.com/t/how-to-speed-up-activeresource/162107/4 "2009-03-05T22:55:44Z")

</div>

Michael R. wrote:

> I’ running in production. I have noticed that development is slower then  
> production, but the production speed is still far from acceptable. The  
> diffrence between using ActiveRecord and ActiveResource is huge.

Yep, web services are generally much slower than SQL calls. There a lot  
more work to do. Think about something like the Music store built into  
iTunes that uses web services heavily. It’s not exactly stellar  
performance.

Who knows. Things like the work going into Rails 2.3 with RACK and METAL  
may provide some opportunity to optimize ActiveResource, but I doubt  
we’ll ever see comparable performance between ActiveRecord (or other  
ORMs) and ActiveResource. Improvements to ActiveResource will likely go  
hand-in-hand with improvements to ActiveRecord so the gap will remain.

Can you define “huge?” Do you have any benchmarks. That might help  
people here know whether it’s really a problem or just basically  
“normal.”

---

<div class="post-metadata">

**Author:** ![roa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8e7dd6/32.png) [@roa](https://www.ruby-forum.com/u/roa)\
**Post date:** [March 6, 2009, 9:33am UTC](https://www.ruby-forum.com/t/how-to-speed-up-activeresource/162107/5 "2009-03-06T09:33:17Z")

</div>

Robert W. wrote:

> Michael R. wrote:
> 
> > I’ running in production. I have noticed that development is slower then  
> > production, but the production speed is still far from acceptable. The  
> > diffrence between using ActiveRecord and ActiveResource is huge.
> 
> Yep, web services are generally much slower than SQL calls. There a lot  
> more work to do. Think about something like the Music store built into  
> iTunes that uses web services heavily. It’s not exactly stellar  
> performance.
> 
> Who knows. Things like the work going into Rails 2.3 with RACK and METAL  
> may provide some opportunity to optimize ActiveResource, but I doubt  
> we’ll ever see comparable performance between ActiveRecord (or other  
> ORMs) and ActiveResource. Improvements to ActiveResource will likely go  
> hand-in-hand with improvements to ActiveRecord so the gap will remain.
> 
> Can you define “huge?” Do you have any benchmarks. That might help  
> people here know whether it’s really a problem or just basically  
> “normal.”

Thank you Robert. I know that web services will always be slower then  
connecting directly to the DB. But I have worked with external  
webservices from third parties and my webservice is way to slow.

I have tested it again with a small benchmark by pulling a list of 50  
items and displaying them. It took 28733ms to pull the data over and  
display them on screen.

I know it’s not a server or network problem.

Thank you in for your patience
