1

I have two simple Ruby on Rails applications with one using ActiveResource to access the other. The ActiveResource processing seems to be adding ~1000ms of overhead. These are the trace logs:

Requester:

Started GET "/documents/1/retrieve?name=LRActionItems" for 127.0.0.1 at 2011-07-28 17:24:07 -0400
  Processing by DocumentsController#retrieve as 
  Parameters: {"name"=>"LRActionItems", "id"=>"1"}
retrieving persistent_data for id 1 - name LRActionItems
GET http://localhost:3333/field_value_collections/1/field_values/find_by_field_name.xml?field_name=LRActionItems
--> 200 OK  639 (1030.1ms)
Rendered text template (0.0ms)
Completed 200 OK in 1037ms (Views: 1.0ms | ActiveRecord: 1.0ms)

Responder:

Started GET "/field_value_collections/1/field_values/find_by_field_name.xml?field_name=LRActionItems" for 127.0.0.1 at 2011-07-28 17:24:08 -0400
  Processing by FieldValuesController#find_by_field_name as XML
  Parameters: {"field_name"=>"LRActionItems", "field_value_collection_id"=>"1"}
Completed 200 OK in 3ms (Views: 1.0ms | ActiveRecord: 0.0ms)
cache: [GET /field_value_collections/1/field_values/find_by_field_name.xml?field_name=ULActionItems] miss

As you can see, the responder is responding in 3ms but the requester is requiring 1037ms because the ActiveResource request requires 1030.1ms.

I am in production mode (development mode is actually just a little slower - 10-15ms)

I'm using WEBrick and have done very little customization from the projects as generated.

Is this normal performance? Is there any configuration that can make this much better?

Robert Mitchell
  • 133
  • 1
  • 6
  • With a little more digging, I discovered that the overhead was caused by the DNS lookup on localhost. Changing the url from localhost to 127.0.0.1 resulted in 100ms response times instead of 1000+ms. Now why DNS is so slow is another question... – Robert Mitchell Jul 29 '11 at 14:48

0 Answers0