Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpSolrServer in the class of SearchServiceBean doesn't shutdown. #2706

Closed
pengchengluo opened this issue Oct 29, 2015 · 4 comments
Closed
Assignees
Labels
Component: Code Infrastructure formerly "Feature: Code Infrastructure" Feature: Search/Browse
Milestone

Comments

@pengchengluo
Copy link
Contributor

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.

@pdurbin
Copy link
Member

pdurbin commented Oct 29, 2015

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

@pengchengluo
Copy link
Contributor Author

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. ^_^

@pdurbin
Copy link
Member

pdurbin commented Nov 2, 2015

I just merged #2713 (a pull request from @pengchengluo ) to address this issue. Thanks @pengchengluo ! Sending to QA.

To test this, I ran my usual scripts/database/homebrew/rebuild-and-test script to make sure I got the output I expect.

@pdurbin pdurbin added this to the 4.3 milestone Nov 2, 2015
@pdurbin pdurbin modified the milestones: 4.2.2, 4.3 Nov 6, 2015
@kcondon
Copy link
Contributor

kcondon commented Nov 18, 2015

OK, search still works: basic, advanced, facets, index all.

@kcondon kcondon closed this as completed Nov 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Code Infrastructure formerly "Feature: Code Infrastructure" Feature: Search/Browse
Projects
None yet
Development

No branches or pull requests

3 participants