此内容没有您所选择的语言版本。

2.5. Tuning the Index


2.5.1. Exclusive Index Use

Lucene directory synchronizes access to the index using locks. For indices that are only ever accessed locally (such as RAM-based index, or filesystem index not shared between multiple nodes) you can set the following to gain a performance boost.
<property name="default.exclusive_index_use" value="true" />
Copy to Clipboard Toggle word wrap

Important

Set the default.exclusive_index_use property to false to allow multiple caches to share the same stored index. However, this is not recommended because index writes triggered by any of the caches that share the same index will then compete for the write lock. When this happens, unless the business logic ensures that there is no contention, timeouts can be triggered, which result in runtime exceptions.

2.5.2. Near-Realtime Index Manager

By default, each update is immediately flushed into the index. In order to achieve better throughput, the updates can be batched. However, this can result in a lag between the update and query -- the query can see outdated data. If this is acceptable, you can use the Near-Realtime Index Manager by setting the following.
<property name="default.indexmanager" value="near-real-time" />
Copy to Clipboard Toggle word wrap

2.5.3. Tuning Infinispan Directory

Lucene directory uses three caches to store the index:
  • Data cache
  • Metadata cache
  • Locking cache
Configuration for these caches can be set explicitly, specifying the cache names as in the example below, and configuring those caches as usual. All of these caches must be clustered unless you using Infinispan Directory in local mode.

Example 2.6. Tuning the Infinispan Directory

<namedCache name="indexedCache">
      <clustering mode="DIST" />
      <indexing enabled="true">
         <properties>
            <property name="default.indexmanager" value="org.infinispan.query.indexmanager.InfinispanIndexManager" />
            <property name="default.exclusive_index_use" value="{true|false}" />
            <property name="default.metadata_cachename" value="lucene_metadata_repl" />
            <property name="default.data_cachename" value="lucene_data_dist" />
            <property name="default.locking_cachename" value="lucene_locking_repl" />
         </properties>
      </indexing>
   </namedCache>
   <namedCache name="lucene_metadata_repl">
      <clustering mode="REPL" />
   </namedCache>
   <namedCache name="lucene_data_dist">
      <clustering mode="DIST" />
   </namedCache>
   <namedCache name="lucene_locking_repl">
      <clustering mode="REPL" />
   </namedCache>
Copy to Clipboard Toggle word wrap

Important

The default.exclusive_index_use configuration property in the provided sample configuration is set depending on which version of Red Hat JBoss Data Grid is in use:
  • when using JBoss Data Grid 6.3.0, set the default.exclusive_index_use to false.
  • when using JBoss Data Grid 6.3.1, to improve performance, either exclude default.exclusive_index_use (the default value true is then used) or explicitly set the value to true.

2.5.4. Per-Index Configuration

The indexing properties in examples above apply for all indices - this is because we use the default. prefix for each property. To specify different configuration for each index, replace default with the index name. By default, this is the full class name of the indexed object, however you can override the index name in the @Indexed annotation.
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat