Some Ajax requests hang

I have a Rails 2.2.2 site that is running on four mongrels, balanced
via Apache and mod_balancer. This architecture has worked very
efficiently in the past, but I’m now observing requests hanging almost
indefinitely with a newer version of the site. I haven’t yet been able
to pin this on anything in particular, as the nature of the requests
is fairly similar between the two site versions.

More importantly, I don’t know how to investigate the trouble further,
which is why I’m writing to this list.

On a given site, a particular request seems to be able to completely
tie up a Mongrel. It doesn’t take long before all four are tied up,
rendering the site essentially unusable. Here is an example of an
action which I’ve confirmed does this. “extjs” is a convenience
function that with the provided args below simple does a render :json.
This action is requested with the POST method and a single param:

class DocumentController
def family
if params[:id]
doc = Document.find(params[:id])
if doc
extjs :family => doc.family
else
extjs :success => false
end
else
extjs :success => false
end
end
end

class Document
def family
Document.all(:conditions => { :parent_id => self.parent_id })
end
end

The model method returns at most fewer than ten documents, and for the
majority documents only the document itself, so I don’t see anything
that would tie up the server. The document lookup itself is very
efficient and is used elsewhere with no problems. Is there anything
about this action that suggests it would cause the behavior I’ve
observed?

Thanks,
Thomas A.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs