Fix slow specs using SOLR

Updated . Posted . Visible to the public.

I've recently encountered a weird problem with specs making lots of SOLR queries using the acts_as_solr plugin: After a certain number of specs, exactly one spec suddenly took over 30 seconds to finish.

It turns out that for some reason, the SOLR server seemed not to close its HTTP connections properly. After the maximum number of connections was reached, the next spec needed to wait for an old connection to time out.

I'm not exactly sure why this happened, why it only seems to be happening in specs and which part of the code is actually to blame. It might even have been fixed in a newer version of SOLR. As a workaround I simply reduced the timeout for old connections from 50 to 10 seconds. You can do this by finding the etc/jetty.xml file (which lives within the acts_as_solr plugin), and looking for
...

Tobias Kraze
Last edit
License
Source code in this card is licensed under the MIT License.
Posted by Tobias Kraze to makandra dev (2011-07-12 08:30)