Given that requirement, why bother using Flink's managed keyed state at all? Seems like you could implement something yourself, using a data structure that sits on the heap.