0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Web APIシリーズその5(全5回):APIサーバをどう配置するか

Posted at
1 / 12

Webアプリケーションに必要なサーバ機能

  1. 静的ファイル配信
    HTML/JS/CSSなど
  2. API

機能毎に求められるサーバスペックは異なる

  • 静的ファイル配信
    • とにかく決められたコンテンツを素早く返す
    • CPUパワーはさして重要でない
    • キャッシュが有効
  • API
    • DBやストレージとのやり取りと計算
    • APIリクエストは頻繁に生じるためCPUとメモリ両方を潤沢に使いたい
    • どちらかと言えばCPUパワーがより重要(DBはメモリが大事)

アーキテクチャパターン

  • APIサーバ独立パターン
  • 同居パターン
  • サーバーレスパターン

※私がこのスライドのために勝手に名付けたのであり、一般に浸透している用語ではありません。


APIサーバ独立パターン(1/2)

image.png


APIサーバ独立パターン(2/2)

  • (+)それぞれのサーバでスペックを変えられるので最適なスペックを追求できる
  • (-)CORSが必要

同居パターン(1/2)

image.png


同居パターン(2/2)

  • (+)デプロイプロセスや運用がシンプル
  • (-)静的ファイル配信が多くなった時にどうなるか・・・?

サーバーレスパターン(1/2)

image.png


サーバーレスパターン(2/2)

  • (+)前述の2パターンの欠点を克服
  • (+)コスト最適
  • (-)実現が複雑。事実上、専用のサービスを使うことになる
    Static Web App(Azure)/Amplify(AWS)

サーバーレスパターン補足

  • 理想的に思えるが、難点はある
    • 開発プラットフォームが限定される
    • AWSベンダにロックインされる

最後に

  • どのパターンも一長一短
  • 選択肢を複数持っておくことが大事
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?