# Performance validation suite

This suite validates that Edera delivers **container-like performance** while providing VM-level isolation. The tests establish baselines and compare performance between Edera zones and standard containers.

**Benchmarking a multi-threaded CPU workload?** See [CPU performance benchmarking](https://docs.edera.dev/guides/validate/cpu-benchmarking/) for a self-contained guide covering annotation requirements, multi-core configuration, and real-world thread counts.

**Before you begin:** Complete the [prerequisites](https://docs.edera.dev/guides/validate/#prerequisites) including cloning the learn repo and running `make setup`.

All manifests are available in the [learn repository](https://github.com/edera-dev/learn/tree/main/validate/performance).

## Test 1: Network performance with iperf

[iperf3](https://iperf.fr/) is the industry-standard tool for measuring network bandwidth and throughput. It creates TCP or UDP streams between a client and server to measure maximum achievable throughput.

### Network test overview  
This test runs iperf3 client and server containers **in the same pod** (same Edera zone) to measure intra-zone network performance. Both containers share the zone’s network stack, communicating via the pod IP address.

The test validates that Edera’s network virtualization doesn’t significantly impact communication within a zone—the most common pattern for tightly coupled services like sidecars, service meshes, and multi-container pods.

### Run the comparison  
The easiest way to run this test is with the comparison target, which runs both Edera and baseline benchmarks and outputs a summary table:

```bash
make iperf-compare
```

This will:

1. Deploy iperf pods (Edera and baseline)
2. Run 30-second benchmarks on each
3. Output a comparison table showing throughput and percentage of baseline

Example output:

```text
┌─────────────┬────────────────┬──────────────┐
│ Test        │ Throughput     │ % of Baseline│
├─────────────┼────────────────┼──────────────┤
│ Edera       │   27.4 Gbps    │  92%         │
│ Baseline    │   29.9 Gbps    │ 100%         │
└─────────────┴────────────────┴──────────────┘
```

### Run tests individually

**Edera:**

```bash
make iperf
kubectl exec -it iperf-edera -c iperf-client -- iperf3 -c $(kubectl get pod iperf-edera -o jsonpath='{.status.podIP}') -t 30
```

**Baseline:**

```bash
make iperf-baseline
kubectl exec -it iperf-baseline -c iperf-client -- iperf3 -c localhost -t 30
```

**Success criteria:**  
Compare your Edera throughput against baseline. Results vary based on instance type and network conditions in your environment.

**Cleanup:**

```bash
kubectl delete pod iperf-edera iperf-baseline
```

## Test 2: CPU performance with sysbench

[sysbench](https://github.com/akopytov/sysbench) is a scriptable multi-threaded benchmark tool commonly used for database and system performance testing.

### CPU test overview  
The sysbench CPU benchmark calculates prime numbers up to a specified limit (20,000 in our test) using a trial division algorithm. This is a **pure compute workload** that:

- Runs entirely in CPU and memory (no disk I/O)
- Uses consistent, reproducible calculations
- Scales predictably with CPU cores
- Isolates CPU overhead from other variables like network or storage

This makes it ideal for measuring virtualization overhead. Any performance difference between Edera zones and standard containers directly reflects the CPU overhead of Edera’s VM-based isolation.

### sysbench metrics  
- **Events per second**: Prime number calculations completed per second (higher is better)
- **Latency**: Time per calculation in milliseconds (lower is better)

The test runs with 2 CPU threads for 60 seconds to get stable, comparable results.

### Run sysbench comparison

```bash
make sysbench-compare
```

This will:

1. Deploy sysbench jobs (Edera and baseline)
2. Run 60-second benchmarks on each
3. Output a comparison table

Example output:

```text
┌─────────────┬─────────────────┬─────────────┬──────────────┐
│ Test        │ Events/sec      │ Avg Latency │ % of Baseline│
├─────────────┼─────────────────┼─────────────┼──────────────┤
│ Edera       │     762.25      │   2.62 ms   │  98.4%       │
│ Baseline    │     774.13      │   2.58 ms   │ 100.0%       │
└─────────────┴─────────────────┴─────────────┴──────────────┘
```

### Run sysbench individually  
**Edera:**

```bash
make sysbench
```

**Baseline:**

```bash
make sysbench-baseline
```

**Success criteria:**  
Compare your Edera events/sec against baseline. CPU performance should be very close to baseline as this is a pure compute workload with minimal virtualization overhead.

**Cleanup:**

```bash
kubectl delete job sysbench-edera sysbench-baseline
```

## Test 3: Establish performance baselines

Document your specific environment’s performance characteristics for future reference.

### Create a performance report  
Run the benchmarks and record results:

```bash
# Create results directory
mkdir -p pov-results

# Run iperf tests (JSON output)
POD_IP=$(kubectl get pod iperf-edera -o jsonpath='{.status.podIP}')
kubectl exec iperf-edera -c iperf-client -- iperf3 -c $POD_IP -t 30 -J > pov-results/iperf-edera.json
kubectl exec iperf-baseline -c iperf-client -- iperf3 -c localhost -t 30 -J > pov-results/iperf-baseline.json

# Run sysbench comparison
make sysbench-compare > pov-results/sysbench-results.txt
```

### Performance validation checklist  
- [ ]  Network throughput comparable to baseline
- [ ]  CPU performance comparable to baseline

## Summary  
| Test | What it measures | Success criteria |
| --- | --- | --- |
| iperf | Network throughput (intra-zone) | Comparable to baseline |
| sysbench | CPU performance (compute) | Comparable to baseline |
| Baseline documentation | Environment-specific metrics | Results recorded |

## Cleanup  
Remove all performance test resources:

```bash
make clean-performance
```

## Next steps  
- [Operations integration suite](https://docs.edera.dev/guides/validate/operations/) - Verify observability and automation
- [Security demonstration suite](https://docs.edera.dev/guides/validate/security/) - Validate container isolation
