Question
context
I am doing performance tuning.
TransportClient's close processing is slow.
I am in trouble very much.
I measured.
It took 2000 ms by close processing.
public SearchResponse search(SearchParam param) {
EsConnection connect = new EsConnection();
TransportClient client = connect.getTransportClient();
try {
long start1 = System.currentTimeMillis();
response = client.prepareSearch()
.setSize(param.getNum())
.setFrom(param.getFrom())
.setQuery(shouldQuery)
.execute()
.actionGet(timeoutMsec);
System.out.println(response);
long end1 = System.currentTimeMillis();
System.err.println("search:" + (end1 - start1) + "ms");
} catch (ElasticsearchException e) {
throw e;
} finally {
long start1 = System.currentTimeMillis();
client.close();
long end1 = System.currentTimeMillis();
System.err.println("close:" + (end1 - start1) + "ms");
}
return response;
}
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.