使用
Infinispan 6.0.0 Hibernate Search 4.4.0
但索引似乎非常缓慢。
以下是DefaultCacheManager中的jmx统计信息......
averageReadTime:0 averageWriteTime:9903
我尝试了max_merge_docs和merge_factor以及ram_buffer,如文档中所示:http://docs.jboss.org/hibernate/search/4.4/reference/en-US/html/search-configuration.html#d0e2031
但这似乎什么都不做。唯一有效的方法是碎片的数量......
<namedCache name="myCache">
<clustering mode="distribution">
<async/>
<hash numOwners="1"/>
</clustering>
<indexing enabled="true" indexLocalOnly="true">
<properties>
<property name="default.directory_provider" value="ram" />
<property name="default.indexwriter.merge_factor" value="30000" />
<property name="default.indexwriter.ram_buffer_size" value="1024" />
<!--<property name="default.sharding_strategy.nbr_of_shards" value="4" /> -->
</properties>
</indexing>
</namedCache>
上面的值是我尝试的最后一个。我尝试了不同的无济于事。只有nbr_of_shards似乎加速了一点点。
模特......
@Indexed
@ProvidedId
public class MyModel implements Serializable
{
@DocumentId
Integer id;
Integer prop1;
Integer prop2;
@Field(analyze = Analyze.NO)
String prop3;
@Field(analyze = Analyze.NO)
String prop4;
@Field(analyze = Analyze.NO)
String prop5;
@Field(analyze = Analyze.NO)
String prop6;
@Field(analyze = Analyze.NO)
String prop7;
@Field(analyze = Analyze.NO)
String prop9;
@Field(analyze = Analyze.NO)
Long prop10;
}
在我的servlet中,doPost()
MyModel model = new MyModel();
// Get POST params here and set the model properties...
cache.put(id, model);
out.println("Added!");