I'm having serious difficulty in understanding what is eating up my java heap memory everytime I call a Solr service:
In my web application I have a front-end which calls a servlet, which sends a SolrQuery with this piece of code:
public class SolrService extends Application {
public static String url = Config.SOLR_HOST + ":" + Config.SOLR_SERVER_PORT;
final static HttpSolrServer solr = new HttpSolrServer(SolrService.url+"/"+Config.SOLR_INDEX+"/"+Config.SOLR_TYPE);
//in another class
SolrQuery query = new SolrQuery(q);
query.setStart(0);
query.setRows(limitRows);
query.addSortField("score", ORDER.desc);
QueryResponse response;
response = SolrService.solr.query(query,SolrRequest.METHOD.POST);
SolrDocumentList results = response.getResults();
SolrDocument doc = results.get(i);
//the response is then extracted in maps and returned
Everytime I do a request, my Java heap memory increases by a big jump. Here is the screen of the java heap memory at 0 queries done:
After trying an optimize
which was suggested on the admin page of the core, the heap fell by a lot: 1/10 the initial one:
But this is not a solution (maybe temporary, but I wouldn't know how to call it; maybe via some URL?)
I've seen that forcing a maximum number of results in the query the increase in heap memory is smaller.
What can I do and where can I look?
Could it be possible, that your solr cache grabs the heap?
It looks like that: increasing during the first queries and remaining unchanged after a while.
So you could run an optimize with an cache auto-warming to look, if the heap-size rises the same. And you could try to reduce your cache settings. Which is not recommended, but only to find the cause.
Take a look at this where you can find some reasons for growing heap: https://wiki.apache.org/solr/SolrPerformanceProblems#How_much_heap_space_do_I_need.3F
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.