getHealth
The getHealth method returns the current health status of the RPC node. This simple yet essential method provides a quick way to determine if the node is functioning properly and is caught up with the cluster, making it perfect for health checks and monitoring systems.
A healthy node is one that is actively participating in the cluster, receiving new blocks, and is not excessively behind the current slot. When a node falls behind by more than a configured threshold (typically 150 slots or more), it returns an unhealthy status. This indicates the node may be experiencing network issues, performance problems, or is in the process of catching up after downtime. Unhealthy nodes may return stale data or fail to process transactions reliably.
This method is crucial for load balancers, monitoring systems, and applications that manage multiple RPC endpoints. It enables automatic failover to healthy nodes, prevents routing requests to degraded nodes, and helps maintain high availability for production applications. The method is lightweight and designed to be called frequently without significant performance impact.
Parameters
parameter | type | description |
|---|---|---|
config | object | Optional configuration object (currently no config options are available) |
Return Object
field | type | description |
|---|---|---|
result | string | Returns 'ok' if the node is healthy. If unhealthy, the method returns an error with details |
Request Example
Response Example
Tip: If the node is unhealthy, you'll receive an error response instead of a result. Common error: "Node is behind by X slots" indicates the node is catching up. Use this in health check endpoints and implement automatic retry logic with fallback RPC nodes for production reliability.