Project

General

Profile

task #7785

CdmUserHelper caches permission information

Added by Andreas Kohlbecker 3 months ago. Updated about 1 month ago.

Status:
Closed
Priority:
Priority14
Category:
cdm-vaadin
Target version:
Start date:
09/21/2018
Due date:
% Done:

100%

Severity:
normal

Description

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.

picture159-1.png View (103 KB) Andreas Kohlbecker, 09/21/2018 04:25 PM


Related issues

Related to Edit - bug #7709: CdmTransientEntityCacher cannot handle multiple unpersisted entities of the same type In Progress 08/30/2018

Associated revisions

Revision 8bbd4f27 (diff)
Added by Andreas Kohlbecker 2 months ago

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

Revision 67bf2db8 (diff)
Added by Andreas Kohlbecker 2 months ago

ref #7785 preliminary commit

Revision 3b278eb0 (diff)
Added by Andreas Kohlbecker 2 months ago

ref #7785 using CdmTransientEntityAndUuidCacher to promote using the CachingCdmUserHelper

Revision 4dadd125 (diff)
Added by Andreas Kohlbecker about 1 month ago

ref #7785 fixing usage of wrong cacher method which prevented from caching the whole object graph

History

#1 Updated by Andreas Kohlbecker 3 months ago

  • Tags changed from phycobank to phycobank, performance

#2 Updated by Andreas Kohlbecker 3 months ago

Can the cache of the presenter be used in the CdmUserHelper to avoid loading the entities again?

#3 Updated by Andreas Kohlbecker 2 months ago

  • Priority changed from New to Highest

#4 Updated by Andreas Kohlbecker 2 months ago

  • Blocked by bug #7709: CdmTransientEntityCacher cannot handle multiple unpersisted entities of the same type added

#5 Updated by Andreas Müller 2 months ago

Can you define what functionality is exactly needed from the CdmTransientEntityCacher and why #7709 needs to be fixed for this. Currently it is not planned to "fix" #7709 as it seems not to be needed for standard usecases and the new implementation is worse for in terms of memory.

#6 Updated by Andreas Kohlbecker 2 months ago

  • Description updated (diff)

Answer is in the updated description.

#7 Updated by Andreas Kohlbecker 2 months ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 50

#8 Updated by Andreas Kohlbecker 2 months ago

  • Description updated (diff)
  • Assignee changed from Andreas Kohlbecker to Andreas Müller

Implemented and description updated.

#9 Updated by Andreas Müller about 2 months ago

Sorry, currently I don't have time for review. But if it works for you review is not critical I think.

#10 Updated by Andreas Müller about 2 months ago

  • Priority changed from Highest to Priority14

#11 Updated by Andreas Kohlbecker about 1 month 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: [1]-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.

#12 Updated by Andreas Kohlbecker about 1 month ago

  • Blocked by deleted (bug #7709: CdmTransientEntityCacher cannot handle multiple unpersisted entities of the same type)

#13 Updated by Andreas Kohlbecker about 1 month ago

  • Related to bug #7709: CdmTransientEntityCacher cannot handle multiple unpersisted entities of the same type added

#14 Updated by Andreas Kohlbecker about 1 month ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 40 MB)