First a little bit about my setup:
I have 3 servers. Each server runs an axis service. The service uses cayenne 1.2.1 to connect to a database. It reads customer and account information from the DB etc..
The servers are using cayenne's shared caching with javagroups as the messaging service so that changes made from one server are dispatched to the other servers.
The avarage connections per second is somewhere around 4-5 for each server.
However with nearly constant and unchanging usage the load of each server increases over time.
To further test this I created a test server with a similar setup but deactivated the shared caching and JavaGroups setup. There I created a test program that creates totally constant usage of exactly 4 request per second.
Still the load of the server is increasing until the cpu load is so high that the requests can not be processed anymore.
I installed a java profiler to trying to pinpoint the location of this error and this is what I found out.
I let the server run for 24 hours and then stopped the program which creates the test usage.
But even while the server was idle there where still a lot of instances in the java heap. I even manually started the GC a few times.
java.util.HashMap$Entry (almost 1.5 milion insances)
java.lang.ref.WeakReference (over 1 million insances)
org.objectstyle.cayenne.util.Invocation (over 1 million insances)
org.objectstyle.cayenne.access.DataContext (only 30 Instances)
When the LoadTest is running 58% of the cpu time is used within HashSet.add() which is called within
The longer the test is running the higher the percentage of cpu time used from addInvocation. The problem seems to be that there are some hard references to the Invocations objects so that the WeakReferences are not destroyed and the HashSet gets bigger and bigger.