Rate Limiting
This tutorial walks you through setting up rate limiting for a service in Kong Manager.
If you prefer to use the Admin API, check out the Kong Gateway getting started guide.
Prerequisites
You need a Kong Gateway instance with Kong Manager enabled.
Set up the Rate Limiting plugin
On the Workspaces tab in Kong Manager:
- Open the default workspace.
- From the menu, open Plugins, then click Install Plugin.
- Find the Rate Limiting plugin, then click Enable.
Apply the plugin as Global, which means the rate limiting applies to all requests, including every service and route in the workspace.
If you switched it to Scoped, the rate limiting would apply the plugin to only one service, route, or consumer.
By default, the plugin is automatically enabled when the form is submitted. You can also toggle the This plugin is Enabled button to configure the plugin without enabling it. For this example, keep the plugin enabled.
Complete only the following fields with the following parameters.
- config.limit:
5
- config.sync_rate:
-1
- config.window_size:
30
Besides the above fields, there may be others populated with default values. For this example, leave the rest of the fields as they are.
- config.limit:
Click Install.
Validate rate limiting
Enter
https://localhost:8000/mock
in your browser address bar, then refresh your browser six times. After the 6th request, you’ll receive an error message.Wait at least 30 seconds and try again. The service will be accessible until the sixth (6th) access attempt within a 30-second window.
Next, head on to learn about proxy caching.