jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Mueller" <thomas.tom.muel...@gmail.com>
Subject Re: Changing CacheManager settings - Example in wiki is not working
Date Wed, 19 Dec 2007 11:16:10 GMT

I have updated the section and source code example in the wiki:

The CacheManager does not control the memory used by unsaved data
(data in the transient space). If you get out of memory exceptions,
check that your application calls Node.save() or (even better)
Session.save() from time to time. Unsaved changes are kept in memory
with the current Jackrabbit.

Session session = new TransientRepository()
                .login(new SimpleCredentials("", new char[0]));
RepositoryImpl repository = (RepositoryImpl)session.getRepository();
CacheManager manager = ((RepositoryImpl) repository).getCacheManager();
manager.setMaxMemory(8 * 1024 * 1024); // default is 16 * 1024 * 1024
manager.setMaxMemoryPerCache(1024 * 1024); // default is 4 * 1024 * 1024
manager.setMinMemoryPerCache(64 * 1024); // default is 128 * 1024]

>        session().save();

Does the method session() return the same session as the one used to
create the nodes? Did you call Session.save() for each node?

> 1)How does cache mechanism work in Jackrabbit for inserts work. I try to
> change the cache manager setting using example given at
> http://wiki.apache.org/jackrabbit/CacheManager

The cache is not only for inserts, it is also used for read access.

> 2) I am calling Jackrabbit from tomcat.  I am thinking of increasing tomcat
> jvm memory setting to increase the heap size. Is it a good idea to do that.

Maybe other modules are using the main chunk of memory. Could you try
to analyze the memory usage using a profiler tool? The YourKit Java
Profiler (http://www.yourkit.com/) is great for that, and there is a
trial version available. There may be other tools as well.

> 3) I am using one session for many of these operations.

That's good.

> Would there be one cache created per session?

Yes. The cache manager adaptively changes the size for each of these
caches. However if you have a lot of sessions, this will not work

> if I have to evit the cache how can I do it?

This should not be required.

> can I clear the transient
> repository?



View raw message