Skip to main content

2.1 System Requirements

Functional Requirements

  • what features must be included

Non-Functional Requirements

  • must be highly available and fast

Example: Design a scalable, highly available, and fast messaging system

Thought process

  • we need to scale for writes and reads, since every message will be written to the messaging system and consumed at some later point
  • to scale the system for writes, i will need to partition messages, store them in multiple queues
  • which partition strategy should I use? maybe a hash strategy
  • where do I store messages quickly? Memory or disk
  • if using a memory, it can be a bounded queue
  • if using disk, i can use either an append-only log, or an embedded database
  • if using database, should I pick a B+ tree or LSM tree? B+ trees are used for fast search and insertion, LSM trees are used when we have write-intensive datasets and reads are not that high, since messaging queues doesn't require search, we'll use LSM tree