Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bottleneck in InternalResourceGroup::internalGenerateCpuQuota
internalGenerateCpuQuota() is called from InternalResourceGroupManager::refreshAndStartQueries(), which is called every millisecond to start queries. Under a high query submission rate internalGenerateCpuQuota() becomes a bottleneck when Math.multiplyExact() throws an exception (which is possible with the default value of cpuQuotaGenerationMillisPerSecond) while holding the monitor of the root resource group. Plenty of methods in the query starting path grabs the monitor of the root resource group, and since internalGenerateCpuQuota() locks the root for extended amount of time (due to filling in the stack traces when exceptions are thrown) the rate at which the coordinator starts queries drops significantly. This change fixes that by using the guava math methods, which don't throw exceptions on overflow. In a performance test before the fix, given a config that allows 200 concurrent queries the coordinator was only able to run < 50 queries in the cluster. After this fix it was able to saturate the entire cluster.
- Loading branch information