where should i start learning system design as a junior developer?
begin with foundational building blocks: client-server architecture, dns, http/apis, and basic database types. then learn scaling concepts like load balancing, caching, and replication before moving to microservices and messaging.
how do i decide between sql and nosql databases?
choose sql when you need structured schemas and strong consistency; choose nosql when you need flexible schemas and horizontal scalability. match the database to your access patterns and consistency needs.
what is the cache-aside pattern and how do you handle stale cache?
in cache-aside the application checks cache first, reads from the db on a miss, and writes the result back to cache. manage staleness with appropriate ttl values and carefully invalidate or update cache on writes.
what trade-offs does the cap theorem force in distributed systems?
the cap theorem means you can't have consistency, availability, and partition tolerance all at once; real systems pick which to favor based on use case (e.g., favor availability for user-facing reads, consistency for payments).
when should i use websockets versus http polling?
use websockets for real-time two-way updates (chat, live dashboards, multiplayer games). avoid frequent http polling because it wastes bandwidth and increases server load when updates are sparse.
how do you make requests idempotent in distributed systems?
assign a unique id to each operation and check if it's already been processed before executing. this prevents duplicate effects from retries or repeated client submissions.