Task #2024
closedConfigure cluster friendly cache manager for distributed cache
100%
Description
We want to add support for run CzechIdM in cluster. We need to choose and configure distributed cache implementation for spring cache manager abstraction:
https://docs.spring.io/spring/docs/current/spring-framework-reference/integration.html#cache-store-configuration
Base requirement:
- more CzechIdM application instances will run on the one database
- when some cached entry is changed in one instance, then the second cache has to be synchronized (replicated)
Frontend agenda will be reused, cache entry size can be added, if it will available.
Related issues
Updated by Radek Tomiška almost 5 years ago
- Related to Task #1976: Displaying cache usage and add possibility to clean it. added
Updated by Peter Štrunc almost 5 years ago
- Status changed from New to In Progress
- % Done changed from 0 to 10
After reading about different cache providers i discoveredd, that main challenge would be how to merge cache configuration from all deployed modules. The thing is, that all cache providers require you to specify which caches is your application going to use in advance (which was not the case with SimpleCache which we used up to this point).
I tried two approaches - using tagging interface and defining caches in module descriptor. Unfortunatelly both ended up not working, because it creates cyclic dependencies among spring beans (Repository beans).
There are still other ways to achieve that, which i will try today.
Updated by Peter Štrunc almost 5 years ago
- Status changed from In Progress to Needs feedback
- Assignee changed from Peter Štrunc to Radek Tomiška
- % Done changed from 10 to 70
Distributed caching is implemented in pstrunc/2024-clusterred-cache. We support on-heap and distributed caches and caching of null values. Documentation is here https://wiki.czechidm.com/devel/documentation/caching.
I also disabled displaying cache size on FE and its usage in tests since it does not make sense in distributed environment.
Would you please review this task Radek? Thank you.
Updated by Radek Tomiška almost 5 years ago
- Target version changed from 10.1.0 to 10.2.0
Updated by Peter Štrunc almost 5 years ago
I added support for clusterred Terracotta server. We can now set multiple servers for ehCache to connect to. I am struggling with ssl support. Documentation of terracotta sais that it should be no problem, but their example seems to be not usable. I was using this documentation https://documentation.softwareag.com/onlinehelp/Rohan/tc-ehcache_10-3/webhelp/index.html#page/tc-ehcache-webhelp%2Fco-srv_cluster_security.html%23. There seems to be not a lot of examples on the internet for this usecase, which is suprising.
Updated by Peter Štrunc almost 5 years ago
- Related to Task #2083: Secure connection to clustered Terracotta server added
Updated by Radek Tomiška almost 5 years ago
- Status changed from Needs feedback to In Progress
- Assignee changed from Radek Tomiška to Peter Štrunc
- % Done changed from 70 to 80
I did test and code review, clustered cache works, awesome! Cache configuration is really complex, good job to find a way.
Review notes:
- cache cannot be disabled by configuration ('spring.cache.type=none').
- terracota configuration properties should not start with 'idm.sec' prefix - is not configurable by our service (from UI). And add please new configuration section into wiki - confugration backend.
- a lot of warnings (21) is in code, javadoc is missing (e.g. CoreCacheConfiguration).
- stream formating - each stream commad should be on new line (e.g. ClusteredEhCacheConfiguration).
- Builder classes have templates 'KEY' and 'VALUE', but 'K' and 'V' template is used in all other places (wrappers - there should be 'V' instead 'K', generalized classes), it could be unified (i prefer 'K', 'V' :)).
- Builder classes define templates, but keyType and valueType has to be defined again redundantly - remove template or use GenericTypeResolver, when builder is constructed (e.g. AbstractReadDtoService).
- Package with wrapper could be renamed to 'domain', maybe we will have another domain dtos for cache configuration in future.
- Methods for bean creation (e.g. InMemoryEhCacheConfiguration#ehCacheManager) are package protected now - add please public modifier and add javadoc (~ same as cache purpose in locale, but BE developer will not have frontend opened somethimes:)).
Updated by Peter Štrunc almost 5 years ago
- Status changed from In Progress to Needs feedback
- Assignee changed from Peter Štrunc to Radek Tomiška
I fixed all mentioned issues except for Builder refactoring, because GenericTypeResolver does not work for me in this case. Would you please review this again? Thanks.
Updated by Marcel Poul almost 5 years ago
Please @sourek follow the standards for CzechIdM online documentation and divide https://wiki.czechidm.com/devel/documentation/caching into chapters
Updated by Radek Tomiška over 4 years ago
- Status changed from Needs feedback to In Progress
- % Done changed from 80 to 90
I did test and review again, it's awesome, documentation is nice, thx!
Merged into develop.
So documenation remains only:
- And add please new configuration section into wiki - confugration backend (and move top cache notes and spring.cache.type there .)).
- and Marcel's note above
- then you could close this ticket please :)
Note: A lot of warning were still there, i fixed them https://github.com/bcvsolutions/CzechIdMng/commit/6e875256d4c0cb5d7973bb9a95e0199d931544a0 :)
Updated by Radek Tomiška over 4 years ago
- Assignee changed from Radek Tomiška to Peter Štrunc
Updated by Radek Tomiška over 4 years ago
- Related to Task #2199: Implement new cache manager to the CRT module added
Updated by Radek Tomiška over 4 years ago
- Status changed from In Progress to Resolved
- % Done changed from 90 to 100
I've added new configuration properties into documentation:
https://wiki.czechidm.com/devel/documentation/application_configuration/dev/backend#cache
Note: Developer guide can be split (e.g into admin guide / tutorial) in future, all information is there.
Updated by Radek Tomiška over 4 years ago
- Status changed from Resolved to Closed