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 Ranveer <ra...@gmail.com> on 2011/06/17 08:30:35 UTC

about the SolrServer server = new CommonsHttpSolrServer(URL);

Dear all,

I am using

SolrServer server =  new CommonsHttpSolrServer(URL);

through out the class. How can I improve the connection, in my case: 
should I need to close the server after fetching the result or 
CommonsHttpSolrServer(URL); will maintain at their end. There is other 
way: I can make this as static and can use through out the classes.

please suggest..

regards


Re: about the SolrServer server = new CommonsHttpSolrServer(URL);

Posted by Erick Erickson <er...@gmail.com>.
I suggest you just try some things and see. The real problem isn't
the SolrJ side, it's whether your Solr instance can handle the load.

But assuming that your Solr instance can keep up, there's no reason
setting this to 30-40 would be a problem.

You might also think about using something like jMeter to exercise
your server to see if #it# will handle the load.

Best
Erick

On Sun, Jun 19, 2011 at 2:05 PM, Ranveer <ra...@gmail.com> wrote:
> thanks..
> however few more query.
> How to maintain connections threads (max and min settings)?
> What would be ideal setting for max in setMaxConnectionsPerHost method. Will
> it be ok for 30 to 40 concurrent user. How thread will be maintain for
>
> MultiThreadedHttpConnectionManager class.
>
>
>
> On Sunday 19 June 2011 02:04 PM, Ahmet Arslan wrote:
>>>
>>> for heavy use (30 to 40 concurrent
>>> user) will it work.
>>> How to open and maintain more connection at a time like
>>> connection pool. So
>>> user cat receive fast response..
>>
>> It uses HttpClient under the hood. You can pass httpClient to its
>> constructor too. It seems that MultiThreadedHttpConnectionManager has
>> setMaxConnectionsPerHost method.
>>
>> String serverPath = "http://localhost:8983/solr";
>> HttpClient client = new HttpClient(new
>> MultiThreadedHttpConnectionManager());
>> URL url = new URL(serverPath);
>> CommonsHttpSolrServer solrServer = new CommonsHttpSolrServer(url, client);
>
>

Re: about the SolrServer server = new CommonsHttpSolrServer(URL);

Posted by Ranveer <ra...@gmail.com>.
thanks..
however few more query.
How to maintain connections threads (max and min settings)?
What would be ideal setting for max in setMaxConnectionsPerHost method. 
Will it be ok for 30 to 40 concurrent user. How thread will be maintain for

MultiThreadedHttpConnectionManager class.



On Sunday 19 June 2011 02:04 PM, Ahmet Arslan wrote:
>> for heavy use (30 to 40 concurrent
>> user) will it work.
>> How to open and maintain more connection at a time like
>> connection pool. So
>> user cat receive fast response..
> It uses HttpClient under the hood. You can pass httpClient to its constructor too. It seems that MultiThreadedHttpConnectionManager has setMaxConnectionsPerHost method.
>
> String serverPath = "http://localhost:8983/solr";
> HttpClient client = new HttpClient(new MultiThreadedHttpConnectionManager());
> URL url = new URL(serverPath);
> CommonsHttpSolrServer solrServer = new CommonsHttpSolrServer(url, client);


Re: about the SolrServer server = new CommonsHttpSolrServer(URL);

Posted by Ahmet Arslan <io...@yahoo.com>.
> for heavy use (30 to 40 concurrent
> user) will it work.
> How to open and maintain more connection at a time like
> connection pool. So
> user cat receive fast response..

It uses HttpClient under the hood. You can pass httpClient to its constructor too. It seems that MultiThreadedHttpConnectionManager has setMaxConnectionsPerHost method.

String serverPath = "http://localhost:8983/solr";
HttpClient client = new HttpClient(new MultiThreadedHttpConnectionManager());
URL url = new URL(serverPath);
CommonsHttpSolrServer solrServer = new CommonsHttpSolrServer(url, client);

Re: about the SolrServer server = new CommonsHttpSolrServer(URL);

Posted by Jonty Rhods <jo...@gmail.com>.
for heavy use (30 to 40 concurrent user) will it work.
How to open and maintain more connection at a time like connection pool. So
user cat receive fast response..

regards




On Fri, Jun 17, 2011 at 12:50 PM, Ahmet Arslan <io...@yahoo.com> wrote:

> > SolrServer server =  new CommonsHttpSolrServer(URL);
> >
> > through out the class. How can I improve the connection, in
> > my case: should I need to close the server after fetching
> > the result or CommonsHttpSolrServer(URL); will maintain at
> > their end. There is other way: I can make this as static and
> > can use through out the classes.
>
> As wiki [1] says, you must use the same instalce through out all of the
> classes.
>
> [1] http://wiki.apache.org/solr/Solrj#CommonsHttpSolrServer
>

Re: about the SolrServer server = new CommonsHttpSolrServer(URL);

Posted by Ahmet Arslan <io...@yahoo.com>.
> SolrServer server =  new CommonsHttpSolrServer(URL);
> 
> through out the class. How can I improve the connection, in
> my case: should I need to close the server after fetching
> the result or CommonsHttpSolrServer(URL); will maintain at
> their end. There is other way: I can make this as static and
> can use through out the classes.

As wiki [1] says, you must use the same instalce through out all of the classes.

[1] http://wiki.apache.org/solr/Solrj#CommonsHttpSolrServer