Benchmarks

    I used 4 VMs for the tests with the following configuration:

    • 32 GB RAM
    • 8 CPU Cores
    • 10 GB SSD
    • Ubuntu 14.04 LTS 64-bit
    • One VM used to launch the benchmarking tool wrk
    • One VM for traefik (v1.0.0-beta.416) / nginx (v1.4.6)
    • Two VMs for 2 backend servers in go
      Each VM has been tuned using the following limits:
    1. user www-data;
    2. worker_processes auto;
    3. worker_rlimit_nofile 200000;
    4. pid /var/run/nginx.pid;
    5. events {
    6. worker_connections 10000;
    7. use epoll;
    8. multi_accept on;
    9. }
    10. http {
    11. sendfile on;
    12. tcp_nopush on;
    13. keepalive_timeout 300;
    14. keepalive_requests 10000;
    15. types_hash_max_size 2048;
    16. open_file_cache max=200000 inactive=300s;
    17. open_file_cache_valid 300s;
    18. open_file_cache_min_uses 2;
    19. open_file_cache_errors on;
    20. server_tokens off;
    21. include /etc/nginx/mime.types;
    22. default_type application/octet-stream;
    23. access_log /var/log/nginx/access.log combined;
    24. error_log /var/log/nginx/error.log warn;
    25. gzip off;
    26. gzip_vary off;
    27. include /etc/nginx/conf.d/*.conf;
    28. include /etc/nginx/sites-enabled/*.conf;
    29. }

    Here is the Nginx vhost file used:

    1. MaxIdleConnsPerHost = 100000
    2. defaultEntryPoints = ["http"]
    3. [entryPoints]
    4. [entryPoints.http]
    5. address = ":8000"
    6. [file]
    7. [backends]
    8. [backends.backend1]
    9. [backends.backend1.servers.server1]
    10. weight = 1
    11. [backends.backend1.servers.server2]
    12. url = "http://IP-whoami2:80"
    13. weight = 1
    14. [frontends]
    15. [frontends.frontend1]
    16. backend = "backend1"
    17. [frontends.frontend1.routes.test_1]
    18. rule = "Host: test.traefik"
    1. wrk -t20 -c1000 -d60s -H "Host: test.traefik" --latency http://IP-nginx:8001/bench
    2. Running 1m test @ http://IP-nginx:8001/bench
    3. 20 threads and 1000 connections
    4. Thread Stats Avg Stdev Max +/- Stdev
    5. Latency 101.25ms 180.09ms 1.99s 89.34%
    6. Req/Sec 1.69k 567.69 9.39k 72.62%
    7. Latency Distribution
    8. 50% 15.46ms
    9. 75% 129.11ms
    10. 90% 302.44ms
    11. 99% 846.59ms
    12. 2018427 requests in 1.00m, 298.36MB read
    13. Socket errors: connect 0, read 0, write 0, timeout 90
    14. Requests/sec: 33591.67
    15. Transfer/sec: 4.97MB

    Traefik is obviously slower than Nginx, but not so much: Traefik can serve 28392 requests/sec and Nginx 33591 requests/sec which gives a ratio of 85%. Not bad for young project :) !

    • Run a separate server instance per CPU core with (it appears during benchmarks that there is a lot more context switches with traefik than with nginx)