istio.io/_docs/tasks/rate-limiting.md

1.7 KiB

category title overview order bodyclass layout type
Tasks Rate Limiting This task shows you how to use Istio to dynamically limit the traffic to a service. 40 docs docs markdown

This task shows you how to use Istio to dynamically limit the traffic to a service.

Before you begin

  • Setup Istio by following the instructions in the Installation guide.

  • Deploy the bookinfo sample application.

  • Initialize the application version routing by either first doing the request routing task or by running following commands:

    $ istioctl create -f route-rule-all-v1.yaml
    $ istioctl replace -f route-rule-reviews-v3.yaml
    

Rate Limiting [WIP]

We will pretend that ratings is an external service for which we are paying (like going to rotten tomatoes), so we will set a rate limit on the service such that the load remains under the Free quota (5q/s).

  1. Configure mixer with the rate limit:

    # (TODO) istioctl create -f mixer-rule-ratings-ratelimit.yaml
    kubectl apply -f ../../mixer-config-quota-bookinfo.yaml
    
  2. Generate load on the productpage with the following command:

    while true; do curl -s -o /dev/null http://$GATEWAY_URL/productpage; done
    

    If you now refresh the productpage (http://$GATEWAY_URL/productpage) you'll see that while the load generator is running (i.e., generating more than 5 req/s), we stop seeing stars.

Understanding ...

Here's an interesting thing to know about the steps you just did.

What's next