We implemented a custom health check as mentioned below
import io.smallrye.common.annotation.Blocking;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.microprofile.health.HealthCheck;
import org.eclipse.microprofile.health.HealthCheckResponse;
import org.eclipse.microprofile.health.Liveness;
import jakarta.enterprise.context.ApplicationScoped;
@Slf4j
@Blocking
@Liveness
@ApplicationScoped
public class ServiceHealthCheck implements HealthCheck {
@Override
public HealthCheckResponse call() {
log.info("Custom health check is being executed");
return HealthCheckResponse.up("Service is up and running");
}
}
We enabled quarkus HTTP debug logs and got to know that some of the liveness check requests were being executed using eventloop threads (Most of the requests were executed by executor threads).
Whenever eventloop threads execute the requests, it takes around 30 seconds to respond due to which kubernetes liveness check fails (As we have configured it to wait for maximum 30 seconds).
Even after adding @Blocking annotation why the requests are executed by eventloop threads ?