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

Shalin Shekhar Mangar commented on SOLR-906:
--------------------------------------------

I've started taking a look at this. A couple of points:

* Instantiating the lock in blockUntilFinished and nulling it can cause a race 
condition. A thread in the 'add' method can find that the lock is not null, 
another thread can null it and the first thread proceeds to lock on it leading 
to NPE. In the same way, creation of multiple locks is possible in the 
blockUntilFinished method.
* The run method calling itself recursively looks suspicious. We may be in 
danger of overflowing the stack.
* The SolrExampleTest cannot be used directly because it depends on the order 
of the commands being executed. We must clearly document that clients should 
not depend on the order of commands being executed in the same order as they 
are given.
* The if (req.getCommitWithin() < 0) should be > 0, right?
* The add calls do not come to the process method. Due to this some add calls 
may still get in before the commit acquires the lock (assuming multiple 
producers). Is this class strictly meant for a single document producer 
use-case?
* The wait loop in blockUntilFinished is very CPU intensive. It can probably be 
optimized.

I'm experimenting with a slightly different implementation. Still trying to tie 
the loose ends. I hope to have a patch soon.

> Buffered / Streaming SolrServer implementaion
> ---------------------------------------------
>
>                 Key: SOLR-906
>                 URL: https://issues.apache.org/jira/browse/SOLR-906
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>            Reporter: Ryan McKinley
>            Assignee: Shalin Shekhar Mangar
>             Fix For: 1.4
>
>         Attachments: SOLR-906-StreamingHttpSolrServer.patch, 
> SOLR-906-StreamingHttpSolrServer.patch, StreamingHttpSolrServer.java
>
>
> While indexing lots of documents, the CommonsHttpSolrServer add( 
> SolrInputDocument ) is less then optimal.  This makes a new request for each 
> document.
> With a "StreamingHttpSolrServer", documents are buffered and then written to 
> a single open Http connection.
> For related discussion see:
> http://www.nabble.com/solr-performance-tt9055437.html#a20833680

-- 
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