Configuring Kafka Quotas
Kafka quotas can be configured for users, clients, or topics to limit the message production or consumption rate.
Rate limits for users and clients work on the entire broker, while topic rate limits work on a specific topic.
- This function is supported for instances created on or after November 10, 2022.
- This function is unavailable for single-node instances.
Operation Impact
- When the quota is reached, production/consumption latency increases.
- If the quota is small and the production rate is high, production may time out and messages may be lost. As a result, some messages fail to be produced.
- If the initial production/consumption traffic is heavy, and a small quota is set, the production/consumption latency increases and some messages fail to be produced. To ensure stable production and consumption, you are advised to first set the quota to half the traffic, and then half the quota each time you set it until the target quota is reached. For example, if the initial production traffic is 100 MB/s, you can set the production limit to 50 MB/s first. After production becomes stable, change the production limit to 25 MB/s until the target limit is reached.
Prerequisites
- To configure user quotas, enable ciphertext access on the Kafka details page and then obtain the username on the Users page on the console.
- To control client traffic, obtain the client ID from the client configuration.
- To control topic traffic, obtain the topic name from the Topics page.
Creating a User or Client Quota
- Log in to the console.
- Click in the upper left corner to select a region.
Select the region where your Kafka instance is located.
- Click and choose Middleware > Distributed Message Service (for Kafka) to open the console of DMS for Kafka.
- Click the desired Kafka instance to view the instance details.
- In the navigation pane, choose Kafka Quotas > Quotas.
- Click the User/Client tab.
- In the upper left, click Create Quota. The Create Quota slide panel is displayed.
- Set quota parameters.
Table 1 Quota parameters Parameter
Description
Username
Enter the name obtained in Prerequisites. To apply the quota to all users, click Use Default next to Username.
After the quota is created, the username cannot be changed.
Client ID
Enter the client ID obtained in Prerequisites. To apply the quota to all clients, click Use Default next to Client ID.
After the quota is created, the client ID cannot be changed.
Production Limit
Set an upper limit on the production rate. The unit is MB/s. If this parameter is left blank, no limit is set.
Consumption Limit
Set an upper limit on the consumption rate. The unit is MB/s. If this parameter is left blank, no limit is set.
- Username is not displayed in the Create Quota dialog box for instances with ciphertext access disabled.
- Username and Client ID cannot be both empty.
- Production Limit and Consumption Limit cannot be both empty.
- Click OK. The Background Tasks page is displayed. If the status of the quota creation task is Successful, the quota has been created.
Go to the Kafka Quotas > Quotas page. On the User/Client tab page, select User quotas, Client quotas, or User and client quotas, then press Enter to view the created quota.
Figure 1 Viewing the new quota
Creating a Topic Quota
- Log in to the console.
- Click in the upper left corner to select a region.
Select the region where your Kafka instance is located.
- Click and choose Middleware > Distributed Message Service (for Kafka) to open the console of DMS for Kafka.
- Click the desired Kafka instance to view the instance details.
- In the navigation pane, choose Kafka Quotas > Quotas.
- Click the Topic tab.
- In the upper left, click Create Quota. The Create Quota slide panel is displayed.
- Set quota parameters.
Table 2 Quota parameters Parameter
Description
Topic Name
Enter the name of the topic to apply the quota to.
After the quota is created, the topic cannot be changed.
Production Limit
Set an upper limit on the production rate. The unit is MB/s. If this parameter is left blank, no limit is set.
Consumption Limit
Set an upper limit on the consumption rate. The unit is MB/s. If this parameter is left blank, no limit is set.
Production Limit and Consumption Limit cannot be both empty.
- Click OK. The Background Tasks page is displayed. If the status of the quota creation task is Successful, the quota has been created.
Go to the Kafka Quotas > Quotas page. On the Topic tab page, enter the name of the new quota in the upper left corner, then press Enter to view the created quota.
Modifying a Quota
- Log in to the console.
- Click in the upper left corner to select a region.
Select the region where your Kafka instance is located.
- Click and choose Middleware > Distributed Message Service (for Kafka) to open the console of DMS for Kafka.
- Click the desired Kafka instance to view the instance details.
- In the navigation pane, choose Kafka Quotas > Quotas.
- In the row containing the desired quota, click Edit.
- Change the production limit or consumption limit, and click OK. The Background Tasks page is displayed. If the status of the quota modification task is Successful, the quota has been modified.
Choose Kafka Quotas > Quotas and view the new production or consumption rate limit.
Production Limit and Consumption Limit cannot be both empty.
Exporting Quotas
- Log in to the console.
- Click in the upper left corner to select a region.
Select the region where your Kafka instance is located.
- Click and choose Middleware > Distributed Message Service (for Kafka) to open the console of DMS for Kafka.
- Click the desired Kafka instance to view the instance details.
- In the navigation pane, choose Kafka Quotas > Quotas.
- Export quotas.
- For specified user/client quotas: On the User/Client tab page, select desired user/client quotas and choose Export > Export selected data to an XLSX file.
- For all user/client quotas: On the User/Client tab page, choose Export > Export all data to an XLSX file.
- For specified topic quotas: On the Topic tab page, select desired topic quotas and choose Export > Export selected data to an XLSX file.
- For all topic quotas: On the Topic tab page, choose Export > Export all data to an XLSX file.
Deleting a Quota
- Log in to the console.
- Click in the upper left corner to select a region.
Select the region where your Kafka instance is located.
- Click and choose Middleware > Distributed Message Service (for Kafka) to open the console of DMS for Kafka.
- Click the desired Kafka instance to view the instance details.
- In the navigation pane, choose Kafka Quotas > Quotas.
- In the row containing the desired quota, click Delete.
- Click OK. The Background Tasks page is displayed. If the status of the quota deletion task is Successful, the quota has been deleted.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot