API Rate Limiting & Scalability Patterns · レッスン

水平スケーリングと垂直スケーリング

APIの容量を増やす2つの基本的な方法、スケールアップとスケールアウトを理解し、コスト、制限、アーキテクチャに基づいて選択する方法を学びます。

レッスン 4/413 ステップ

「水平スケーリングと垂直スケーリング」はCoddyKit上の無料API Rate Limiting & Scalability Patternsレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはAPI Rate Limiting & Scalability Patterns学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 API Rate Limiting & Scalability Patternsコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

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
無料で開始

AI チューターと学ぶ API Rate Limiting & Scalability Patterns — 無料

ブラウザでリアルコードを書いて実行し、24/7 の AI チューターから瞬時にサポートを受け、ウェブまたはアプリで続きから学習できます。

コース
12
レッスン
48

よくある質問

「水平スケーリングと垂直スケーリング」レッスンは無料ですか?

はい。「水平スケーリングと垂直スケーリング」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、API Rate Limiting & Scalability Patternsコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 API Rate Limiting & Scalability Patternsコースには全4レッスンが含まれています。

「水平スケーリングと垂直スケーリング」で何を学びますか?

APIの容量を増やす2つの基本的な方法、スケールアップとスケールアウトを理解し、コスト、制限、アーキテクチャに基づいて選択する方法を学びます。 ブラウザで直接実行するハンズオンコードでAPI Rate Limiting & Scalability Patternsを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

API Rate Limiting & Scalability Patternsを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのAPI Rate Limiting & Scalability Patternsは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。

「水平スケーリングと垂直スケーリング」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このAPI Rate Limiting & Scalability Patternsレッスンでコードを書いて実行できますか?

はい。すべてのAPI Rate Limiting & Scalability Patternsレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. APIスケーラビリティの理解
  2. 主要なスケーラビリティ指標
  3. ステートレスAPIとステートフルAPIの設計
  4. 水平スケーリングと垂直スケーリング
← API Rate Limiting & Scalability Patternsに戻る