Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: More than 10000 DB Queries when calling UserGroupRoleLocalServiceUtil
Helo,
we observed on our installations (that uses Liferay_6.2.5 GA6), that whenever we do the following call
UserGroupRoleLocalServiceUtil.getUserGroupRoles(0, MAX);
and we have more than 10.000 entries in the table UserGroupRole, that
after executing the findAll, that for each entry a separate DB-Query
will be done to get the most recent UserGroupRole entry (although the
whole data is still there).
After further analyzation, we found out, that the
FinderUtil for UserGroupRole was the reason for that. This concrete
Finder uses the default cache configuration, that is using RAM only
with a max of 10.000 entries.
We also found a temporary Workaround, using the
following property entry in portal-ext.properties
value.object.finder.cache.enabled.com.liferay.portal.model.UserGroupRole=false
Is this the best solution or is there a really good one?
Why is a FinderUtil for UserGroupRole entities needed, as the
update for that entries use a query containing (roleId, groupId &
userID) and will return the same data (roleId, groupId & userID)?
Kind Regards,
Philipp
You have "more than 10.000 entries" and a cache with "10.000" entries, and you write code that loads all "more than 10.000 entries" at once. Naturally, when the last entity is loaded into memory and cache, the first ones will be expired from cache.
You can
- configure the cache to be sufficient for the number of entities you read at once
- change your implementation to not load all entities at once, but go in 1000's chunks.
As you're on GA6, I hope you have the patch installed, but it's also a good idea to upgrade and check if you can reproduce on the latest version
Thanks for the reply. We are currently working on migrating to Liferay 7, but we will not be that fast. So we would definitly need to fix that also on Liferay 6.
Okay, but isnt the FinderCache for entities of UserGroupRole
useless?
It requests an entry with all details and gets
the same details back.
So is disabling the FinderCache for this entites the best option or are there better options?
Thanks,
Philipp
Would be cool to get an answer
Powered by Liferay™