This project is archived and is in readonly mode.

#1513 ✓wontfix
Kristoffer Paro

ActiveResource does not support keep-alive connections

Reported by Kristoffer Paro | December 3rd, 2008 @ 01:29 PM | in 2.x

ActiveResource::Connection sets up and tears down a new connection each time a request is performed. If the rails application performs multiple subsequent requests, this leads to immense performance degradation.

I have found the private http() method of ActiveResource::Connection to be the culprit. The method creates a new Net::HTTP object and returns it. When a request is performed with this object, the connection is opened and then immediately closed afterwards.

Instead, the method start() could be called on the object, and the object stored as a private instance variable. This way, the same open connection could be used for multiple subsequent requests.

The Rails version I use is 2.2.0

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket