Hyperion icon indicating copy to clipboard operation
Hyperion copied to clipboard

Extend session reference preserving capabilities

Open Horusiath opened this issue 7 years ago • 0 comments

Right now we can use SerializerSession/DeserializerSession for object caching when preserve object references flag is set. This way we can send only object IDs in subsequent deserialization instead of passing full payload every time.

However this option has pretty limited configuration. What we could do is:

  1. Instead of single global switch to introduce preserving reference, we should move it on the type level - so that decision about preserving reference would be determined per type. I.e. we could introduce some extra options along known types options or introduce attribute like [PreserveReferences] to be attached to class itself. So instead of trying to preserve everything we would apply some rules (since we may expect some types of object to be more frequently reused within a single session while other shouldn't be even bothered to preserve).
  2. At this point session cache doesn't have any capacity bounds and no way to be cleared. This heavy limits it's usefulness - it could potentially grow infinitely and keep messages that are not longer in use from being GCed. We should add some option for setting up maximum cache size and/or methods to clear the cache. Just like in case of GC, we could also try to apply multilevel cache, where cached objects would be prioritized - i.e. we might expect that Type or singleton messages could be cached permanently, IActorRef could live probably in long-living cache, while some other user messages may change much more frequently, therefore be cached in more frequently cleaned cache layer.

Horusiath avatar Jun 03 '17 19:06 Horusiath