Skip to content

Instantly share code, notes, and snippets.

@nojima
Last active June 20, 2017 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nojima/c90c656477f581a64e847601e953712a to your computer and use it in GitHub Desktop.
Save nojima/c90c656477f581a64e847601e953712a to your computer and use it in GitHub Desktop.

Design Patterns for Infra Development

インフラ開発で使えるデザインパターンを雑に集めるページ。 パターン名は適当。

Fail Fast

  • エラーが起こったら余計なことはせずに即座にエラーメッセージを出力して終了すること。
  • エラー処理の基本。

Idempotency

  • 冪等性
    • あるオペレーションを、間に他のオペレーションを入れずに繰り返したとき、それを1回実行したときと同じ結果になる性質。
  • 自動化したオペレーションに冪等性を持たせておくと便利。
    • エラー時のリトライが簡単
    • 現在に状態を確認することなくオペレーションを実行可能

Data/Program Separation

  • データとその他を明確に分離する。
    • データとは、ユーザが入力したテキストなど、失ったら取り戻せないシステム上重要なもの。
    • その他とは、プログラム、設定、OSのファイルなど、失ったとしても再構築できるもの。
  • ファイルシステム的な分離
    • データ専用のディレクトリを作る。
  • ホストによる分離
    • データ格納用のホストを用意し、DBMSなどのプログラムが動いているホストからネットワーク経由でマウントする。

Stateless Server

  • 状態(≒データ)を持たないサーバ。
  • 再構築できるので管理が容易。
  • できるだけ多くのサーバが Stateless になるように設計するとよい。

Service Discovery

Two Phase Commit

Bounded Context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment