portals icon indicating copy to clipboard operation
portals copied to clipboard

State Management

Open jspenger opened this issue 1 year ago • 1 comments

The Portals runtime currently only supports in-memory state, and does not support checkpointing/recovering state. We should fix this, and implement a suitable persistent state backend. RocksDB is a good choice for this, as it is widely used by other stream processing systems.

The tasks for this issue are the following:

  • [ ] Create a state backend, which can checkpoint and recover.
  • [ ] Test the state backend.
  • [x] #97
  • [ ] Make runtime checkpoint state at regular intervals.
  • [ ] Recover from previous state after a restart.
  • [x] #100
  • [ ] #146

Notes:

  • The new state backend should implement the StateBackend trait, a good example of this is the MapStateBackendImpl.
  • I have previously had issues with RocksDB on the new M1 Macbook, this may again be an issue, just something to be aware of.
  • Adding checkpointing and recovery, and enabling the state backend, should be made available through some config settings in the runtime.
  • The new state backend should be put in a new sub-project, as to keep the core pure Scala (so it compiles with ScalaJS). This can be done as a last step, and we should probably discuss together how to do it best, once we have all the pieces; still, I would start of working directly form the core directory.

jspenger avatar Apr 21 '23 20:04 jspenger