简体   繁体   中英

Close processing is slow, in elasticsearch's TransportClient. I want to quickly

  • Question

    1. Do I need TransportClient's close processing?
    2. Is there a way to speed up TransportClient's close processing?
  • 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.

code

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;
}

Environment

  • Language: Java 8
  • Framework: Spring
  • Elasticsearch client (jar) ver
    • org.elasticsearch: 5.1.1
    • org.elasticsearch.client: 5.1.1
  • Elasticsearch's ver: 5.3.1

It's problem in the design of network library Netty4. Look issue here and commit who introduce close method into Elasticsearch client here

For my opinion design of GlobalEventExecutor in Netty4 very bad and you can't speed up performance.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM