lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Heisey <>
Subject Re: Understanding query behaviour in LBHttpSolrServer
Date Fri, 18 Jul 2014 06:41:46 GMT
On 7/17/2014 11:15 PM, search engn dev wrote:
> I just want to understand query flow and how load balancing works in case of
> LBHttpSolrServer. We have setup SolrCloud with one collection, and that
> collection has 4 shards and each shard has two nodes i.e one master and one
> replica.

If you're running SolrCloud and building client applications with SolrJ,
just use CloudSolrServer.  You just pass it the same zkHost value that
you give to SolrCloud itself, listing all your zookeeper servers.  The
CloudSolrServer object is a zookeeper client, so my understanding is
that it will dynamically adjust to the current clusterstate -- if
servers go down, get added, or get removed, the client will know as soon
as SolrCloud itself does, without restarting the application or building
a new client object.

CloudSolrServer will automatically load balance requests across the
nodes that comprise the collection that is being queried.  Newer
versions of the client will also route updates directly to the leader of
the correct shard, which reduces load on the servers and speeds up indexing.

Internally, CloudSolrServer uses an instance of LBHttpSolrServer, but
the list of URLs is dynamically managed, your program doesn't need to
worry about it.

Side questions/comments for experienced committers, I can file some
issues and work on these:

The javadoc for the first CloudSolrServer constructor just mentions
HOST:PORT for the format of zkHost.  Should that be expanded so that
it's apparent that if multiple ZK servers are present, they all need to
be listed?  All of the constructor javadocs could do with a little more

I think that "throws MalformedURLException" needs to be removed from the
second CloudSolrServer constructor.  When I tried that, eclipse didn't
show any errors.

Although it's not complex code, the various CloudSolrServer constructors
are very similar, the actual work should probably be done by one
constructor that is called by all the others.


View raw message