Skip to content

Trade-Offs — Core Concepts

Interview Relevance: High — Demonstrating the ability to weigh different options and choose the right one for the specific system requirements is a key signal of seniority.

Master Trade-Off Table

This is the trade-off decision log that demonstrates seniority:

NOTE

Alternate production variant: The redirect type (302) and consistency level (QUORUM) selected below assume a requirement for strict server-side analytics and no dirty reads. This diverges from the baseline 5-step story which allows eventual consistency (ONE) and treats analytics as out-of-scope (allowing 301 redirects).

DecisionOption AOption BWe ChoseReason
Redirect type301 Permanent302 Temporary302Need server-side analytics tracking
DatabaseMySQL (SQL)Cassandra (NoSQL)Cassandra182 TB scale, key-value access pattern, built-in sharding
Sharding keyuser_idshort_codeshort_codePrimary access is by short code, avoids hotspots
Consistency levelStrong (QUORUM all)Eventual (ONE)QUORUMDirty reads on redirects are unacceptable
Cache evictionLFULRULRURecency is a better proxy for redirect popularity
ID generationHash + truncateSnowflake + Base62SnowflakeNo collision risk, no DB lookup for uniqueness check
Expiry mechanismCron scanCassandra TTLCassandra TTLNative O(1) expiry, no full-table scans

Released under the ISC License.