On Sat, Mar 27, 2021 at 3:19 PM 'Axel Wagner' via golang-nuts <
golang-nuts@googlegroups.com> wrote:

> The best way to do it is probably by making an HTTP request and see if it
> succeeds. In production, it's always a good idea to have a health check
> endpoint anyways. So some service manager can check if it's alive and
> restart it if necessary. Or so that a load balancer doesn't send traffic
> until the service is healthy.
>

In addition, if a server relies on other parts/systems to work, you can end
up in a situation where those parts fail, but the server doesn't. This
means it is hard to have a "barrier" in the program after which something
is safe to start, since that assumption might fail later on when the
program is running. It's yet another argument why Alex' suggestion of
having a health check is beneficial. You can fail and report why you don't
provide service right now (I need access to a database, but it's timing
out, etc...). Systems which can analyze their own state and report back on
known errors are far easier to maintain.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAGrdgiWApvJv3RkRR%3DMWxE7-T-Woq6FY0qq%3Dd9TsGSbfec4H2A%40mail.gmail.com.

Reply via email to