Manage quotas in Aiven for Apache Kafka®
Manage quotas in your Aiven for Apache Kafka® service to control network throughput and CPU usage per client.
Prerequisites
- An Aiven for Apache Kafka® service.
- Access to the Aiven Console or an authenticated Aiven CLI.
- A personal access token for API requests.
Add quota
- Aiven Console
- Aiven CLI
- Aiven API
-
Log in to Aiven Console and select your Kafka service.
-
Click Quotas in the sidebar.
-
Click Add quota.
-
Enter the Client ID or User.
-
Set one or more quota values:
- Consumer throttle: Maximum data rate for consumers, in bytes per second.
- Producer throttle: Maximum data rate for producers, in bytes per second.
- CPU throttle: Maximum CPU usage for the client, as a percentage.
noteEnter
defaultto apply the quota to all clients or users. -
Click Add.
Use avn service quota create with at least one of
--client-id or --user, and at least one quota parameter.
Example: Set a 1 MiB/s producer and consumer throttle for user alice:
avn service quota create kafka-doc \
--user alice \
--consumer-byte-rate 1048576 \
--producer-byte-rate 1048576
Example: Set a default quota for all users:
avn service quota create kafka-doc \
--user default \
--consumer-byte-rate 5242880
Send a request to the ServiceKafkaQuotaCreate endpoint:
curl -X POST https://api.aiven.io/v1/project/PROJECT_NAME/service/SERVICE_NAME/quota \
-H "Authorization: Bearer $AIVEN_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"user": "alice",
"consumer_byte_rate": 1048576,
"producer_byte_rate": 1048576
}'
Replace PROJECT_NAME and SERVICE_NAME with your Aiven project name and Kafka service
name.
View quotas
- Aiven Console
- Aiven CLI
- Aiven API
- Access the Aiven Console and open your Aiven for Apache Kafka® service.
- Click Quotas.
The page lists all configured quotas.
avn service quota list kafka-doc
Send a request to the ServiceKafkaQuotaList endpoint:
curl https://api.aiven.io/v1/project/PROJECT_NAME/service/SERVICE_NAME/quota \
-H "Authorization: Bearer $AIVEN_TOKEN"
Replace PROJECT_NAME and SERVICE_NAME with your Aiven project name and Kafka service
name.
Update quota
- Aiven Console
- Aiven CLI
- Aiven API
- Access the Aiven Console and open your Aiven for Apache Kafka® service.
- Click Quotas.
- Find the quota to update.
- Click Actions > Update.
- Update the quota values.
- Click Save changes.
Run avn service quota create again with the same --user or --client-id to overwrite
existing values:
avn service quota create kafka-doc \
--user alice \
--consumer-byte-rate 2097152
Send another request to the ServiceKafkaQuotaCreate endpoint with the updated values to overwrite the existing quota.
Delete quota
- Aiven Console
- Aiven CLI
- Aiven API
- Access the Aiven Console and open your Aiven for Apache Kafka® service.
- Click Quotas.
- Find the quota to delete.
- Click Actions > Delete.
- Click Delete quota to confirm.
avn service quota delete kafka-doc --user alice
Send a request to the ServiceKafkaQuotaDelete endpoint:
curl -X DELETE "https://api.aiven.io/v1/project/PROJECT_NAME/service/SERVICE_NAME/quota?user=alice" \
-H "Authorization: Bearer $AIVEN_TOKEN"
Replace PROJECT_NAME and SERVICE_NAME with your Aiven project name and Kafka service
name.
Related pages