incubator-pegasus icon indicating copy to clipboard operation
incubator-pegasus copied to clipboard

Feature enhancement: throttling by the count of kvs

Open ZhongChaoqiang opened this issue 3 years ago • 3 comments

Now, write request can be throttled by qps or size, read request can be throttled by qps. But there are some weaknesses of qps or size:

  • If throttling by qps,one request may contain different size of data, it's hard to control the pressure.
  • If throttling by size, it's difficult for users to calculate the required quota, and it can't be used for read request.

Therefore,we added a new throttling based on the count of kvs.In some scenarios, it may be better than the current way. Advantage as below:

  • More accurate control
  • More intuitive to users
  • Both read and write requests can be used

Implementation principle: In message_ header#msg_context, add a new variable kv_count, which is used to record how many kvs are included in the request.The server will perform throttling according to the value of kv_count.

But for some requests, such as multiget by range, scan, etc, may not be supported very good.Because it is difficult to calculate the real count of kvs on the client side.In this case, I think we can perform throttling in pegasus instead of rdsn. For scan, maybe we can set kv_count by batch_size of scan.(not implemented yet)

ZhongChaoqiang avatar Jul 30 '21 09:07 ZhongChaoqiang

  • If throttling by qps,one request may contain different size of data, it's hard to control the pressure.
  • If throttling by size, it's difficult for users to calculate the required quota, and it can't be used for read request.
  • throttling by qps and throttling by size can be set at the same time
  • the suggestion seem don't resolve the read size throttling

The server will perform throttling according to the value of kv_count

The qps throttling is for RPC, but not record count. if the total size is permissible(for example, size is small, but the count is large), we should allow it, it's also say we don't care the kv count in this case. or if you want limit large kv_count, we support the feature in java client, which limit the count <= 1000

So I think you can set throttling by qps and throttling by size at same time to resolve your problem

foreverneverer avatar Jul 30 '21 09:07 foreverneverer

  • If throttling by qps,one request may contain different size of data, it's hard to control the pressure.
  • If throttling by size, it's difficult for users to calculate the required quota, and it can't be used for read request.
  • throttling by qps and throttling by size can be set at the same time
  • the suggestion seem don't resolve the read size throttling

The server will perform throttling according to the value of kv_count

The qps throttling is for RPC, but not record count. if the total size is permissible(for example, size is small, but the count is large), we should allow it, it's also say we don't care the kv count in this case. or if you want limit large kv_count, we support the feature in java client, which limit the count <= 1000

So I think you can set throttling by qps and throttling by size at same time to resolve your problem

Yes, that's how we wanted to use it before. But throttling by size can't be used for read request。

ZhongChaoqiang avatar Aug 02 '21 08:08 ZhongChaoqiang

read throttling by size still need some time. if has no other question, you can choose close the issue

foreverneverer avatar Aug 04 '21 08:08 foreverneverer