-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjust task_concurrency to number of physical cores
Logical (hyper threaded) cores do not improve query performance. Therefore task_concurrency needs to be adjusted to number of physical cores. AWS r5.8xlarge machines (intel, 16 physical cores with HT, 32 logical cores) label TPCH wall time TPC-DS wall time TPCH CPU time TPC-DS CPU time TPCH peak mem TPC-DS peak mem 0 concurrency_16_part 1097.604667 1346.841167 119453.0 156423.427667 2.165998e+09 1.282450e+09 1 concurrency_32_part 1056.615500 1370.033500 129010.1 164247.540000 2.164635e+09 1.310248e+09 2 concurrency_16_unpart 904.007167 2234.841000 112177.4 288472.953333 2.101063e+09 1.137481e+09 3 concurrency_32_unpart 907.333500 2300.626167 120640.0 302876.445500 2.119834e+09 1.186475e+09 AWS r5g.8xlarge machines (graviton, 32 physical cores) label TPCH wall time TPC-DS wall time TPCH CPU time TPC-DS CPU time TPCH peak mem TPC-DS peak mem 0 concurrency_16_part 1063.112833 1256.248833 113851.2 135454.912167 2.129303e+09 1.265366e+09 1 concurrency_32_part 980.932667 1258.293667 113708.1 136666.440167 2.144433e+09 1.276637e+09 2 concurrency_16_unpart 811.310000 1991.245667 98893.1 242522.966833 2.081300e+09 1.102874e+09 3 concurrency_32_unpart 757.619333 1953.809333 99628.9 242261.435167 2.098105e+09 1.150644e+09
- Loading branch information
Showing
5 changed files
with
82 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
core/trino-main/src/main/java/io/trino/util/MachineInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.trino.util; | ||
|
||
import com.google.common.base.StandardSystemProperty; | ||
import oshi.SystemInfo; | ||
|
||
import static java.lang.Math.min; | ||
|
||
public final class MachineInfo | ||
{ | ||
// cache physical processor count, so that it's not queried multiple times during tests | ||
private static volatile int physicalProcessorCount = -1; | ||
|
||
private MachineInfo() {} | ||
|
||
public static int getAvailablePhysicalProcessorCount() | ||
{ | ||
if (physicalProcessorCount != -1) { | ||
return physicalProcessorCount; | ||
} | ||
|
||
String osArch = StandardSystemProperty.OS_ARCH.value(); | ||
// logical core count (including container cpu quota if there is any) | ||
int availableProcessorCount = Runtime.getRuntime().availableProcessors(); | ||
int totalPhysicalProcessorCount; | ||
if ("amd64".equals(osArch) || "x86_64".equals(osArch)) { | ||
// Oshi can recognize physical processor count (without hyper threading) for x86 platforms. | ||
// However, it doesn't correctly recognize physical processor count for ARM platforms. | ||
totalPhysicalProcessorCount = new SystemInfo() | ||
.getHardware() | ||
.getProcessor() | ||
.getPhysicalProcessorCount(); | ||
} | ||
else { | ||
// ARM platforms do not support hyper threading, therefore each logical processor is separate core | ||
totalPhysicalProcessorCount = availableProcessorCount; | ||
} | ||
|
||
// cap available processor count to container cpu quota (if there is any). | ||
physicalProcessorCount = min(totalPhysicalProcessorCount, availableProcessorCount); | ||
return physicalProcessorCount; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters