Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
use a different named cache for binary data than other modeshape data
  • Loading branch information
cbeer committed Apr 19, 2013
1 parent 9280b55 commit 2973753
Show file tree
Hide file tree
Showing 3 changed files with 157 additions and 8 deletions.
Expand Up @@ -24,7 +24,69 @@
</clustering>
</default>

<namedCache name="FedoraRepository">

<namedCache name="FedoraRepository">
<!--
Our Infinispan cache needs to be transactional. However, we'll also configure it to
use pessimistic locking, which is required whenever applications will be concurrently
updating nodes within the same process. If you're not sure, use pessimistic locking.
-->
<clustering mode="replication">
<sync/>
<stateTransfer chunkSize="100" fetchInMemoryState="true"/>
</clustering>

<locking concurrencyLevel="1000" lockAcquisitionTimeout="15000" useLockStriping="false" />

<deadlockDetection enabled="true" spinDuration="1000"/>


<eviction maxEntries="500" strategy="LIRS" threadPolicy="DEFAULT"/>

<transaction
transactionManagerLookupClass="org.infinispan.transaction.lookup.GenericTransactionManagerLookup"
transactionMode="TRANSACTIONAL" lockingMode="PESSIMISTIC"/>
<!--
Define the cache loaders (i.e., cache stores). Passivation is false because we want *all*
data to be persisted, not just what doesn't fit into memory. Shared is false because there
are no other caches sharing this file store. We set preload to false for lazy loading;
may be improved by preloading and configuring eviction.
We can have multiple cache loaders, which get chained. But we'll define just one.
-->

<loaders passivation="false" shared="false" preload="false">

<!--
The 'fetchPersistentState' attribute applies when this cache joins the cluster; the value doesn't
really matter to us in this case. See the documentation for more options.
-->
<loader class="org.infinispan.loaders.file.FileCacheStore" fetchPersistentState="true"
purgeOnStartup="false">
<!-- See the documentation for more configuration examples and flags. -->
<properties>
<!-- We have to set the location where we want to store the data. -->
<property name="location" value="${fcrepo.ispn.CacheDirPath:target/FedoraRepository/storage}"/>

<property name="fsyncMode" value="perWrite"/>
</properties>
<!-- This repository isn't clustered, so we could set up the SingletonStore.
singletonStore enabled="true" pushStateWhenCoordinator="true" pushStateTimeout="20000"/>
-->
<!--
We could use "write-behind", which actually writes to the file system asynchronously,
which can improve performance as seen by the JCR client.
Plus changes are coalesced, meaning that if multiple changes are enqueued for the
same node, only the last one is written. (This is good much of the time, but not
always.)
<async enabled="true" flushLockTimeout="15000" threadPoolSize="5"/>
-->
</loader>

</loaders>
</namedCache>

<namedCache name="FedoraRepositoryBinaryData">
<!--
Our Infinispan cache needs to be transactional. However, we'll also configure it to
use pessimistic locking, which is required whenever applications will be concurrently
Expand All @@ -42,7 +104,7 @@
<deadlockDetection enabled="true" spinDuration="1000"/>


<eviction maxEntries="100" strategy="LRU" threadPolicy="DEFAULT"/>
<eviction maxEntries="100" strategy="LIRS" threadPolicy="DEFAULT"/>

<transaction
transactionManagerLookupClass="org.infinispan.transaction.lookup.GenericTransactionManagerLookup"
Expand All @@ -67,7 +129,7 @@
<!-- See the documentation for more configuration examples and flags. -->
<properties>
<!-- We have to set the location where we want to store the data. -->
<property name="location" value="${fcrepo.ispn.CacheDirPath:target/FedoraRepository/storage}"/>
<property name="location" value="${fcrepo.ispn.binary.CacheDirPath:target/FedoraRepositoryBinaryData/storage}"/>

<property name="fsyncMode" value="perWrite"/>
</properties>
Expand Down
Expand Up @@ -30,18 +30,16 @@
use pessimistic locking, which is required whenever applications will be concurrently
updating nodes within the same process. If you're not sure, use pessimistic locking.
-->
<clustering mode="distribution">
<clustering mode="replication">
<sync/>
<l1 enabled="false" lifespan="0" onRehash="false"/>
<hash numOwners="${fcrepo.ispn.numOwners:2}"/>
<stateTransfer chunkSize="100" fetchInMemoryState="true"/>
</clustering>

<locking concurrencyLevel="1000" lockAcquisitionTimeout="15000" useLockStriping="false" />

<deadlockDetection enabled="true" spinDuration="1000"/>

<eviction maxEntries="100" strategy="LRU" threadPolicy="DEFAULT"/>
<eviction maxEntries="500" strategy="LIRS" threadPolicy="DEFAULT"/>

<transaction
transactionManagerLookupClass="org.infinispan.transaction.lookup.GenericTransactionManagerLookup"
Expand Down Expand Up @@ -111,4 +109,93 @@
</loader>
</loaders>
</namedCache>


<namedCache name="FedoraRepositoryBinaryData">
<!--
Our Infinispan cache needs to be transactional. However, we'll also configure it to
use pessimistic locking, which is required whenever applications will be concurrently
updating nodes within the same process. If you're not sure, use pessimistic locking.
-->
<clustering mode="distribution">
<sync/>
<l1 enabled="false" lifespan="0" onRehash="false"/>
<hash numOwners="${fcrepo.ispn.numOwners:2}"/>
<stateTransfer chunkSize="100" fetchInMemoryState="true"/>
</clustering>

<locking concurrencyLevel="1000" lockAcquisitionTimeout="15000" useLockStriping="false" />

<deadlockDetection enabled="true" spinDuration="1000"/>

<eviction maxEntries="100" strategy="LIRS" threadPolicy="DEFAULT"/>

<transaction
transactionManagerLookupClass="org.infinispan.transaction.lookup.GenericTransactionManagerLookup"
transactionMode="TRANSACTIONAL" lockingMode="PESSIMISTIC"/>
<!--
Define the cache loaders (i.e., cache stores). Passivation is false because we want *all*
data to be persisted, not just what doesn't fit into memory. Shared is false because there
are no other caches sharing this file store. We set preload to false for lazy loading;
may be improved by preloading and configuring eviction.
We can have multiple cache loaders, which get chained. But we'll define just one.
-->

<loaders passivation="false" shared="false" preload="false">

<!--
The 'fetchPersistentState' attribute applies when this cache joins the cluster; the value doesn't
really matter to us in this case. See the documentation for more options.
-->
<loader class="org.infinispan.loaders.file.FileCacheStore" fetchPersistentState="true"
purgeOnStartup="false">
<!-- See the documentation for more configuration examples and flags. -->
<properties>
<!-- We have to set the location where we want to store the data. -->
<property name="location" value="${fcrepo.ispn.binary.CacheDirPath:target/FedoraRepositoryBinaryData/storage}"/>

<property name="fsyncMode" value="perWrite"/>
</properties>
<!-- This repository isn't clustered, so we could set up the SingletonStore.
singletonStore enabled="true" pushStateWhenCoordinator="true" pushStateTimeout="20000"/>
-->
<!--
We could use "write-behind", which actually writes to the file system asynchronously,
which can improve performance as seen by the JCR client.
Plus changes are coalesced, meaning that if multiple changes are enqueued for the
same node, only the last one is written. (This is good much of the time, but not
always.)
<async enabled="true" flushLockTimeout="15000" threadPoolSize="5"/>
-->
</loader>

<!--
The 'fetchPersistentState' attribute applies when this cache joins the cluster; the value doesn't
really matter to us in this case. See the documentation for more options.
-->
<loader class="org.infinispan.loaders.file.FileCacheStore" fetchPersistentState="false"
purgeOnStartup="false">
<!-- See the documentation for more configuration examples and flags. -->
<properties>
<!-- We have to set the location where we want to store the data. -->
<property name="location" value="${fcrepo.ispn.binary.alternative.CacheDirPath:target/FedoraRepositoryBinaryData/storage-alt}"/>

<property name="fsyncMode" value="perWrite"/>
</properties>
<!-- This repository isn't clustered, so we could set up the SingletonStore.
singletonStore enabled="true" pushStateWhenCoordinator="true" pushStateTimeout="20000"/>
-->
<!--
We could use "write-behind", which actually writes to the file system asynchronously,
which can improve performance as seen by the JCR client.
Plus changes are coalesced, meaning that if multiple changes are enqueued for the
same node, only the last one is written. (This is good much of the time, but not
always.)
-->
<async enabled="true" flushLockTimeout="15000" threadPoolSize="5"/>

</loader>
</loaders>
</namedCache>
</infinispan>
2 changes: 1 addition & 1 deletion fcrepo-webapp/src/main/resources/config/repository.json
Expand Up @@ -24,7 +24,7 @@
"cacheConfiguration" : "${fcrepo.infinispan.cache_configuration:config/infinispan_configuration.xml}",
"binaryStorage" : {
"type" : "cache",
"dataCacheName" : "FedoraRepository",
"dataCacheName" : "FedoraRepositoryBinaryData",
"metadataCacheName" : "FedoraRepository"
}
},
Expand Down

0 comments on commit 2973753

Please sign in to comment.