# Understanding Health Data<no value>

## How Health Checks Work

A background process in the relay pings every registered instance at a configurable interval (default: 60 seconds). Each check performs an HTTP GET request to the instance URL and records:

- **HTTP status code** — 200 = healthy, anything else is recorded
- **Response time** — how long the request took in milliseconds
- **Is behind Cloudflare** — detected via response headers

## Health States

| State | Meaning |
|-------|---------|
| `healthy` | Instance responded with 200 in a reasonable time |
| `degraded` | Instance responded but with high latency or non-200 status |
| `down` | Instance did not respond or returned a server error |

## Uptime Tracking

The relay tracks how many checks passed vs failed over time:

```
uptime_percentage = successful_checks / total_checks * 100
```

This gives a reliable picture of long-term stability, even if the instance has occasional hiccups.

## The Cloudflare Penalty

Instances behind Cloudflare receive a priority penalty. This is not a judgment on quality — it is a bias toward instances that are fully self-hosted without a CDN layer. The penalty is small and affects only the priority sort order, not health status.

## Checking Health History

For any instance, you can see its full health history:

```bash
curl https://relay.btoven.net/api/v1/instances/instance-name
```

The response includes a `health_history` array with timestamps and results.
