sebastianlutter / traefik_ratelimit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Traefik rate limit example

This is a test for the traefik rate limiter functionality like described here:

Using the docker labels like described here:

Benchmarks are done with apache benchmark: (part of apache2-utils)

Testing the rate limit

  • add foo.bar as domain to /etc/hosts
127.0.0.1 foo.bar
  • start stack with deploy.sh
./deploy.sh
  • benchmark with rate limit from traefik
ab -c1 -n500 -l http://foo.bar/
  • benchmark nginx directly
ab -c1 -n500 -l http://foo.bar:7080/
  • inspect service labels of webservice service
docker service inspect gateway_webservice
  • inspect container labels of webservice tasks
docker inspect $(docker ps |grep hello|cut -d" " -f1)

Discussion about this can be found here:

The right way to use the rateLimit for docker stack services is to use them as deploy labels in the affected services and replacing by some arbitrary name. You can stack multiple rateLimits for an service by using multiple names.

About


Languages

Language:Shell 100.0%