このページは、まだ日本語ではご利用いただけません。翻訳中です。
旧バージョンのドキュメントを参照しています。 最新のドキュメントはこちらをご参照ください。
Create Consumer Groups in Kong Manager
With consumer groups, you can define any number of rate limiting tiers and apply them to subsets of consumers, instead of managing each consumer individually.
For example, you could define three consumer groups:
- A “gold tier” with 1000 requests per minute
- A “silver tier” with 10 requests per second
- A “bronze tier” with 6 requests per 30 seconds
The consumer_groups
endpoint works together with a limited set of plugins.
See the scopes compatibility table for details.
Consumers that are not in a consumer group default to the Rate Limiting advanced plugin’s configuration, so you can define tier groups for some users and have a default behavior for consumers without groups.
To use consumer groups for rate limiting, you need to:
- Create one or more consumer groups
- Create consumers
- Assign consumers to groups
- Configure the Rate Limiting Advanced plugin globally with the
enforce_consumer_groups
andconsumer_groups
parameters, setting up the list of consumer groups that the plugin accepts - Configure a rate limiting policy for each consumer group, overriding the plugin’s global configuration
For all possible requests, see the Consumer Groups reference.
Set up a consumer group with consumers
In this section, you will create the Bronze tier consumer group with a consumer assigned to the group.
- Open the default workspace.
- From the menu, open Consumers, then click the Groups tab.
- Click New Consumer Groups.
- Enter
Bronze
for the consumer group name and click Create. - From the menu, click Consumers, then click New Consumer.
- Enter a Username and Custom ID. For this example, you can use
Amal
for each field. - Click Create.
- From the menu, click the Groups tab.
- Click the
Bronze
consumer group you just created. - Click Consumers and Add consumers to add the
Amal
consumer you created to theBronze
consumer group.
Configure the Rate Limiting Advanced plugin for all consumers
In this section, you will configure the Rate Limiting Advanced plugin to set the rate limit to 5 requests every 30 seconds for all consumers.
- 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.window_size:
30
- config.window_type:
sliding
- config.retry_after_jitter_max:
0
- config.enforce_consumer_groups:
true
- config.consumer_groups:
Bronze
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.
Configure rate limiting for consumer groups
In this section, you will configure the Rate Limiting Advanced plugin to set the rate limit to 6 requests every 30 seconds only for consumers in the Bronze tier.
- Open the default workspace.
- From the menu, open Consumers, then click the Groups tab.
- Click the
Bronze
consumer group you just created. - Click the Policy tab.
- Complete only the following fields with the following parameters.
- config.limit:
6
- config.window_size:
30
- config.window_type:
sliding
- config.retry_after_jitter_max:
0
- config.limit:
- Click Save.