uncharted-aske / HMI

Apache License 2.0
1 stars 0 forks source link

Add in-memory size limit to fetch memoization system and implemented for donu service #300

Closed mj3cheun closed 3 years ago

mj3cheun commented 3 years ago

The goal of this PR is to add memoization back to the donu simulate fetch. This will make the simulate view more responsive by eliminating most redundant API calls to donu and solves issue #297. To test, ensure the simulate page is working properly, one should notice a slight increase in responsiveness particularly with a large number of runs.

In order to address previous concerns with the current memoization system with high memory usage and memory leaks, the system was modified to track the size of each entry stored in bytes and limit the total amount of memory consumed by the store to a specified number of bytes. If the store fills up it will drop entries starting from the first one stored until there is sufficient space for a new entry to be stored.

The two parameters controlling the behaviour of the memoization store are the storeSizeLimit (discussed above) limiting the total size of the store; and the storeEntryLimit limiting the size of each entry. If an item exceeds the storeEntryLimit it is not stored at all.

adamocarolli commented 3 years ago

Looks good approved!