モニターとヘルスチェック
ロードバランサーには、トラフィックを分散する以上の役割があります。
結局のところ、ロードバランサーとプールがオフラインのサーバーにリクエストを送信したり、すでにトラフィックで過負荷になっているサーバーに送信したりしても、何の意味があるでしょうか?理想的には、ロードバランサーはサーバーが処理できるリクエストのみを転送するべきです。
そこで、ロードバランシングの方程式のもう一つの要素、モニターとヘルスチェックが登場します。
flowchart RL
accTitle: Load balancing monitor flow
accDescr: Monitors issue health monitor requests, which validate the current status of servers within each pool.
Monitor -- Health Monitor ----> Endpoint2
Endpoint2 -- Response ----> Monitor
subgraph Pool
Endpoint1((Endpoint 1))
Endpoint2((Endpoint 2))
end
モニターは、プール内の各サーバーの健康状態を評価するために定期的にヘルスチェックを発行します。
Requests issued by a monitor at regular interval and — depending on the monitor settings — return a pass or fail value to make sure an endpoint is still able to receive traffic.
Each health monitor request is trying to answer two questions:
- Is the endpoint offline?: Does the endpoint respond to the health monitor request at all? If so, does it respond quickly enough (as specified in the monitor's Timeout field)?
- Is the endpoint working as expected?: Does the endpoint respond with the expected HTTP response codes? Does it include specific information in the response body?
If the answer to either of these questions is "No", then the endpoint fails the health monitor request.
このリクエストとレスポンスのシステムにより、ロードバランサーはどのサーバーが受信リクエストを処理できるかを把握できます。