Vertical vs Horizontal Scaling: The Big Trade-off
60sThis segment clearly explains a fundamental system design dilemma, appealing to aspiring engineers and tech enthusiasts who often debate this topic.
▶ Play Clip"Solid content that delivers on the title's promise of trade-offs, but the sponsor segment and generic examples add some padding."
This video explores the fundamental trade-offs in system design, covering key architectural decisions such as scaling, API design, state management, caching, and processing models. It provides a balanced view of each approach, highlighting when to choose one over the other based on application requirements.
Vertical scaling adds resources to existing servers (simple, no code changes, but has physical limits and expensive upgrades). Horizontal scaling adds more servers (virtually unlimited, better fault tolerance, but introduces complexity with load balancing and data consistency).
REST is mature and simple but leads to multiple round trips and over-fetching. GraphQL allows clients to request exact data in one query, but adds server complexity and potential performance/security issues. Choice depends on application maturity and frontend autonomy needs.
Stateless design scales well, but certain apps (game servers, WebSocket servers, trading platforms) require stateful design for core functionality. Modern systems often combine both, using stateless services for general operations and stateful components for real-time features.
Cache-aside is simple but can serve stale data. Write-through updates cache and database simultaneously, ensuring freshness but adding write complexity. Critical for inventory, financial transactions, and reservations.
Synchronous is straightforward and provides immediate feedback, but long tasks degrade UX. Asynchronous acknowledges requests immediately and processes in background, improving UX but requiring message queues, retries, and error handling. Systems evolve to hybrid approaches.
System design is fundamentally about making trade-offs. Understanding these key architectural decisions helps build more resilient and efficient systems, often leading to hybrid approaches that balance simplicity, scalability, and user experience.
What is the main trade-off between vertical and horizontal scaling?
Vertical scaling is simpler but has physical limits; horizontal scaling offers unlimited growth but adds complexity.
00:13
What problem does GraphQL solve compared to REST?
GraphQL enables clients to request exactly the data they need in a single query, reducing round trips and over-fetching.
01:23
Which applications fundamentally require stateful design?
Game servers, WebSocket servers, and trading platforms require stateful design for core functionality.
03:14
What is the difference between cache-aside and write-through caching?
Cache-aside fetches data on miss and can serve stale data; write-through updates cache and database simultaneously for freshness.
03:54
What are the benefits and drawbacks of asynchronous processing?
Benefits: improved UX for long tasks. Drawbacks: complexity with message queues, retries, and error handling.
04:59
Scaling trade-off
Clearly contrasts simplicity vs. scalability, a core decision in system design.
00:13GraphQL's purpose
Explains why GraphQL was created and its trade-offs, helping engineers choose the right API.
01:23Stateful necessity
Highlights that some apps cannot be stateless, guiding architecture decisions.
03:14Caching freshness
Shows the importance of cache consistency for critical systems.
03:54Async processing value
Demonstrates how async improves UX despite added complexity.
04:59[00:01] System design is all about making the right trade-offs. In our previous video, we covered data management trade-offs. Today, we'll explore another set of system design trade-offs that help us build better systems.
[00:13] When an application needs to scale, we face the first significant trade-off. Vertical scaling involves adding more resources to existing servers, increasing CPU, or upgrading hardware. This approach requires no code changes, but eventually,
[00:27] its physical limitations and requires expensive upgrades. Horizontal scaling means adding more servers to distribute the load. This provides virtually unlimited scaling potential and improved fault tolerance.
[00:41] However, introduces complexity with load balancing, data consistency, and distributor system challenges. The fundamental trade-off is between simplicity and scalability. Vertical scaling is easier to manage but has a ceiling,
[00:55] while horizontal provides more growth but requires more engineering effort. When designing APIs, most systems naturally start with REST APIs. They are mature, widely understood, and follow HTTP semantics
[01:10] with clear resource-oriented patterns. As applications evolve, REST starts to show limitations. Frontend teams make multiple round trips to gather related data, endpoints for livery for specific UI needs,
[01:23] and clients often receive more data than they need. GraphQL was developed to address these scaling pain points It enables clients to request precisely the data they need in a single query This flexibility introduces new challenges More complex server implementation
[01:40] potential performance issues with nested queries, and security concerns with unbound queries. The key consideration isn't about which approach is better, but about understanding the application's maturity and requirements. REST extends for straightforward, quiet operations and proper
[01:56] APIs, while GraphQL shines for complex UIs and diverse data requirements, and when front-end teams need more autonomy from back-end development cycles. Are you tired of juggling multiple AI tools and subscriptions?
[02:11] Say hello to JetLLM Teams, the only all-in-one AI assistant that combines top models, creative tools, and developer features. Get access to top models like O3 Mini, GPT 4.1, Cloud Sonnet 3.7, Lama 3, and more.
[02:28] When you ask any query, Raw LLM picks the best AI tools for your task. Generate stunning images with tools like Flux, DALI, and generate videos with Clink 2.0 Runway.
[02:40] Chat with PDFs, generate PowerPoints and docs with simple prompts, and humanize AI tasks to ditch detectors. developers, enjoy GitHub integration, free code LLM in VS code and vibe coding with app LLM,
[02:55] write run code and build chatbots with AI agents super easily All these for just a month way cheaper than separate subscriptions Click the link in the description and sign up now to access Chat LLM The Stateful vs Stateless trade has practical implications for specific application types
[03:14] While most web services benefit from stateless design for scalability, certain applications fundamentally require server-side state. Game server needs to track player positions and game state.
[03:26] WebSocket servers maintain persistent connections for chat applications. Trading platforms must track session state for transactions. In these cases, stateful design isn't optional. It's necessary for core functionality.
[03:40] Modern architecture often combines both approaches, implementing stainless services for general operations with specialized stateful components for real-time features. As the applications scale, caching becomes essential for performance,
[03:54] but how we update that cache presents another key trade-off. Most systems start with breakthrough caching. When data isn't in the cache, the system fetches it from the database, stores it in the cache, and then returns it to the user.
[04:08] This simple approach works well until data freshness becomes critical. When User A updates information and User B requests it moments later, User B might see outdated data from a stale cache.
[04:20] For inventory systems, financial transactions, or reservation platforms, this inconsistency can cause serious problems. Write-through caching addresses this by updating both the cache and the database simultaneously.
[04:33] It ensures data freshness at the cost of added write complexity Finally let examine how a system responds to user requests Most applications naturally start with synchronous processing
[04:46] It's straightforward, predictable, and provides immediate feedback. The client makes a request, the server processes completely, and returns a response. What happens when operations become time-consuming?
[04:59] Long-running tasks like radio processing, report generation, or batch email sending can keep users waiting, degrading the experience. This is where asynchronous processing becomes valuable.
[05:11] Instead of making users wait, the system acknowledges the request immediately and processes it in the background, potentially notifying users when it completes. This improves user experience but introduces complexity.
[05:23] complexity. We need message queues, status tracking, retry mechanisms, and error handling strategies. The trade-off is about balancing implementation complexity against user experience
[05:35] needs. System typically evolves towards a hybrid approach, keeping quick operations synchronous while offloading resource-intensive tasks to asynchronous processing. System design is fundamentally a series of trade-offs. Understanding these key architectural decisions
[05:52] will help us build more resilient and efficient systems. If you like our videos, you might like our System Design Newsletter as well. It covers topics and trends in large-scale system design.
[06:04] Trusted by 1 million readers.
⚡ Saved you 0h 06m reading this? Transcribe any YouTube video for free — no signup needed.