What is the difference between horizontal and vertical scaling?
Vertical scaling means giving one machine more CPU, memory or disk, while horizontal scaling means adding more machines and spreading the load across them.
All levels 路 All roles 路 All technologies
Every question in one place. Combine filters to narrow the list, or search for a concept, such as closure, JOIN, useEffect or rate limiter.
14 of 169 questions match
Clear filtersVertical scaling means giving one machine more CPU, memory or disk, while horizontal scaling means adding more machines and spreading the load across them.
A load balancer distributes incoming requests across several servers to improve capacity and availability, using algorithms such as round robin, least connections or consistent hashing.
Choose SQL when your data is relational and you need transactions, joins and strong consistency; choose NoSQL when you need flexible schemas, very high write throughput or horizontal scaling for a specific access pattern.
Caching stores frequently read data in fast storage such as memory to reduce latency and database load; the main strategies are cache-aside, write-through, write-back and time-based expiry (TTL).
An operation is idempotent if repeating it any number of times has the same effect as doing it once; it matters because network retries can otherwise create duplicate orders or payments.
Choose an algorithm such as token bucket or sliding window, store a counter per client (by user ID, API key or IP) in a fast shared store like Redis, and return HTTP 429 with a Retry-After header when the limit is exceeded.
Keep the main thread free by moving CPU-heavy work to worker threads or a job queue, and scale across cores and machines by running multiple processes (cluster or PM2) behind a load balancer with shared, external state.
Generate a short unique code for each long URL (for example by base62-encoding a unique ID), store the mapping in a key-value or relational database, serve redirects through a cache because reads far outnumber writes, and record analytics asynchronously.
The CAP theorem says that during a network partition a distributed system must choose between consistency (every read sees the latest write) and availability (every request gets a response); you cannot have both while the partition lasts.
Replication copies the same data to several servers to improve read capacity and availability, while sharding splits the data across servers so each holds only a part, which increases write capacity and total storage.
Start with a well-structured monolith unless you have several teams and clear service boundaries, because microservices add distributed-system complexity such as network failures, data consistency and operational overhead.
Accept notification requests through an API, put them on a message queue, and let channel-specific workers (email, SMS, push, in-app) send them using user preferences, templates, retries with idempotency and rate limits.
Clients keep a persistent WebSocket connection to stateless chat servers; messages are stored durably, routed to the recipient鈥檚 server through a pub/sub layer, and delivered as push notifications when the recipient is offline.
Store file contents as chunks in object storage and file metadata in a database; clients upload chunks directly with pre-signed URLs, a sync service tracks versions and changes, and a CDN serves downloads.