Skip to content

Latest commit

 

History

History
72 lines (49 loc) · 1.44 KB

README.md

File metadata and controls

72 lines (49 loc) · 1.44 KB

throttling-test

Table of Contents
  1. Prerequisites
  2. Requirements
  3. Payload
  4. Run Locally
  5. Run on Kubernetes
  6. Expected Response

prerequisites

  1. Docker

  2. Kubectl

  3. Go 1.16

requirements

 ❯ maximum of 2 request per second and regardless of the x-secret-key

 ❯ maximum of 10 request per minute and per x-secret-key

payload

curl -X POST \
    http://localhost:8080/ping \
    -H 'content-type: application/json' \
    -H 'x-secret-key: ahs98h' \
    -d '{"request":"ping"}'

run locally

❯ go mod init github.com/fabmorais/throttling-test

❯ go mod tidy -v

❯ go run main.go

run on kubernetes

❯ docker build -t ping-pong-app:latest .

❯ kubectl apply -f kube/deployment.yaml

❯ kubectl apply -f kube/service.yaml

expected response


(not throttled):
 ❯ {"response":"pong"}

(throttled)
 ❯ {"message":"request throttled request","throttle_age":"10"}