Lucene索引性能与数据

本文转载自:[url]http://www.cnblogs.com/jinzhao/archive/2012/04/12/2444440.html[/url]


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

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.

<hr />
My stress tests consisted in reindexing 30.000 blog entries, I tested on a Intel Quadcore 2.66GHz, 4MB of RAM, Ubuntu 32 bits. [i]The best result was around 4 minutes with this configuration:[/i]
lucene.commit.time.interval=30000
lucene.merge.factor=10
lucene.optimize.interval=10000
lucene.buffer.size=48

[i]The worst result was 7:35 minutes[/i] (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

[i]Here are the other results:[/i]
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


作者:KKcat
    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值