krakendを使ってみる
- スロットリングしてくれるAPI-Gateway
を試しに作ってみる
$ docker-compose up -d --build
$ bash -c 'while true; do curl -i http://localhost:3000/ip; sleep 1; done;'
gateway_1 | [GIN] 2020/04/07 - 17:39:00 | 200 | 4.394382ms | 172.20.0.1 | GET "/ip"
gateway_1 | [GIN] 2020/04/07 - 17:39:01 | 200 | 2.031756ms | 172.20.0.1 | GET "/ip"
gateway_1 | [GIN] 2020/04/07 - 17:39:02 | 200 | 2.227201ms | 172.20.0.1 | GET "/ip"
gateway_1 | [GIN] 2020/04/07 - 17:39:03 | 200 | 2.549927ms | 172.20.0.1 | GET "/ip"
gateway_1 | [GIN] 2020/04/07 - 17:39:04 | 200 | 2.807904ms | 172.20.0.1 | GET "/ip"
gateway_1 | [GIN] 2020/04/07 - 17:39:05 | 200 | 3.616728ms | 172.20.0.1 | GET "/ip"
gateway_1 | [GIN] 2020/04/07 - 17:39:06 | 200 | 3.215544ms | 172.20.0.1 | GET "/ip"
gateway_1 | [GIN] 2020/04/07 - 17:39:07 | 429 | 46.214µs | 172.20.0.1 | GET "/ip"
gateway_1 | [GIN] 2020/04/07 - 17:39:08 | 429 | 34.875µs | 172.20.0.1 | GET "/ip"
gateway_1 | [GIN] 2020/04/07 - 17:39:09 | 429 | 42.015µs | 172.20.0.1 | GET "/ip"
gateway_1 | [GIN] 2020/04/07 - 17:39:10 | 200 | 3.848074ms | 172.20.0.1 | GET "/ip"
gateway_1 | [GIN] 2020/04/07 - 17:39:11 | 429 | 84.642µs | 172.20.0.1 | GET "/ip"
gateway_1 | [GIN] 2020/04/07 - 17:39:12 | 429 | 41.041µs | 172.20.0.1 | GET "/ip"
gateway_1 | [GIN] 2020/04/07 - 17:39:13 | 429 | 36.941µs | 172.20.0.1 | GET "/ip"
gateway_1 | [GIN] 2020/04/07 - 17:39:14 | 429 | 38.935µs | 172.20.0.1 | GET "/ip"
gateway_1 | [GIN] 2020/04/07 - 17:39:15 | 200 | 5.53156ms | 172.20.0.1 | GET "/ip"
gateway_1 | [GIN] 2020/04/07 - 17:39:16 | 429 | 38.009µs | 172.20.0.1 | GET "/ip"
gateway_1 | [GIN] 2020/04/07 - 17:39:17 | 429 | 35.577µs | 172.20.0.1 | GET "/ip"
gateway_1 | [GIN] 2020/04/07 - 17:39:18 | 429 | 47.429µs | 172.20.0.1 | GET "/ip"