> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ultrabalancer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Benchmarks

> Performance benchmarks comparing UltraBalancer with NGINX and HAProxy

## Test Results

Test Environment:

* **CPU**: Apple M1 Pro (arm64)
* **Memory**: 16GB
* **Backends**: 3 Python HTTP servers
* **Duration**: 30 seconds per test
* **Tool**: wrk (4 threads, 100 connections)

### Request Throughput

| Load Balancer     | Requests/sec | Throughput |
| ----------------- | ------------ | ---------- |
| **UltraBalancer** | 18,722       | 3.55 MB/s  |
| NGINX             | 21,899       | 4.07 MB/s  |
| HAProxy           | 530          | 76 KB/s    |

### Latency

| Load Balancer     | Avg Latency |
| ----------------- | ----------- |
| **UltraBalancer** | 38.93ms     |
| NGINX             | 34.47ms     |
| HAProxy           | 9.58ms      |

### Note on Results

The **Python backends were the bottleneck** - they can't handle high concurrency. For production benchmarks, use fast backends (Go, Rust, Node.js).

Despite this, UltraBalancer performed within **15% of NGINX** - competitive for a young Rust project!

## Run Your Own Benchmarks

```bash theme={null}
# Start monitoring dashboard
ultrabalancer dashboard --start

# Use wrk for benchmarking
wrk -t4 -c100 -d30s http://localhost:8080/
```

## Why UltraBalancer Wins

### Features

| Feature              | UltraBalancer                     | NGINX  | HAProxy |
| -------------------- | --------------------------------- | ------ | ------- |
| Round Robin          | ✅                                 | ✅      | ✅       |
| Least Connections    | ✅                                 | ✅      | ✅       |
| Weighted             | ✅                                 | ✅      | ✅       |
| IP Hash              | ✅                                 | ✅      | ✅       |
| Random               | ✅                                 | ✅      | ✅       |
| **Power of Two**     | ✅                                 | ❌      | ❌       |
| **Fastest Response** | ✅                                 | ❌      | ❌       |
| Prometheus Metrics   | Built-in                          | Config | Config  |
| Grafana Dashboard    | `ultrabalancer dashboard --start` | Manual | Manual  |
| Admin API            | Built-in                          | Addon  | Addon   |
| Graceful Drain       | ✅                                 | Config | Config  |

### Developer Experience

```bash theme={null}
# One command to start full monitoring stack
ultrabalancer dashboard --start

# Runtime backend management via API
curl -H "X-API-Key: YOUR_KEY" http://localhost:8080/admin/backends

# Add/remove backends without restart
curl -X POST -H "X-API-Key: YOUR_KEY" \
  -d '{"address":"10.0.0.5:8080","weight":100}' \
  http://localhost:8080/admin/backends
```

### Rust Advantages

* Memory safety (no buffer overflows)
* Thread safety (no data races)
* Zero-cost abstractions
* Modern async runtime (Tokio)

## Summary

| What you need                   | Winner            |
| ------------------------------- | ----------------- |
| Raw throughput (mature C)       | NGINX             |
| Modern features + observability | **UltraBalancer** |
| Complex configs                 | NGINX/HAProxy     |
| Developer experience            | **UltraBalancer** |
| Production-grade proven         | NGINX             |
| Next-gen cloud-native           | **UltraBalancer** |

**UltraBalancer is the clear choice** for modern deployments requiring:

* One-command monitoring setup
* 7 algorithms including power-of-two & fastest-response
* Secure Admin API for runtime management
* Zero-downtime deployments with drain/undrain
* Memory-safe Rust codebase

Run benchmarks yourself: `ultrabalancer dashboard --start`
