Skip to content

Production Guides & Recipes

To minimize database load during frequent health checks (e.g. every 5-10 seconds by Kubernetes):

import { payloadReadinessCheck } from "@nexload-sdk/healthcheck-payload";
const check = payloadReadinessCheck(payload, {
collection: "users",
// Excluded from liveness probe:
scopes: ["readiness"],
timeoutMs: 3000,
});

The check requests zero population depth (depth: 0) and limits results to 1 document, ensuring minimal memory and database CPU utilization.


Indicates that the underlying database connection timed out or rejected the query. Check database pool exhaustion, connection string validity, or network partitions.

Ensure the checked collection has an index and does not execute heavy afterRead hooks. If needed, create a dedicated minimal _health collection with a single static document.

3. Never Assign Payload Database Check to Liveness

Section titled “3. Never Assign Payload Database Check to Liveness”

If the database goes down, liveness failure will cause continuous pod restarts. Always assign database checks to scopes: ["readiness"].