nginx の upstream, consistent hash の挙動について nginx でリバースプロキシを作る際に、同じ URL へのアクセスは同じサーバーに流したい場合があります。 バックエンド側でコンテンツのキャッシュをしている場合等です。 nginx で以下のように設定した場合、サーバーの追加や削除で選ばれる対象がどのように変化するのか調査しました。 upstream myapp1 { hash $host$uri consistent; server 127.0.0.1:10080 max_fails=100 fail_timeout=10; server 127.0.0.2:10080 max_fails=100 fail_timeout=10; server 127.0.0.3:10080 max_fails=100 fail_timeout=10; server 1