Hi,
Hi. I have a problem with health endpoint. There is self hosted OWIN WebApi
I have simple health check middleware which first at all middlewares chain. Sometimes health check response time 10-20 seconds (every 5-10-15 minutes), at normal case 30-40ms.
HAProxy calls health endpoint every some seconds. Timeout 5 seconds. And when HAProxy got timeout from health endpoint, it makes node unavailalbe and of course all connection drop :(
Middleware:
public override async Task Invoke(IOwinContext context) { var request = context.Request; if (request.Uri.AbsolutePath.ToLower() != "/health") { await Next.Invoke(context); return; } context.Response.Headers.Set("Content-Type", "application/json"); if (request.Method == "GET") { if (!Health.Healthy) { context.Response.StatusCode = 503; } } else { context.Response.StatusCode = 400; } }
How can I investigate where is problem? Of course problem connected with load, threads, locks, other WEBApis on the same server etc., because problem "doesn't exist" at night (count of HAProxy timeouts are very small in comparison with day). Or maybe problem with my middleware?