prestodb / presto

The official home of the Presto distributed SQL query engine for big data
http://prestodb.io
Apache License 2.0
16.06k stars 5.38k forks source link

[Design] Realize Presto cpu control ability based on real-time penalty mechanism #16547

Open shenh062326 opened 3 years ago

shenh062326 commented 3 years ago

Presto will monitor the cpu used during SQL running. Its principle is to add the group's totalCpuTime to the group's cpuUsageMillis when the query ends. On the other hand, in Coordinator, every group will generate cpuQuota every once in a while, and the cpuUsageMillis maintained in the corresponding group will subtract the corresponding cpuQuota. When the group's cpuUsageMillis is greater than softCpuLimitMillis, the number of queries that can be executed will be reduced; when cpuUsageMillis is greater than hardCpuLimitMillis, the group's new queries will not be executed.

It has two problems

In response to these problems, we designed a new real-time cpu usage based on query, which limits both the query being executed and the new query. It has been running stably in our production environment for a year, and it can effectively limit the use of a large number of cpu by a small number of users. We hope to contribute this feature to the community.

Here is the design docs: https://docs.google.com/document/d/1sCJDpLaVPeTpNvnRkloIudGm0hDn_1ArRWYTa3fDEHw/edit?usp=sharing

hackeryang commented 1 year ago

Hello, is there any update about this feature? If you can contribute the source codes to the community, many users and companies will benefit from this.