Monitoring Container Status with Load Balancing
An example of monitoring container status with load balancing.
Table of Contents
Monitoring container status with load balancing
In a typical production Akana deployment, the Akana containers are deployed in a cluster and behind a load balancer. The diagram below shows the Network Director behind a load balancer. An application invokes an API hosted on the Network Director through the load balancer.
It is important that the Network Director is functioning, and all the APIs are deployed on it, before any API is invoked. This helps avoid 404 errors being returned to the application/consumer.
This configuration is applicable for any of the Akana containers that are behind a load balancer (for example, Policy Manager, Community Manager, OAuth Provider).
To ensure that the Network Director or container is ready to receive requests, the load balancers should be configured to monitor the state of the container using the Load Balancer's system health check URL. This URL returns one of the following:
- An HTTP 200 status code if the container ready to process inbound traffic.
- An HTTP 503 status code if the container is still coming up.
All the Akana containers that are configured behind a Load Balancer should use the Load Balancer's system health check URL to monitor system health status.
Configure the following container system health check URL in the Load Balancer and check for the following status codes.
Method: GET
URL: http(s)://<container_admin_host>:<container_port>/admin/health/measurables/akana.service.container.readiness?normal-status=200&failure-status=503&warning-status=503&brief=true
HTTP Status Codes:
- 200—Container is ready, the services/apis are deployed and the container can receive requests.
- 503—Container is still not ready to receive requests.
Using response codes to monitor status: examples
An example of the request and responses are below.
Request
GET https://10.1.16.24:8867/admin/health/measurables/akana.service.container.readiness?normal-status=200&failure-status=503&warning-status=503&brief=true HTTP/1.1 Host: 10.1.16.24:8867 Connection: Keep-Alive User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Response headers: Container is still coming up and is not ready to receive requests
HTTP/1.1 503 Service Unavailable Date: Tue, 05 Nov 2019 17:13:46 GMT Content-Type: application/json Transfer-Encoding: chunked
Response content: Container is still coming up and is not ready to receive requests
{ "id":"akana.service.container.readiness", "name":"Service Container Readiness", "path":"akana.service.container.readiness", "state":"FAILURE", "childCount":7, "editable":false, "options":{ "enableAuth":true, "links":[ { "rel":"self", "href":"https://10.1.16.24:8867/admin/health/measurables/akana.service.container.readiness/configuration" } ] }, "links":[ { "rel":"self", "href":"https://10.1.16.24:8867/admin/health/measurables/akana.service.container.readiness" }, { "rel":"brief", "href":"https://10.1.16.24:8867/admin/health/measurables/akana.service.container.readiness?brief=true" }, { "rel":"children", "href":"https://10.1.16.24:8867/admin/health/measurables/akana.service.container.readiness/children" }, { "rel":"options", "href":"https://10.1.16.24:8867/admin/health/measurables/akana.service.container.readiness/configuration" } ] }
Response headers: Container is ready to receive traffic
HTTP/1.1 200 OK Date: Tue, 05 Nov 2019 17:12:20 GMT Content-Type: application/json Vary: Accept-Encoding, User-Agent Transfer-Encoding: chunked
Response content: Container is ready to receive traffic
{ "id":"akana.service.container.readiness", "name":"Service Container Readiness", "path":"akana.service.container.readiness", "state":"NORMAL", "childCount":7, "editable":false, "options":{ "enableAuth":true, "links":[ { "rel":"self", "href":"https://10.1.16.24:8867/admin/health/measurables/akana.service.container.readiness/configuration" } ] }, "links":[ { "rel":"self", "href":"https://10.1.16.24:8867/admin/health/measurables/akana.service.container.readiness" }, { "rel":"brief", "href":"https://10.1.16.24:8867/admin/health/measurables/akana.service.container.readiness?brief=true" }, { "rel":"children", "href":"https://10.1.16.24:8867/admin/health/measurables/akana.service.container.readiness/children" }, { "rel":"options", "href":"https://10.1.16.24:8867/admin/health/measurables/akana.service.container.readiness/configuration" } ] }