buchgr / bazel-remote

A remote cache for Bazel
https://bazel.build
Apache License 2.0
595 stars 154 forks source link

Is /status appropriate for a health-check? #597

Closed njlr closed 1 year ago

njlr commented 1 year ago

I am deploying behind a load-balancer that performs health-checks on the instance.

/ will return 400 so I have been using /status

Is this appropriate for a health-check?

Perhaps a new route /health should be added that has very low overhead and has only this purpose?

Possibly related: https://github.com/buchgr/bazel-remote/issues/590

mostynb commented 1 year ago

Unless your cache is under extreme load, I think querying /status would be fine for a health-check that runs a few times per minute. A slightly cheaper option would be to query /cas/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 (the empty blob) which doesn't need to acquire a mutex on the cache index.

In general I would recommend the /grpc.health.v1.Health/Check service, (though if you're using authentication you might need to wait until #595 lands).

mostynb commented 1 year ago

I landed #595, and now the grpc health check service should always be reachable even without authentication when the server has auth enabled (assuming grpc is enabled). So I'd recommend that.

Closing this now, feel free to reopen if I haven't answered your question.