SolrJ used to control Solr/Luce vs. Straight Rest

2019-08-03 18:31发布

问题:

We are running a TomCat servlet (Railo) for a public facing REST application. I've started implementing SolrJ to control a standalone Solr cluster. Queries are working well, but I'm scratching my head over the flow vs. just using the straight HTTP interface Solr provides. I thought there was some performance benefit to using SolrJ which is why I started implementing it, but from what I'm reading and seeing in response times, I think I was wrong on that account (?).

Is there any real advantage to using SolrJ vs. just manipulating and returning the JSON response from Solr? I certainly get using SolrJ for a java application that is not returning JSON/XML to the client.

回答1:

I'm not aware of any claims of improved performance with SolrJ. It's designed, mostly, to be an easy-to-use way to interface with Solr. SolrJ might prevent you getting away with some things the Solr interface allows that would perform very poorly, but for simple searches on the index, I don't see it generating a signficant speed improvement.

One performance benefit from SolrJ that I do see: ConcurrentUpdateSolrServer looks like a performant way to handle updates, particularly with large batches of updates. I would expect it to perform much better, especially with heavy loads, than the naive implementation of just establishing a connection and sending updates one at a time.