gpt4 book ai didi

performance - 在Elasticsearch中排序

转载 作者:行者123 更新时间:2023-12-02 22:41:18 25 4
gpt4 key购买 nike

以下是保存在我的索引中的文档的数据模型:{"messageId":1,"commentId":1,"likes":1,"stars":1,"time":time in ms,"category":1,"deleted":false,"userid":1}
每条消息都有多个评论(以我的情况为2000左右)
带有基于messageId的路由的索引文档。
我目前有2亿条大小为31 GB的记录。

  • 分片数量:5
  • 副本数:3
    (商店总大小为180)
  • 节点数:4.每个节点有8GB内存,我正在使用4GB进行Elasticsearch。

  • 我的基本读取操作包括获取按喜欢,星级或时间排序的给定 commentIdsmessageId

    搜索查询: curl -XGET localhost:9200/_search?routing=${messageId}&q=messageId:${messageId}&sort=likes:desc&fields=commentId&_source=false
    当我使用1500个线程运行性能测试时,平均时间为6秒,而90%大约为20秒!这是客户端值。响应对象的取值从10ms到15s取决于负载。

    如何提高读取性能?

    最佳答案

    您可能正在达到群集的内存限制。您应该启用Java GC日志记录(例如,使用ES_USE_GC_LOGGING),并查看是否在GC中花费了大量时间。

    听起来您的性能测试正在创建大量同时请求。您可能正在填写thread pools。看一眼:

    $ curl -XGET "http://localhost:9200/_nodes/stats/thread_pool?pretty"

    最后,听起来您的分片数量相对较多。 A shard is not free(或 see this benchmark)。如果您有 index.number_of_replicas: 3,则可以设置 index.number_of_shards: 1,但仍然可以获得完整的集群利用率。

    关于performance - 在Elasticsearch中排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28022735/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com