1. Skip to navigation
  2. Skip to content

The ELC Community Blog

A knowledge exchange on Ruby on Rails and Agile Development


Speedy Solr: XML Libraries

by Asa Wilson on June 02, 2008

Act_as_solr needs to create XML docs to submit to the Solr server, either during initial indexing or on save, delete, etc. Acts_as_solr depends on one of two gems for this xml document creation. It's first choice is libxml and the failover is rexml. There is no message about this and I haven't seen any documentation to this effect on the web but there it is sitting in the source code. Libxml is much much faster than rexml in this situation. When we intalled libxml on our servers the time to create the Solr docs dropped from ~7 seconds to ~1 second and the overall rows/second doubled!! That's an absurd speed difference!

The take away message is, if you are using acts_as_solr you should make sure you have the libxml-ruby gem installed!

Comments

Alex at 2:28 PM on June 2 2008

Your my hero!

Scott at 3:21 AM on June 3 2008

Yep…. REXML will bring any Ruby app to it’s knees. Hpricot is also a good alternative when there is a choice.

yawl at 12:20 PM on July 5 2008

I think this behavior comes fromsolr-ruby, which acts_as_solr depends on:

http://svn.apache.org/repos/asf/lucene/solr/trunk/client/ruby/solr-ruby/lib/solr/xml.rb

Add a comment


home | services | Ruby on Rails Development | code | blog | company