Does instantiating a Solr::Connection for each request make things better?

        Erik

On Aug 14, 2011, at 11:34 , Ian Connor wrote:

> It is nothing special - just like this:
> 
>    conn   = Solr::Connection.new("http://#{LOCAL_SHARD}";,
>     {:timeout => 1000, :autocommit => :on})
>    options[:shards] = HA_SHARDS
>    response = conn.query(query, options)
> 
> Where LOCAL_SHARD points to a haproxy of a single shard and HA_SHARDS is an
> array of 18 shards (via haproxy).
> 
> Ian.
> 
> On Mon, Aug 8, 2011 at 12:50 PM, Erik Hatcher <[email protected]>wrote:
> 
>> Ian -
>> 
>> What does your solr-ruby using code look like?
>> 
>> Solr::Connection is light-weight, so you could just construct a new one of
>> those for each request.  Are you keeping an instance around?
>> 
>>     Erik
>> 
>> 
>> On Aug 8, 2011, at 12:03 , Ian Connor wrote:
>> 
>>> Hi,
>>> 
>>> I have seen some of these errors come through from time to time. It looks
>>> like:
>>> 
>>> /usr/lib/ruby/1.8/net/http.rb:1060:in
>>> `request'\n/usr/lib/ruby/1.8/net/http.rb:845:in `post'
>>> 
>>> /usr/lib/ruby/gems/1.8/gems/solr-ruby-0.0.8/lib/solr/connection.rb:158:in
>>> `post'
>>> 
>>> /usr/lib/ruby/gems/1.8/gems/solr-ruby-0.0.8/lib/solr/connection.rb:151:in
>>> `send'
>>> 
>>> /usr/lib/ruby/gems/1.8/gems/solr-ruby-0.0.8/lib/solr/connection.rb:174:in
>>> `create_and_send_query'
>>> 
>>> /usr/lib/ruby/gems/1.8/gems/solr-ruby-0.0.8/lib/solr/connection.rb:92:in
>>> `query'
>>> 
>>> It is as if the http object has gone away. Would it be good to create a
>> new
>>> one inside of the connection or is something more serious going on?
>>> ubuntu 10.04
>>> passenger 3.0.8
>>> rails 2.3.11
>>> 
>>> --
>>> Regards,
>>> 
>>> Ian Connor
>> 
>> 
> 
> 
> -- 
> Regards,
> 
> Ian Connor
> 1 Leighton St #723
> Cambridge, MA 02141
> Call Center Phone: +1 (714) 239 3875 (24 hrs)
> Fax: +1(770) 818 5697
> Skype: ian.connor

Reply via email to