I've found how to enable... I've forgot the enable() after async() (it will be good to have toString() methods implemented on Configuration objects):
Configuration config = new ConfigurationBuilder().loaders().shared(false).passivation(false).preload(false).addFileCacheStore() .location(CACHE_DIR).async().enable().threadPoolSize(10).eviction().maxEntries(100000).build();
I see a separate thread (AsyncProcessor) that write entries in the FileStore.
But the test is worst (80 seconds instead 70) cause main thread spend a lot of time (30% of CPU time) in FileCacheStore.flush().
Here a call tree extract from main thread:
org.infinispan.commands.write.PutKeyValueCommand.acceptVisitor(InvocationContext, Visitor),"2796" org.infinispan.interceptors.CacheLoaderInterceptor.visitPutKeyValueCommand(InvocationContext, PutKeyValueCommand),"2796"
org.infinispan.interceptors.CacheLoaderInterceptor.loadIfNeeded(InvocationContext, Object, boolean, FlagAffectedCommand),"2734"
I finally found the performance problem. The put() operation loads the entry from cache to return the old value. This force a read from file and the flush that coast so much in my test.
In my case, I don't need that old value.
I've found that method:
org.infinispan.interceptors.CacheLoaderInterceptor.loadIfNeeded(InvocationContext, Object, boolean, FlagAffectedCommand)
method use a flag to disable this read: SKIP_CACHE_STORE
I was not able to find how to configure the cache to enable that but this page explains how to disable the read on a put() operation:
with this option, my 10 000 entries are put on the cache in 700ms instead of 70-80 seconds!
yes that's correct: sorry for the late response, but glad you found the solution.
There are more Flags which provide similar options, make sure you know about all of them; I've added a link from the page you had already found.
Thank, I was filling an enhancement ticket to have SKIP_LOAD_CACHE with configuration but you wrote a sample of how to do this with decorated cache.
I added a comment in the following page : https://docs.jboss.org/author/display/ISPN/Configuring+cache+programmatically because enable() is missing after async() in the sample.
I also filled a ticket (https://issues.jboss.org/browse/ISPN-1861) to have a toString() method in configuration objects. It should have help me to discover that write-behind was not enabled.