Skip to content

Instantly share code, notes, and snippets.

@sampaiodiego
Last active August 29, 2016 16:18
Show Gist options
  • Save sampaiodiego/7cd149063cdfa781486fcd257bb0b3f3 to your computer and use it in GitHub Desktop.
Save sampaiodiego/7cd149063cdfa781486fcd257bb0b3f3 to your computer and use it in GitHub Desktop.
reverse proxies test
---
version: '2'
services:
traefik:
image: traefik
command: --web --docker --docker.domain=docker.localhost
ports:
- "7000:80"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /dev/null:/traefik.toml
whoami1:
image: emilevauge/whoami
labels:
- "traefik.backend=whoami"
- "traefik.frontend.rule=Host:whoami.docker.localhost"
whoami2:
image: emilevauge/whoami
labels:
- "traefik.backend=whoami"
- "traefik.frontend.rule=Host:whoami.docker.localhost"
nginx:
image: nginx
ports:
- "8000:80"
volumes:
- /root/nginx-sites:/etc/nginx/conf.d
redis:
image: 'redis:latest'
volumes:
- /data/redis:/data
environment:
- REDIS_DIR=/data
- REDIS_PASS=redispass
hipache:
image: rocketchat/hipache:latest
ports:
- "9000:80"
depends_on:
- redis
environment:
- 'HIPACHE_CONFIG={"http": {"bind": ["0.0.0.0"]}, "driver": "redis://:redispass@REDIS/0", "server": {"workers": 30, "maxSockets": 2000, "tcpTimeout": 60 } }'
upstream whoami {
server whoami1:80;
server whoami2:80;
keepalive 300;
}
server {
server_name test.traefik;
access_log off;
error_log /dev/null crit;
if ($host != "test.traefik") {
return 404;
}
location / {
proxy_pass http://whoami;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header X-Forwarded-Host $host;
}
}
lpush frontend:test.hipache http://whoami1:80 http://whoami2:80 test.hipache
# wrk -t20 -c1000 -d60s --latency -H "Host: whoami.docker.localhost" http://45.55.250.94:7000
# wrk -t20 -c1000 -d60s --latency -H "Host: test.traefik" http://45.55.250.94:8000
# wrk -t20 -c1000 -d60s --latency -H "Host: test.hipache" http://45.55.250.94:9000
root@ubuntu-1gb-nyc3-01:~# wrk -t20 -c1000 -d60s -H "Host: test.traefik" --latency http://45.55.250.94:8000
Running 1m test @ http://45.55.250.94:8000
20 threads and 1000 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 84.57ms 78.72ms 1.41s 84.54%
Req/Sec 251.36 248.09 1.28k 85.47%
Latency Distribution
50% 67.31ms
75% 107.21ms
90% 166.59ms
99% 376.45ms
270080 requests in 1.00m, 88.85MB read
Socket errors: connect 0, read 394, write 0, timeout 12
Requests/sec: 4494.03
Transfer/sec: 1.48MB
root@ubuntu-1gb-nyc3-01:~# wrk -t20 -c1000 -d60s -H "Host: whoami.docker.localhost" --latency http://45.55.250.94:7000
Running 1m test @ http://45.55.250.94:7000
20 threads and 1000 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 371.75ms 160.28ms 1.73s 74.06%
Req/Sec 135.67 72.09 444.00 66.39%
Latency Distribution
50% 348.85ms
75% 443.50ms
90% 568.86ms
99% 919.58ms
77332 requests in 1.00m, 32.45MB read
Requests/sec: 1286.79
Transfer/sec: 552.92KB
root@ubuntu-1gb-nyc3-01:~# wrk -t20 -c1000 -d60s -H "Host: test.hipache" --latency http://45.55.250.94:9000
Running 1m test @ http://45.55.250.94:9000
20 threads and 1000 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 907.96ms 312.27ms 2.00s 71.53%
Req/Sec 52.56 25.47 181.00 67.00%
Latency Distribution
50% 891.91ms
75% 1.10s
90% 1.30s
99% 1.75s
58545 requests in 1.00m, 26.02MB read
Socket errors: connect 0, read 0, write 0, timeout 888
Requests/sec: 974.73
Transfer/sec: 443.69KB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment