API Rate Limiting & Scalability Patterns · Lección

Escalado horizontal frente a vertical

Comprenda las dos formas fundamentales de aumentar la capacidad de una API —escalar verticalmente o ampliar horizontalmente— y cómo elegir entre ellas según el coste, los límites y la arquitectura.

Lección 4 de 413 pasos

Escalado horizontal frente a vertical es una lección gratuita de API Rate Limiting & Scalability Patterns en CoddyKit. Esta es la lección 4 de 4. Puedes leer la lección completa abajo gratuitamente — luego la practicas en el navegador con un editor de código integrado y un tutor de IA 24/7. Forma parte de la ruta de aprendizaje de API Rate Limiting & Scalability Patterns, y tu progreso se sincroniza en la web y la app de CoddyKit. El curso de API Rate Limiting & Scalability Patterns incluye 4 lecciones en total.

Partes de esta lección aún no han sido traducidas y se muestran en inglés.

Two Ways to Grow

When an API runs out of capacity you have two levers:

  • Vertical scaling (scale up) — make the machine bigger
  • Horizontal scaling (scale out) — add more machines

Each has very different cost and reliability profiles.

Vertical Scaling Explained

Vertical scaling means upgrading a single server: more CPU cores, more RAM, faster disks.

It is simple — no code changes — but you eventually hit the largest instance available, and that one box is a single point of failure.

Horizontal Scaling Explained

Horizontal scaling adds more identical servers behind a load balancer. Traffic spreads across the fleet.

  • No hard ceiling — add nodes as needed
  • One node failing does not take down the service

The Cost Curve

Vertical scaling cost rises steeply — top-tier hardware carries a premium. Horizontal scaling uses many commodity nodes, which is usually cheaper per unit of capacity at large scale.

Statelessness Enables Scale-Out

To scale out, any node must handle any request. That requires stateless services — no session data stored on the instance.

Push session and state to a shared store (Redis, a database) so nodes stay interchangeable.

// session in a shared store, not local memory
await redis.set('session:' + id, data, 'EX', 3600)

Auto-Scaling Groups

Cloud platforms add or remove nodes automatically based on metrics like CPU or request rate.

You define a min, max, and a target metric; the platform keeps the fleet sized to load.

min_instances: 2
max_instances: 20
target_cpu_percent: 60

When Vertical Still Wins

Scaling up is the right call when:

  • The workload is hard to distribute (a single large in-memory dataset)
  • You need a quick fix before re-architecting
  • Licensing is per-node and a bigger box is cheaper

Diminishing Returns

Adding nodes is not free scaling — shared resources (a single database, a lock) become the new bottleneck. This is why scaling the data tier often matters more than the app tier.

Combining Both

Real systems mix strategies: right-size each node (a bit of vertical) then run many of them (horizontal). The goal is the best cost per request at your reliability target.

Measuring Before Scaling

Never scale blindly. Profile first to find the real constraint — CPU, memory, I/O, or a downstream dependency. Scaling the wrong dimension wastes money and hides the true bottleneck.

Scaling and Cost Awareness

Capacity is not free. A fleet sized for peak sits idle at night, burning money. Combine auto-scaling with right-sizing and consider spot or reserved capacity to match spend to real demand.

Quick Check

Check your understanding of scaling directions.

Recap

You compared scaling strategies:

  • Vertical — bigger box, simple, but capped and a single point of failure
  • Horizontal — more boxes, resilient, needs statelessness
  • Auto-scaling sizes the fleet to load
  • Always measure the real bottleneck first
Gratis para empezar

Aprende API Rate Limiting & Scalability Patterns con un tutor de IA — gratis

Escribe y ejecuta código real en tu navegador, obtén ayuda instantánea de un tutor de IA disponible 24/7 y continúa donde lo dejaste en la web o en la aplicación.

Cursos
12
Lecciones
48

Preguntas frecuentes

¿La lección «Escalado horizontal frente a vertical» es gratis?

Sí — el texto completo de «Escalado horizontal frente a vertical» es gratis para leer aquí en la web. Para practicarla de forma interactiva (editor de código integrado y tutor de IA 24/7) y desbloquear el resto del curso de API Rate Limiting & Scalability Patterns, actualiza a CoddyKit PRO. El curso de API Rate Limiting & Scalability Patterns incluye 4 lecciones en total.

¿Qué aprenderé en «Escalado horizontal frente a vertical»?

Comprenda las dos formas fundamentales de aumentar la capacidad de una API —escalar verticalmente o ampliar horizontalmente— y cómo elegir entre ellas según el coste, los límites y la arquitectura. Practicas API Rate Limiting & Scalability Patterns con código real que ejecutas directamente en el navegador, y un tutor de IA 24/7 responde tus preguntas mientras trabajas en la lección.

¿Necesito experiencia previa para empezar API Rate Limiting & Scalability Patterns?

No se requiere experiencia previa. API Rate Limiting & Scalability Patterns en CoddyKit está estructurado para principiantes hasta estudiantes avanzados, así que puedes empezar aquí o desde el inicio y avanzar a tu ritmo. Esta es la lección 4 de 4.

¿Cuánto tiempo toma la lección «Escalado horizontal frente a vertical»?

La mayoría de las lecciones de CoddyKit toman alrededor de 5–10 minutos. Cada una es compacta e interactiva, así que avanzas constantemente y retomas exactamente por donde dejaste en la web y la app.

¿Puedo escribir y ejecutar código en esta lección de API Rate Limiting & Scalability Patterns?

Sí. Cada lección de API Rate Limiting & Scalability Patterns incluye un editor de código integrado, así que escribes y ejecutas código real directamente en tu navegador y obtienes retroalimentación instantánea de IA — sin configuración local necesaria.

Todas las lecciones de este curso

  1. Comprender la escalabilidad de las API
  2. Métricas clave de escalabilidad
  3. Diseño de API sin estado frente a con estado
  4. Escalado horizontal frente a vertical
← Volver a API Rate Limiting & Scalability Patterns