1/39
Looks like no tags are added yet.
[MQ Basics] Why does a messaging queue improve both performance and fault tolerance?
It buffers messages asynchronously so producers aren't blocked waiting on consumers, absorbing traffic spikes and reducing latency; it also persists messages and supports retries, so a message survives even if a consumer temporarily fails.
[MQ Basics] Why does decoupling producers from consumers matter architecturally?
Producers and consumers can scale, deploy, and fail independently without one needing to know the other's state or availability, which simplifies development and lets components evolve separately over time.
[MQ Basics] When would you choose point-to-point over pub-sub messaging?
Choose point-to-point when each message must be handled by exactly one consumer, such as distributing work to a pool of workers; choose pub-sub when the same message needs to reach every subscriber of a topic, such as broadcasting an event.
[MQ Basics] When is a synchronous request-reply pattern better than an async queue?
When the caller needs an immediate response before proceeding, such as checking product availability during checkout; async patterns fit when the caller doesn't need to wait on the result before continuing.
[MQ Best Practices] Why must message processing be idempotent in a messaging queue?
Network failures or consumer retries can deliver the same message more than once; idempotent processing ensures reprocessing a message yields the same result as processing it once, preventing duplicate actions or data corruption.
[MQ Best Practices] What three mechanisms keep a messaging queue stable during failures?
Automatic retries for transient issues, dead-letter queues for messages that repeatedly fail processing, and circuit breakers to stop a failing downstream dependency from cascading failures back through the system.
[MQ Requirements] Why can't a single-server queue meet distributed availability and scalability needs?
It's a single point of failure (SPOF): if the host or its network link fails, the whole queue becomes unavailable, and the locking needed to keep producers and consumers consistent on one node caps throughput under contention.
[MQ Requirements] What must a distributed queue guarantee given producers and consumers fail independently?
Once a message is accepted it must persist and stay available until a consumer successfully processes it, since producers and consumers can fail or disconnect at any time without coordinating with each other.
[Message Ordering] When would you accept best-effort ordering instead of strict ordering?
When consumers can tolerate messages arriving out of production order, such as independent log or email delivery; best-effort just queues messages in arrival order, which is cheaper and avoids the latency cost of enforcing true production order.
[Message Ordering] Why do server-assigned monotonic sequence numbers fail to guarantee true order?
They only reflect arrival order, not production order: a message produced earlier but delayed by the network arrives later and still gets a higher sequence number, and every message must serialize through one counter, creating a bottleneck during bursts.
[Message Ordering] Why is client-timestamp-based ordering unreliable across different producers?
Different client machines' clocks drift from each other (clock skew), so timestamps generated on separate clients can't be reliably compared to reconstruct a true global order, even though each timestamp is accurate to its own producer.
[Message Ordering] Why do synchronized clocks give the most robust message ordering?
They let the server assign globally comparable timestamps as sequence IDs, tagged with a process identifier for concurrent requests, so the server can detect and wait for delayed messages instead of guessing order from arrival time or skewed client clocks.
[Message Ordering] What's the throughput cost of enforcing strict message ordering?
The server must sort messages online or wait for potentially delayed ones before processing, both adding latency; most systems bound this with a time-window approach or simply accept lower throughput rather than guarantee full strict ordering.
[Concurrency] When would you choose serialization over locking for concurrent queue access?
Choose serialization, queuing requests into a buffer a single thread processes, when you want a lock-free design that avoids contention and gives higher throughput; locking works but scales poorly since competing processes block each other under load.
[Concurrency] Why might an application use multiple queues instead of one shared queue?
Splitting work across several queues, each with its own dedicated producers and consumers, isolates ordering and concurrency costs to a smaller scope per queue, at the cost of added complexity routing messages to the right one.
[MQ Architecture] Why does the frontend deduplicate requests before they reach the queue?
A producer retry after a lost acknowledgment can resend the same logical request; the frontend checks a hash key store and rejects a match, stopping a duplicate message from ever entering the queue instead of relying on consumers to filter it later.
[MQ Architecture] Why does the metadata service check its cache before the backing store?
Queue and user metadata is looked up on nearly every request, so serving it from cache keeps read latency low; it only falls through to the store on a cache miss, then updates the cache so the next lookup is fast again.
[MQ Architecture] When does metadata fit a simple replicate-everywhere approach instead of sharding?
When the total metadata is small enough to fit on one machine, just replicate it across every metadata server so any server can answer any request; sharding is only needed once metadata grows too large for a single machine.
[MQ Architecture] When would you shard metadata by frontend mapping versus host-based mapping?
Frontend mapping keeps the shard-routing table on the frontend servers, suited to a smaller set of routing nodes; host-based mapping stores that table on every host so any host can forward a misrouted request, suited to read-heavy workloads.
[MQ Backend] What's the difference between an internal and an external cluster manager?
An internal cluster manager knows every node inside one cluster and assigns queues within it, using heartbeats to track failures; an external cluster manager only knows about clusters as units, not what's inside them, and assigns queues across clusters.
[MQ Backend] When would you choose primary-secondary replication over independent host clusters?
Choose primary-secondary when one designated host per queue should own all its reads and writes with clear replication targets, coordinated by an internal cluster manager; choose independent host clusters when requests should distribute randomly across a cluster, coordinated by an external cluster manager mapping queues to clusters.
[MQ Backend] In the primary-secondary model, who deletes a message after it's consumed?
The primary host for that queue deletes the message and its replicas only after receiving an acknowledgment from the consumer, ensuring the message isn't lost before successful processing is confirmed.
[MQ Evaluation] What's the trade-off between offset-tracking and visibility-timeout message deletion?
Offset tracking never deletes on consumption, letting multiple independent consumers replay the same stream at their own pace; visibility-timeout hides a message after delivery and requires explicit deletion, supporting at-least-once delivery per message but not replay.
[MQ Evaluation] Why does the visibility-timeout model guarantee at-least-once delivery?
If a consumer crashes or fails to explicitly delete the message before its timeout expires, the message becomes visible again and another worker can pick it up, guaranteeing it's processed at least once even under consumer failure.
[MQ Evaluation] What two dimensions does a distributed messaging queue scale along?
Message volume within a single queue, expanding or shrinking its storage as message count crosses a threshold, and queue volume overall, the cluster manager adding more servers as the number of queues grows, so one busy queue doesn't starve the others.
[Pub-Sub Basics] How does pub-sub's push delivery improve on consumers polling for updates?
Subscribers don't need to repeatedly ask "is there anything new," which reduces wasted requests and latency, since the publisher pushes a message as soon as it's available instead of waiting for the next poll interval.
[Pub-Sub Basics] Why does pub-sub let a system scale subscribers independently?
Publishers only know about a topic, not which or how many services subscribe to it, so new subscribers can be added or removed without the publisher or any other subscriber needing to change.
[Pub-Sub Basics] How does pub-sub differ from a point-to-point messaging queue?
A queue delivers each message to exactly one consumer for work distribution; pub-sub delivers each message to every subscriber of a topic for broadcast, trading per-message competition for per-topic fan-out.
[Pub-Sub Requirements] What non-functional requirement is specific to pub-sub beyond a plain queue?
Fault tolerance: the system must keep accepting and delivering messages despite component failures, on top of the scalability, availability, durability, and concurrency requirements it shares with a plain messaging queue.
[Pub-Sub Requirements] Why does a pub-sub system need an explicit retention policy?
Messages must eventually be deleted once no longer needed; letting producers specify a retention period, after which the system automatically deletes expired messages, keeps storage bounded instead of growing forever.
[Pub-Sub Design] What problem does a per-topic-per-subscriber queue create as subscribers grow?
Every subscriber to a topic needs its own dedicated queue, so a topic with many subscribers means writing each message into that many separate queues, which stops scaling as subscriber count increases.
[Pub-Sub Design] How does a partitioned-broker design fix the per-subscriber-queue scaling problem?
Instead of one queue per subscriber, messages for a topic are distributed across a fixed set of partitions on broker nodes; many subscribers independently read the same partition at their own pace, so subscriber count no longer multiplies the number of queues.
[Pub-Sub Design] Why is strict ordering only guaranteed within a partition, not a whole topic?
Messages are distributed across a topic's partitions, and each partition is an independently ordered, append-only log; guaranteeing order across every partition would require coordinating all of them, defeating the parallelism partitioning provides.
[Pub-Sub Design] Why assign a message to a partition by key hash instead of round-robin?
Hashing a message's key to a partition guarantees every message for that key always lands on the same partition, preserving per-key order; pure round-robin spreads load evenly but gives no ordering guarantee for related messages.
[Pub-Sub Design] Why are partition records immutable and addressed by offset within segments?
Immutability lets multiple consumers independently read the same partition at different positions without interfering with each other, and addressing records by a numeric offset in append-only segment files makes sequential reads and replay cheap.
[Pub-Sub Design] How do consumers track their read progress in a partitioned broker design?
Each consumer's position is stored as an offset in a key-value store, letting it resume exactly where it left off after a restart or failure instead of re-reading from the beginning or losing its place.
[Pub-Sub Design] What does the cluster manager do in a broker-based pub-sub design?
It maintains the registry of brokers and topics, manages leader-follower replication by electing a new leader if one fails, and tracks broker health, so partition assignment and failover don't depend on any single broker.
[Pub-Sub Design] Why store subscription and retention metadata separately from the message brokers?
Subscription details and retention policy change rarely and are relational in nature, while brokers are optimized for high-throughput append-only message storage; separating them lets each component be optimized and scaled for its own access pattern.
[Pub-Sub Design] When would a pub-sub system support both push and pull delivery?
Push suits subscribers that want messages immediately with minimal latency, while pull suits subscribers that want to control their own consumption rate, such as batch processing; offering both lets different consumer types choose the trade-off that fits them.