skip
docker build -t ratelimit:01 .
docker run -idt -p 3000:3000 --link ${your_redis_host}:redis.orb.local ratelimit:01
docker run -idt -p 3001:3000 --link ${your_redis_host}:redis.orb.local ratelimit:01
docker run -idt -p 3002:3000 --link ${your_redis_host}:redis.orb.local ratelimit:01
docker run -idt -p 3003:3000 --link ${your_redis_host}:redis.orb.local ratelimit:01
docker run -idt -p 3004:3000 --link ${your_redis_host}:redis.orb.local ratelimit:01
skip
pip3 install locust
confirm you nginx.conf path
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#tcp_nopush on;
keepalive_timeout 65;
upstream backend {
server localhost:3000 weight=1;
server localhost:3001 weight=1;
server localhost:3002 weight=1;
server localhost:3003 weight=1;
}
server {
listen 8080;
server_name localhost;
location / {
proxy_pass http://backend;
}
}
}
nginx
curl http://127.0.0.1:8080/test1 curl http://127.0.0.1:8080/test2
python3 -m locust -f benchMark.py
if you want to test more user,pls modify benchMark.py line 4 the number
http://0.0.0.0:8089
I can see a successful wave of requests every five minutes, while the rest of the requests are being blocked due to exceeding the rate limiter.