Jan and Shawn,
On 5/30/22 10:01, Jan Høydahl wrote:
To me it looks like it defaults to 10000 max connections per route
<https://github.com/apache/lucene-solr/blob/branch_8_11/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpClientUtil.java#L298>
in 8.11?
And you can override that if you provide your custom HttpClient using
Builder.withHttpClient(httpClient)
<https://github.com/apache/lucene-solr/blob/branch_8_11/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientBuilder.java#L36>.
PS: It may be possible to use latest 8.11.1 SolrJ in your app even if Solr
server side is an earlier 8.x version.
I'm using SolrJClient 7.3.0 and all of that is also possible (e.g. use
your own custom HttpClient). We use it to configure TLS and HTTP
authentication whenever necessary.
We just do it like this:
So an upgrade to 8.x isn't strictly necessary. For the Http2 stuff,
maybe it would be better to upgrade the client to get any refactorings
or bug fixes in that component that have been added since previous releases.
solrClient = new HttpSolrClient.Builder(url)
.withHttpClient(getHttpClient())
.build();
Our getHttpClient method builds its own ClientConnectionManager with
whatever limits we want on it.
-chris
30. mai 2022 kl. 15:06 skrev Shawn Heisey <apa...@elyograg.org>:
On 5/30/2022 12:30 AM, Clemens WYSS (Helbling Technik) wrote:
As you can see
* we keep one SolrClient-connection per core in a map and make use of these
connections
* making use of HttpSolrClient ( Http2SolrClient is denoted "experimental" and
has cause some problem )
* no special tweaking of underneath HttpClient
Any reason for this minimal setup not being able to stem many many concurrent
requests? What is the proposed SolrJ based solr client setup (for a single Solr
server)?
Vincenzo is correct. Used properly, the solr clients are thread-safe and
designed to handle concurrent connections.
You actually only need one HttpSolrClient per Solr instance (host/port
combination), not one for every core. When you make a request to Solr via a
SolrClient, you can tell it what core/collection should receive the request.
As long as the number of cores isn't enormous, having a client per core is not
likely to cause issues. Just something for you to think about the next time
you are ready to do a major code revision.
What version of SolrJ are you using in your code? For a long time, SolrJ
defaulted to an HttpClient that only allowed two threads per destination. Then
that was greatly increased. Now from what I can decipher in current 8.x code
using the Builder, we may be back to a default of two connections per
destination, which is NOT a good thing when concurrency is expected.
Looking at HttpSolrClientBuilder, I do not see a way to specify a custom http
client. Anyone know how that can be done?
Thanks,
Shawn