An open API service indexing awesome lists of open source software.

https://github.com/jkaninda/goma-gateway-vs-traefik

Performance Benchmark: Goma Gateway vs Traefik
https://github.com/jkaninda/goma-gateway-vs-traefik

Last synced: 3 months ago
JSON representation

Performance Benchmark: Goma Gateway vs Traefik

Awesome Lists containing this project

README

          

# ๐Ÿš€ Performance Benchmark: Traefik vs Goma Gateway

This benchmark compares **Traefik** and **Goma Gateway** under identical load conditions using [`wrk`](https://github.com/wg/wrk), a modern HTTP benchmarking tool.

```bash
wrk -t8 -c500 -d60s http://localhost/api/books
```

> **Test environment:** 8 threads, 500 concurrent connections, 60 seconds duration

---

## ๐Ÿ“Š Summary

| **Metric** | **Traefik** | **Goma Gateway** |
| ----------------------- | ------------ | ---------------- |
| **Requests/sec** | ๐ŸŸข 29,278.35 | 23,108.16 |
| **Avg Latency** | 81.58 ms | ๐ŸŸข **71.92 ms** |
| **Latency StdDev** | 143.85 ms | ๐ŸŸข **120.47 ms** |
| **Max Latency** | ๐ŸŸข 1.54 s | 1.82 s |
| **Total Requests** | ๐ŸŸข 1,757,995 | 1,388,634 |
| **Timeouts** | 74 | ๐ŸŸข **18** |
| **Transfer/sec** | 6.42 MB | ๐ŸŸข **6.81 MB** |
| **Memory (Idle)** | \~76 MB | ๐ŸŸข **\~5 MB** |
| **Memory (Under Load)** | \~250 MB | ๐ŸŸข **\~50 MB** |

---

## ๐Ÿง  Analysis

### โœ… Traefik Highlights

* High throughput: \~29K RPS and \~1.75M total requests.

### โœ… Goma Gateway Highlights

* 12% lower average latency and more consistent performance.
* 76% fewer timeouts under the same load.
* 5x smaller memory footprint
* Higher per-request transfer efficiency.

---

## โš™๏ธ Throughput vs Stability

| Feature | Traefik | Goma Gateway |
| ------------- | ------------- | ------------------ |
| ๐Ÿšฆ Throughput | ๐ŸŸข High | Moderate |
| โฑ๏ธ Latency | Moderate | ๐ŸŸข Lower |
| ๐Ÿ“‰ Stability | Higher jitter | ๐ŸŸข More consistent |
| โ›” Timeouts | Higher | ๐ŸŸข Fewer |
| ๐Ÿง  Memory | 76โ€“250 MB | ๐ŸŸข 5โ€“50 MB |

## Screenshot

![Test Screenshot](https://raw.githubusercontent.com/jkaninda/goma-gateway-vs-traefik/main/screenshot.png)

---

## ๐Ÿงช Reproducing the Test

### โœ… Requirements

* Docker

### ๐Ÿ› ๏ธ Setup: `docker-compose`

Create a file named `compose.yaml`:

```yaml
services:
okapi-example:
image: jkaninda/okapi-example
container_name: okapi-example
labels:
- traefik.enable=true
- traefik.http.routers.okapi-example.rule=Host(`okapi-example.jkaninda.dev`) || Host(`localhost`)
- traefik.http.routers.okapi-example.entrypoints=web
- traefik.http.services.okapi-example.loadbalancer.server.port=8080
restart: always
ports:
- 8080:8080
networks:
- default

gateway:
image: jkaninda/goma-gateway:0.3.3
container_name: gateway
command: server
restart: always
volumes:
- ./goma.yml:/etc/goma/goma.yml:ro
ports:
- 80:80
- 443:443
networks:
- default

traefik:
image: traefik:v3.3.4
container_name: traefik
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./traefik.yml:/traefik.yml:ro
ports:
- 80:80
- 443:443
networks:
- default
```

---

### ๐Ÿ”ง Configuration Files

#### `goma.yml` (Goma Gateway)

```yaml
gateway:
log:
level: error
entryPoints:
web:
address: ":80"
webSecure:
address: ":443"
networking:
transport:
insecureSkipVerify: true
routes:
- name: okapi-example
path: /
hosts:
- localhost
target: http://okapi-example:8080
```

#### `traefik.yml` (Traefik)

```yaml
log:
level: ERROR

providers:
docker:
exposedByDefault: false

api:
dashboard: true # Disable if not needed
insecure: true
entryPoints:
web:
address: ":80"
websecure:
address: ":443"

serversTransport:
insecureSkipVerify: true
```

---

## ๐Ÿšฆ Running the Tests

### ๐ŸŸข Goma Gateway

Start the gateway and backend:

```sh
docker compose up -d gateway okapi-example
```

Check readiness:

```sh
curl http://localhost/api/books
```

Run the performance test:

```sh
echo "GOMA GATEWAY"
wrk -t8 -c500 -d60s http://localhost/api/books
```

---

### ๐Ÿ” Switch to Traefik

Stop Goma Gateway:

```sh
docker stop gateway okapi-example && docker rm gateway okapi-example
```

Start Traefik and backend:

```sh
docker compose up -d traefik okapi-example --force-recreate
```

Check readiness:

```sh
curl http://localhost/api/books
```

Run the test:

```sh
echo "TRAEFIK"
wrk -t8 -c500 -d60s http://localhost/api/books
```

> ๐Ÿ’ก You can substitute `okapi-example` with any backend to run your own tests.

### Clean

```sh
docker compose down
```
---

## ๐Ÿ”— Useful Links

* ๐Ÿ”ง **Goma Gateway**: [github.com/jkaninda/goma-gateway](https://github.com/jkaninda/goma-gateway)
* ๐Ÿ“š **Okapi Example**: [github.com/jkaninda/okapi-example](https://github.com/jkaninda/okapi-example)