milton0825 / plano

Plano - a simple scheduling service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support SQLite as default datastore

milton0825 opened this issue · comments

Scope

In some scenarios, we want to use Plano as a standalone application without a remote database server (client/server). Plano should be able to work with an embedded database to store requests on local machine.

Note: SQLite will be the default data store.

Single table vs. multiple tables

Use multiple tables (normalized) Preferred

Pros

  • Normalized schema is more scalable and abstraction of data increases readability.
  • No duplicates. Save disk space.

Cons

  • Hard to achieve atomic read, write, update, and delete operations?
  • Higher read latency.

Use a single table (denormalized)

Pros

  • Lower read latency.

Cons

  • Duplicates. Duplicated payload will consume too much space.

How to guarantee atomicity when interacting with multiple tables?

Lock each request. You will have to hold the lock before read, update, and delete.

  • How to handle lock unavailability?
    • Throw exception when lock unavailable
    • Retry
  • Optimistic locking
  • Pessimistic locking

Transaction

  • read/write to multiple table in single transaction.