You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the class of edu.harvard.iq.dataverse.search.SearchServiceBean, every search request create a HttpSolrServer object. However, HttpSolrServer has a method named shutdown() which releases some resources. So the code must invoke the shutdown method.
Besides, when construct the HttpSolrServer object, it will create a HttpClient. This process is expensive and there is no need to create a new HttpSolrServer for every search request.
The text was updated successfully, but these errors were encountered:
@pengchengluo thanks for pointing this out! @bencomp and I chatted about this at http://irclog.iq.harvard.edu/dataverse/2015-10-29 (good catch, as he said) and I was wondering if you've measured how expensive the process is. Also, I would be more than happy to review a pull request if you are inclined to try addressing this issue!
Hi @pdurbin , I have done a simple test using the following code to measure the cost.
+++++++++++++++++
long pre = System.currentTimeMillis();
for(int i = 0;i<5000;i++){
SolrServer solrServer = new HttpSolrServer("http://localhost:8389/solr");
solrServer.shutdown();
}
System.out.println((double)(System.currentTimeMillis()-pre)/5000);
+++++++++++++++++
On my desktop computer which has a i5-3470 CUP (3.20GHz), the output is 0.206. So create a new SolrServer for each request is too expensive.
Yes, I'm very glad to contribute the dataverse. ^_^
In the class of edu.harvard.iq.dataverse.search.SearchServiceBean, every search request create a HttpSolrServer object. However, HttpSolrServer has a method named shutdown() which releases some resources. So the code must invoke the shutdown method.
Besides, when construct the HttpSolrServer object, it will create a HttpClient. This process is expensive and there is no need to create a new HttpSolrServer for every search request.
The text was updated successfully, but these errors were encountered: