-
Bug
-
Resolution: Done
-
Major
-
29.0.0.Final
-
None
The metadata for a each distributed timer instance is mapped to 2 cache entries: 1 entry stores immutable meta data (e.g. timer configuration, timer context, etc); and 1 entry stores meta data that changes every timeout (e.g. duration between start time and last timeout).
The intention was to minimize the the payload for requests for existing beans, where only the duration since creation requires updating.
There are a few problems with this approach:
1. Each cache entry requires the overhead of the cache key
2. The existing mapping is prone to cross-entry data integrity issues, since both meta data entries must always exist.
By leveraging Cache.compute(...), we can, encapsulate any meta data changes within a function, allowing us to store all meta data in a single cache entry, while still minimizing the payload per request. Additionally, since the compute function has access to the existing
last timeout, we don't need to send the full duration value, but only the differences. Thus the payload of this value will never increase over time, as it does currently, since ProtoStream requires fewer bytes for smaller numeric values.