开发者

Solrj (1.4.1) performance related query

I am using Solrj as a Solr client in my project.

While searching, for a few words, it seems Solrj takes more time to send response, for eg (8 - 12 sec). While searching most of the other words it seems Solrj take less amount of time only.

For eg, if I post a search url in browser, it shows the QTime in milliseconds only.

http://serverName/solr/mydata/select?q=computing&qt=myhandler&fq=category:1

But, if I query the same using Solrj from my project like below, it takes long time(8 - 12 sec) to produce the same results. Hence, I suspect whether So开发者_如何学Pythonlrj takes such long time to produce results.

SolrServer server = new CommonsHttpSolrServer(url); SolrQuery query = new SolrQuery("computing"); query.setParam("qt", "myhandler"); query.setFilterQueries("category:1"); query.setHighlight(false); QueryResponse rsp = server.query( query );

I have tried both POTH and GET method. But, both are taking much time.

Any idea why Solrj takes such long time for particular words. It returns around 40 doc list as a search result. I have even comment out highlighting for that.

And any way to speed it up.

Note: I am using Tomcat and set heap size as around 1024 mb. And I am using Solr 1.4.1 version.

Thanks,


SolrJ does not give a large performance impact over hitting Solr directly. I'm using it, and queries taking 2-3ms within Solr are being returned over the network in around 12-15ms, including going through a full web stack and marshalling to Json. I suspect there's an error elsewhere in your code. Try getting a profile or sprinkling some print statements to see where the time is being lost. If you're going across the network (I suspect you are), try doing a ping to see what the response times are. You could also try a curl request from your source server to your Solr server to see what the raw response times are


I was able to tweak PHP to get on par performance with Java's SolrJ. However, it was a lot of work and not full proof. The biggest problem with PHP is not speed but memory leaks. When you index thousands of records, you have to loop through them and that produces memory leaks in PHP. I divided the PHP batch process up by using bash scripts to call smaller batches in PHP. But I would still get failed indexing. Java's SolrJ solves the memory leak problems and offers better reliability. Java is fast without having to jump through creative hoops to get speed like I had to do with bash scripts and PHP.

Also, don't commit your records in SolrJ. Turn on auto commit on solr's config and allow Solr to handle committing. So much faster.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜