Skip to content

smp server: use stm-containers for the notification store - #1987

Closed
evgeny-simplex wants to merge 3 commits into
simplex-chat:masterfrom
evgeny-simplex:ep/stm-containers
Closed

evgeny-simplex wants to merge 3 commits into
simplex-chat:masterfrom
evgeny-simplex:ep/stm-containers

Conversation

@evgeny-simplex

Copy link
Copy Markdown
Contributor

SMP server

  • The notification store (NtfStore) uses StmContainers.Map instead of a TVar (Map ..). Sending clients write it per key at message rate, and the delivery thread inserts and deletes keys every delivery interval; with one map TVar these writes invalidated each other.
  • Whole-store reads (delivery, expiration, saving, restore count, control port) read one entry per transaction (getNtfs), without a whole-map snapshot.
  • Notifications of deleted queues are removed after delivery one notifier per transaction.
  • Delivery batches and the saved notifications file list notifiers in hash order; notifications of each notifier keep their order.

Other maps

All 84 STM maps and sets were reviewed; the other 83 stay TVar containers: they are small, have a single main writer, or are snapshotted, sized or emptied as a whole on regular paths.

Dependencies

  • stm-containers and list-t for the server build only (not with client_library); stm-containers for the tests.
  • hashable moves to the common dependencies for the new Hashable EntityId instance.

@evgeny-simplex

Copy link
Copy Markdown
Contributor Author

Closed: benchmarks show the TVar Map store is faster than stm-containers for this workload (1.2-2x higher store throughput; whole-store reads cost one transaction per entry instead of one readTVarIO).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant