Skip to content

antonshilov/transactionalmap

Repository files navigation

Transactional Key-Value Store

Main classes are ConcurrentTransactionalKeyValueStore and SynchronousTransactionalKeyValueStore.

SynchronousTransactionalKeyValueStore is only for illustration purposes to show how it fails in multithreading case

Run

To run launch Main.kt main function

Assumptions

While working in concurrent environment I assumed that transaction consistency was the most important factor. To correctly handle it I've chosen Serializable isolation level. If one thread transaction is active, all other operations will be locked until it completes by COMMIT or ROLLBACK

Potential optimisations

  1. Track operations instead of whole map copy for transactions to reduce memory usage. Will complicate get and count implementations a bit
  2. Cache COUNT operations in LRU cache to have O(1) complexity for frequent counts
  3. Use more relaxed transaction isolation level to improve multi-thread performance

About

Transactional Key Value store Kotlin implementation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages