//代码
Long startTime = System.currentTimeMillis()
SearchResponse searchResponse = restHighlevelclient.search(searchRequest, RequestOptions.DEFAULT);
Long endTime = System.currentTimeMillis();
log.info("took time:{},execution time:{}",searchResponse.getTook() , (endTime - startTime) + "ms"):
//日志
took time:20ms ,execution time:80ms
took time:19ms ,execution time:77ms
took time:48ms ,execution time:349ms
took time:18ms ,execution time:65ms
took time:34ms ,execution time:884ms
took time:19ms ,execution time:59ms
took time:16ms ,execution time:55ms
took time:19ms ,execution time:1113ms
tookt ime:24ms ,execution time:65ms
tookt ime:16ms ,execution time:56ms
tookt ime:16ms ,execution time:909ms
索引总条数是 2w 条数据,查询条数是 1w 条,实际返回 6000 多条,条件很简单就一个 match ,发现代码实际执行时间不太稳定,应该不需要 1s ,请教下是什么原因?该怎么排查?
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
https://tanronggui.xyz/t/1001940
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.