Data Modeling hard
Log Systems Merge (LSM) Trees (used in RocksDB, Cassandra) optimize for fast writes. What is their primary downside regarding Disk I/O?
- A Excessive 'Read Amplification', where the database must scan multiple disparate levels of sorted files on the disk to find the most recent version of a record.
- B Intense 'Write Amplification' during Compaction, as existing data is repeatedly read and rewritten during background merges to maintain a sorted structure.
- C Severe 'Random I/O Latency', as the append-only nature of the log requires the disk head to make frequent, unpredictable jumps across the physical storage blocks.
- D Massive 'Index Fragmentation', which occurs when the database's internal B-Tree structure becomes inefficient due to the high volume of non-sequential record updates.
Answer: B. Intense 'Write Amplification' during Compaction, as existing data is repeatedly read and rewritten during background merges to maintain a sorted structure.
Log-Structured Merge (LSM) Trees convert random writes into sequential appends (optimizing for throughput), but they come with a hidden cost: Compaction. To keep data sorted and clean up deletions, the system must constantly merge old files into new ones. This 'Write Amplification' can consume more than 50% of the effective disk bandwidth, occasionally causing significant latency spikes for foreground application requests.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- When modeling a Distributed Transaction using the Saga Pattern (Choreography or Orchestration), what type of consistency do you achieve?
- Which practice prevents SQL Injection attacks?
- What is 'Bi-Temporal' data modeling (e.g., in SQL:2011 standard)?
- Adding an Index to a database column generally improves Read performance. What is the negative trade-off?
- What is the primary objective of normalizing a relational database schema (e.g., to 3NF)?
- You are modeling a 'Likes' counter for a global social network. You choose an AP model. What anomaly must your data model handle?