cache - sergeyzolotukhin/learn-java-gradle GitHub Wiki
Goal
Reduce BPMN process/action execution time (via reduce amount of SQL query)
None a goal
Improve overall system performace
Reduce database IO workload
Root cause
amount of SQL query per process
find standing data - 78 %
find schedules - 2 %
insert/update/delete BPMN - 10 %
insert/update/delete derivation - 20 %
Assumptions
Standing data content assumptions
* Avarage entities count = 5 000
* Avarage factors per entity = 10
* Avarage size of single entity with factors = 5 000 byte
* friquency of changes entities/factors = 1000 entity/factor per week
Total entities per month = 5 000 + ( 1000 * 4 ) = 9 000
Total size of entities per month = 9 000 * 5 000 = 45 MB
Standing data use assumptions
Avarage shcdules load per BPMN process ->
500 (RO) * 10 (schedule types) = 10 000
Avarage standing data load per BPMN process (by ) ->
500 (RO) * 48 (time series) * 3 (validation/translation/calculaion) * 5 (values types) = 360 000
Avarage amount of cuncurrent executed process
5 (assumtion is based on RTBM process due to it is have a stricted requirment of execution time)
5 (reserv to execute other porcess with lower execution time requirment)
Approaches
Cache statding data for whole year (45 MB * 12 MB = 540 MB)
Use in process cache on each node (do not use separate node for cache due to reduce respnse time)
Synhroniuse replicate chage to all node (due to friquence of change is low)
Build standing data cache in 2 level for take O(1) complacity level (entity level, query level)
Use treshhold of cache hit ratio to provide required QOS.
We can use Ehcache (with JGroup) or JBoss Infinispan (Embided mode)
The entity shuld be pre populate to simplify complince the NFR
Non functions requirements
The entity cache hit ratio should for current year shuld be no less 90%
The 3.6 miliion reques per minutes (based on RTBM process, query entity by MRID)
360 000 (Avarage standing data load per BPMN process)
* 10 (Avarage amount of cuncurrent executed process) = 14 400 000
Also, we can define the simmlar NFR to find entity by conditions.
The cache should use no more 500 MB RAM when we have 5 000 entity and change 1000 of then eache month