• [转]Lucene 性能优化带数据


    虽然是很久了的数据,还是有很好的参考价值的:

    lucene.commit.batch.size=0
    lucene.commit.time.interval=0

    These properties allow commits in batch, you can either set how many document changes a batch will contain (commit will happen after X docs are modified) or set a time interval in milliseconds (commit will happen every X milliseconds).

    lucene.buffer.size=16

    This will call IndexWriter's setRAMBufferSizeMB method, this the max memory in megabytes used by Lucene before flushing documents, a higher number means less disk writes.

    These 3 new properties will make reindexing faster, I've made stress tests and I could perceive a 30% improvement in certain configurations, I also learned the following while tweaking Lucene properties:

    A higher lucene.buffer.size helps a lot during reindex, but there is a up bound limit, over that limit, reindex won't get faster, for example, setting to 32MB or 48MB gave the same results, but 32MB was much better than the default, 16MB.

    It's a bad idea to set lucene.merge.factor to a very high number, there will be much more disk write accesses and this will degrade performance, keep it at 10.

    Set lucene.autocommit.documents.interval to the number of documents you have in the index, this means only 1 commit will happen. I thought this property would bring better performance results, but it made it faster around 15% only.

    Setting a higher lucene.optimize.interval can make some improvement, but since the reindex process also make searches, it's important that you also optimize the index often during reindex, you need to find a balance.

    My stress tests consisted in reindexing 30.000 blog entries, I tested on a Intel Quadcore 2.66GHz, 4MB of RAM, Ubuntu 32 bits. The best result was around 4 minutes with this configuration:

    lucene.commit.time.interval=30000
    lucene.merge.factor=10
    lucene.optimize.interval=10000
    lucene.buffer.size=48

    The worst result was 7:35 minutes (not considering the one I set lucene.merge.factor to 1000):

    lucene.commit.time.interval=0
    lucene.merge.factor=50
    lucene.optimize.interval=1000
    lucene.buffer.size=16

    Here are the other results:

    lucene.commit.time.interval=0
    lucene.merge.factor=15
    lucene.optimize.interval=30000
    lucene.buffer.size=16
    7:30 minutes

    lucene.commit.time.interval=0
    lucene.merge.factor=10
    lucene.optimize.interval=100
    lucene.buffer.size=16
    7:18 minutes

    lucene.commit.time.interval=10000
    lucene.merge.factor=10
    lucene.optimize.interval=100
    lucene.buffer.size=16
    06:23 minutes

    lucene.commit.time.interval=1000
    lucene.merge.factor=10
    lucene.optimize.interval=100
    lucene.buffer.size=16
    6:00 minutes

    lucene.commit.time.interval=30000
    lucene.merge.factor=10
    lucene.optimize.interval=100
    lucene.buffer.size=32
    5:00 minutes

    lucene.commit.time.interval=30000
    lucene.merge.factor=10
    lucene.optimize.interval=100
    lucene.buffer.size=48
    5:00 minutes

    lucene.commit.time.interval=30000
    lucene.merge.factor=10
    lucene.optimize.interval=50000
    lucene.buffer.size=48
    5:00 minutes

    lucene.commit.time.interval=15000
    lucene.merge.factor=10
    lucene.optimize.interval=10000
    lucene.buffer.size=48
    5:00 minutes

    lucene.commit.time.interval=30000
    lucene.merge.factor=10
    lucene.optimize.interval=1000
    lucene.buffer.size=48
    4:30 minutes

     

  • 相关阅读:
    12.使用正则表达式
    12/12
    thinkphp 5 及一下或php项目里实现模糊查询
    mysql中文乱码--存入mysql里的中文变成问号的解决办法
    ATOM使用的一点心得与技巧——在一个窗口打开多个项目
    php里的$this的 含义
    pycharm2017.3专业版激活注册码
    thinkphp3.2.3的使用心得之i方法(零)
    thinkphp3.2.3的使用心得(零)
    linux系统下phpstudy里的mysql使用方法
  • 原文地址:https://www.cnblogs.com/jinzhao/p/2444440.html
Copyright © 2020-2023  润新知