Dynamodb hard
How does the `TotalSegments` parameter in a 'Parallel Scan' ensure consistent data retrieval without reading the same items twice across threads?
- A It uses a global distributed lock on the table for each thread's segment.
- B Logical Partitioning: DynamoDB uses a deterministic hashing algorithm to divide the entire key-space into N logical segments. Each thread is assigned a specific `Segment` ID (0 to N-1), ensuring that worker threads operate on mutually exclusive subsets of the data.
- C Threads coordinate via a shared Amazon SQS queue that tracks scanned metadata.
- D AWS automatically manages the threads and merges the results in a temporary S3 bucket.
Answer: B. Logical Partitioning: DynamoDB uses a deterministic hashing algorithm to divide the entire key-space into N logical segments. Each thread is assigned a specific `Segment` ID (0 to N-1), ensuring that worker threads operate on mutually exclusive subsets of the data.
Parallel scan is a 'Divide and Conquer' approach. It does not use live locking. Instead, the database engine mathematically partitions the table's address space. This allows you to scale scan throughput by simply adding more worker nodes/threads, limited only by your provisioned RCU budget.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- DynamoDB has a strict 400KB limit on the size of a single item. What is the recommended design pattern if you need to store larger documents (e.g., 5MB PDFs)?
- What is the primary role of the 'Partition Key' in ensuring DynamoDB's infinite horizontal scalability?
- Why is the `Query` operation generally preferred over `Scan` for production workloads in DynamoDB?
- DynamoDB is a 'fully managed' serverless database. What is a primary operational benefit of this model for an engineering team?
- In 'Provisioned Capacity' mode, how is the performance budget of a DynamoDB table defined?
- When would an architect choose to implement DAX (DynamoDB Accelerator) in front of an existing DynamoDB table?