CdmUserHelper caches permission information
CdmUserHelper has been identified being hostspot in the cpu time analysis:
Caching entities or permsisson check results may help improving the performance.
In the analyzed case it takes 12 seconds in total to build the RegistrationWorkingsetView. 8,3 seconds of that are only used to find entities which are needed to do permission checks. Finding these entities involves querying the database which naturally takes some time. But these roundtrips to the DB are completely dispensable since the entities needed for the checks have been loaded already. They are stored in the
CdmTransientEntityCache which is used by the
CachingPresenters. Therefore this performance overhead culd be completely cropped off by using the cached enities.
When the permission check is being done, the entityType and UUID are known, but with this information it is not possible to query the
CdmTransientEntityCache for a cached object. The cache uses the entity.ID instead of the uuid. In #7709 the idea of using the
uuid instead of the
id is being discussed.
We (AK & AM) decided for the following solution:
A subclass of the
CdmTransientEntityCache will complements the
CdmTransientEntityCache by the ability to get CDM entities from the cache by the UUID. Internally a Map will be used to store the entity UUID together with the CdmEntityCacheKey of each entity being put into the cache.
fix #7785 CdmUserHelper can use ICdmEntityUuidCacher to avoid loading entities from the db for permission checks:
- inner class CachingCdmUserHelper to be used when CdmUserHelper.withCache() is called
- ICdmEntityUuidCacher and CdmTransientEntityAndUuidCacher complements the CdmTransientEntityCacher by the ability to get CDM entities from the cache by the UUID
ref #7785 using CdmTransientEntityAndUuidCacher to promote using the CachingCdmUserHelper
#5 Updated by Andreas Müller about 1 year ago
#11 Updated by Andreas Kohlbecker about 1 year ago
- Assignee changed from Andreas Müller to Andreas Kohlbecker
- % Done changed from 50 to 100
The CachingCdmUserHelper effectively brings a performance boost of ~2 seconds for the big working set "Kulikovskiy, M., Lange-Bertalot, H. & Kuznetsova, I. V., Lake Baikal: Hotspot of endemic diatoms II.Iconographia Diatomologica, 26: -656. 2015" with over 70 acts which takes ~14 seconds to load
Another hotspot is the checking for active messages in the redmine instance used for communication. This imposes mur than 5 seconds!
This issue definitely can be closed as completed. Since
CdmTransientEntityAndUuidCacher has been implemented the issue #7709 is no longer blocking this task.