From c5f0844f804c5ac1da6e5802013fcb6513b4084d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Aur=C3=A8le=20Brothier?= Date: Wed, 5 Jun 2019 12:58:18 +0200 Subject: [PATCH] server: deactivate ehcache (#2913) This PR is for deactivating Ehcache in CloudStack since it is not usable. The first commit remove the default RMI cache peering configured for multicast which most of the time cannot work. It also requires to have an interface up which is not always the case while developing offline. The second commits remove the configuration to activate caching on some DAOs. Problems The code in CS does not seem to fit any caching mechanism especially due to the homemade DAO code. The main 3 flaws are the following: Entities are not expected to be shared There is quite a lot of code with method calls passing entity IDs value as long, which does some object fetching. Without caching, this behavior will create distinct objects each time an entity with the same ID is fetched. With the cache enabled, the same object will be shared among those methods. It has been seen that it does generate some side effects where code still expected unchanged entity attributes after calling different methods thus generating exception/bugs. DAO update operations are using search queries Some part of the code are updating entities based on a search query, therefore the whole cache must be invalidated (see GenericDaoBase: public int update(UpdateBuilder ub, final SearchCriteria sc, Integer rows);). Entities based on views joining multiple tables There are quite a lot of entities based on SQL views joining multiple entities in a same object. Enabling caching on those would require a mechanism to link and cross-remove related objects whenever one of the sub-entity is changed. Final word Based on the previously discussed points, the best approach IMHO would be to move out of the custom DAO framework in CS and use a well known one (out of scope of this change of course). It will handle caching well and the joins made by the views in the code. It's not an easy change, but it will fix along a lot of issues and add a proven / robust framework to an important part of the code. --- client/conf/ehcache.xml.in | 11 --- ...spring-engine-schema-core-daos-context.xml | 92 ++----------------- 2 files changed, 9 insertions(+), 94 deletions(-) diff --git a/client/conf/ehcache.xml.in b/client/conf/ehcache.xml.in index 19bfd0f6967..4f25978ed00 100755 --- a/client/conf/ehcache.xml.in +++ b/client/conf/ehcache.xml.in @@ -163,14 +163,6 @@ under the License. used. --> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + +