User development,
A new message was posted in the thread "How to manage empty data with a
CacheLoader?":
http://community.jboss.org/message/523671#523671
Author : Nicolas Filotto
Profile :
http://community.jboss.org/people/nfilotto
Message:
--------------------------------------------------------------
Hi,
We face a big performance issue because we use a CacheLoader behind a JBC instance that
doesn't contain a lot of data but this cache is very frequently accessed and rarely
modified. As far as I understand, when we try to get a non existing data from a JBC
instance with a CL, JBC does globally the following steps:
1. It tries to get the data for the local cache
2. No data cans be found, thus it locks the related fqn
3. It then gets the data from the backend store
4. No data cans be found in the backend store, so it has nothing to put into the local
cache
5. It finally releases the fqn
In our case, most of the time there is no data to retrieve from the backend store, so if
several threads try to access to the same fqn at the same time we can quickly get a
TimeoutExcetion.
For example, if:
1. The lock timeout has been set to 10 seconds
2. We need about 1 second to access the backend store
3. We have 11 threads trying to access the same fqn at the same time
=> The last thread will get a TimeoutException since each thread needs 1 second to do
the tasks between step #3 and step #5, so the 10 first threads need 10 seconds to allow
the last thread accessing step #3 which won't be possible because the timeout has been
set to 10 seconds.
Is there a way to avoid that issue? up to now this is the bottleneck of our entire
application.
The only idea that I have so far is to put a fake data into the local cache representing
some how "no data", just to avoid accessing the backend store anytime we want to
access the value from the cache. But I still have 2 questions which are:
1. What is the best way to implement such mechanism (i.e. loading fake data)?
2. The previous workaround described below, only solve the issue for the 2nd access to the
data, the issue remains for the 1st access when the data representing "no data"
has not yet been loaded. Is there a way to solve also this part of the problem?
Thank you in advance for your help,
Best Regards,
Nicolas Filotto
--------------------------------------------------------------
To reply to this message visit the message page:
http://community.jboss.org/message/523671#523671