[ 
https://issues.apache.org/jira/browse/SOLR-835?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12645390#action_12645390
 ] 

noble.paul edited comment on SOLR-835 at 11/7/08 9:13 AM:
----------------------------------------------------------

bq.Attempting to save that allocation in the context of a complete 
request/response over the network perhaps isn't worth it?

Yes , it is cheap but the point is we can avoid it. 
It creates a new Object of CommonsHttpSolrServer, BinaryResponseParser, URL, 
String concatenation and if a take a look at the constructor of  
{code}
public CommonsHttpSolrServer(URL baseURL, HttpClient client, ResponseParser 
parser, boolean useMultiPartPost) {
    _baseURL = baseURL.toExternalForm();
    if( _baseURL.endsWith( "/" ) ) {
      _baseURL = _baseURL.substring( 0, _baseURL.length()-1 );
    }
    if( _baseURL.indexOf( '?' ) >=0 ) {
      throw new RuntimeException( "Invalid base url for solrj.  The base URL 
must not contain parameters: "+_baseURL );
    }
 
    _httpClient = (client == null) ? new HttpClient(new 
MultiThreadedHttpConnectionManager()) : client;

    if (client == null) {
      // set some better defaults if we created a new connection manager and 
client
      
      // increase the default connections
      this.setDefaultMaxConnectionsPerHost( 32 );  // 2
      this.setMaxTotalConnections( 128 ); // 20
    }

    // by default use the binary response parser
    _parser = parser;
    
    this.useMultiPartPost = useMultiPartPost;
  }

{code}
it is doing so many string operations etc.

Considering the fact that the shards are always going to be few and constant 
over the life of a server this looked bad to me.

      was (Author: noble.paul):
    bq.Attempting to save that allocation in the context of a complete 
request/response over the network perhaps isn't worth it?

Yes , it is cheap but the point is we can avoid it. 
It creates a new Object of CommonsHttpSolrServer, BinaryResponseParser, URL, 
String concatenation and if a take a look at the constructor of  
{code}
public CommonsHttpSolrServer(URL baseURL, HttpClient client, ResponseParser 
parser, boolean useMultiPartPost)   
{code}
it is doing so many string operations etc.

Considering the fact that the shards are always going to be few and constant 
over the life of a server this looked bad to me.
  
> reduce Object creation in SearchHandler
> ---------------------------------------
>
>                 Key: SOLR-835
>                 URL: https://issues.apache.org/jira/browse/SOLR-835
>             Project: Solr
>          Issue Type: Improvement
>    Affects Versions: 1.4
>            Reporter: Noble Paul
>             Fix For: 1.4
>
>         Attachments: SOLR-835.patch
>
>
> CommonsHttpSolrServer is threadsafe . why create one for every request?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to