You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by spillane <sp...@aol.com> on 2015/04/27 23:44:35 UTC

Load balancer for indexing?

I manage a SolrCloud with 5 shards.  Queries go thru an AWS load balancer but
indexing does not, so my leader1 is getting clobbered.  Should my SolrJ app
be pointing at a load balancer and if so will indexing via the
ConcurrentUpdateSolrServer class still work?     



--
View this message in context: http://lucene.472066.n3.nabble.com/Load-balancer-for-indexing-tp4202707.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Load balancer for indexing?

Posted by Shawn Heisey <ap...@elyograg.org>.
On 4/28/2015 1:14 PM, spillane wrote:
> I see that CloudSolrServer appeared in SolrJ 4.5, will that work with a 4.2
> SolrCloud?  If so I'll upgrade my client and point the CloudSolrServer
> constructor at my 5 ZK hosts.
>
> I would still use ConcurrentUpdateSolrServer as it is good for catching up
> when my indexing has fallen behind.  I know it swallows exceptions.

CloudSolrServer first appeared in Solr 4.0.0.  Here's the 4.0.0 javadoc
for that class:

http://lucene.apache.org/solr/4_0_0/solr-solrj/org/apache/solr/client/solrj/impl/CloudSolrServer.html

A 4.5 SolrJ MIGHT work with a 4.2 SolrCloud, but I'm not sure I'm brave
enough to try it in production.  SolrCloud has evolved *very* quickly in
every single release since 4.0, when it became available, and I would
not be surprised to learn that the version combination you've mentioned
won't work.

The capability for CloudSolrServer to send updates to shard leaders did
not become available until SolrJ 4.5 ... but that's one of the big
reasons that I think it's a bad idea to try and use it with a 4.2
cluster.  I would not be surprised to learn that the capability requires
at least 4.5 on the *server* side as well.

As an FYI -- Solr 4.2.0 was released three years ago.  The number of
bugs fixed in that time is HUGE.  One particularly annoying bug ...
core/collection reloads in SolrCloud don't work right until version
4.4.  Before that, you have to completely restart Solr.

Thanks,
Shawn


Re: Load balancer for indexing?

Posted by Chris Hostetter <ho...@fucit.org>.
: I would still use ConcurrentUpdateSolrServer as it is good for catching up
: when my indexing has fallen behind.  I know it swallows exceptions.

I feel like you are missing the point of when/why 
ConcurrentUpdateSolrServer compared to your goal of "load balancing" 
updates.

The *only* feature ConcurrentUpdateSolrServer gives you over any other 
type of SolrServer is that it, internally, has a background thread which 
collects up and sends big blocks of documents to the server it points at 
behind the scenes.  sending big blocks of documents is the antithesis of 
your stated goal to "load balance" those updates to multiple servers.

If the reason you like using ConcurrentUpdateSolrServer is because of hte 
background thread, but you don't wnat the "big batches" you could just use 
wrap a regular HttpSolrServer (pointed at your load balancer) inside of a 
helper method that used an ExecutorServvice (or something else like it) to 
handle hte background thread yourself.

But again, because of how SolrCloud works, the *best* way to speed up 
performance of indexing is to minimize the amount of data going over the 
wire -- when you send documents to an *arbitrary* SolrCloud node, it will 
do the right thing, and forward those documents to the correct "leader" 
for the appropriate shard of hat document -- but if you use 
CloudSolrServer you can help eliminate one completely "hop" of that 
document in the network by letting your client talk directly to the 
*right* leader.

So even better then using HttpSolrServer with a load balancer (behind a 
multi-threaded executor if that's what you want) is using a 
CloudSolrServer -- it's like using a smart software load balancer that 
knows *exactly* which node to send the HTTP request to -- not because of 
CPU load, or current net connections, but because of where the data *must* 
ultimately be sent anyway.


-Hoss
http://www.lucidworks.com/

Re: Load balancer for indexing?

Posted by spillane <sp...@aol.com>.
Shawn / Hoss,

I see that CloudSolrServer appeared in SolrJ 4.5, will that work with a 4.2
SolrCloud?  If so I'll upgrade my client and point the CloudSolrServer
constructor at my 5 ZK hosts.

I would still use ConcurrentUpdateSolrServer as it is good for catching up
when my indexing has fallen behind.  I know it swallows exceptions.

S 



--
View this message in context: http://lucene.472066.n3.nabble.com/Load-balancer-for-indexing-tp4202707p4202882.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Load balancer for indexing?

Posted by Chris Hostetter <ho...@fucit.org>.
: I manage a SolrCloud with 5 shards.  Queries go thru an AWS load balancer but
: indexing does not, so my leader1 is getting clobbered.  Should my SolrJ app
: be pointing at a load balancer and if so will indexing via the
: ConcurrentUpdateSolrServer class still work?     

The "Concurrent" part of that class name refers to the fact that it 
streams docs to a server i na backround thread -- so using htat with a 
load balancer isn't going to work the way you might think.

If you'd like to better distribute the updates across your cluster, you 
should use CloudSolrClient/CloudSolrServer (depending on your SolrJ 
version) which will ensure that documents are routed directly to the 
appropriate leader for the *correct* shard of each document.




-Hoss
http://www.lucidworks.com/

Re: Load balancer for indexing?

Posted by Shawn Heisey <ap...@elyograg.org>.
On 4/27/2015 3:44 PM, spillane wrote:
> I manage a SolrCloud with 5 shards.  Queries go thru an AWS load balancer but
> indexing does not, so my leader1 is getting clobbered.  Should my SolrJ app
> be pointing at a load balancer and if so will indexing via the
> ConcurrentUpdateSolrServer class still work?

There are two problems with ConcurrentUpdateSolrServer (CUSS) in your
situation.

One is that it is not cloud-aware.  Only the cloud object --
CloudSolrServer (CloudSolrClient in 5.0 and later) is cloud-aware.

The other problem is that CUSS swallows exceptions.  The Solr server
that you are connecting to with CUSS could be entirely down and your
code would think the update had succeeded.

If you are only querying and updating Solr with the cloud object in
SolrJ, you do not need a load balancer at all, and index updates will
proceed as fast as they can, because the cloud object knows where the
shard leaders are.

SolrCloud will handle indexing requests properly no matter what server
receives them, so a load balancer does not present a problem with it
working correctly, although it might present a performance issue.  If
the update is sent somewhere other than the leader replica of the shard
that will actually contain the document, indexing is much slower than
optimal.

Thanks,
Shawn