# Priority Sorting<no value>

## Why Priority Matters

When there are many instances of the same type, users need a way to pick the best one. Priority sorting ranks instances so the most reliable, fastest, and most independent instances appear first.

## The Formula

Priority is a composite score based on three factors:

| Factor | Weight | Description |
|--------|--------|-------------|
| **Health** | Highest | Healthy > Degraded > Down |
| **Response time** | High | Lower average latency = better |
| **Cloudflare penalty** | Low | Non-CF instances score slightly higher |

## How to Read the Scores

Instances are sorted in descending order — higher priority = better. The score is relative, not absolute. It is designed to:

1. Always put healthy instances before degraded ones
2. Among healthy instances, prefer faster ones
3. Among equally fast instances, prefer non-Cloudflare ones

## Example Sort

```
Rank | Name              | Status    | Response Time | Cloudflare | Priority
1    | my-searxng-fast   | healthy   | 120ms         | no         | 95
2    | another-searxng   | healthy   | 200ms         | no         | 88
3    | cf-searxng        | healthy   | 100ms         | yes        | 85
4    | slow-searxng      | degraded  | 3000ms        | no         | 45
5    | down-searxng      | down      | -             | no         | 0
```

Instance 3 is faster than instance 2, but gets a small Cloudflare penalty, so instance 2 ranks higher.
