Skip to content

Commit e498215

Browse files
han-yan01facebook-github-bot
authored andcommitted
[Sapphire Velox] presto side SV & Prestissimo config reconciliation
Summary: Reconciles Sapphire-Velox and Prestissimo configurations by cleaning up `NativeExecutionSystemConfig.java`. Removes production-related configs (memory management, spill, shuffle, etc.) that are now defined in configerator's `native/config_properties.cinc`. Keeps only test-specific configs (system memory pushback, experimental spiller path, etc.) in the Java class. **Rationale**: Production configs belong in configerator for centralized configuration management. Java configs should only contain test-specific properties needed for local development and testing. # Release Notes ``` == NO RELEASE NOTE == ``` Differential Revision: D85779158
1 parent 12cd04c commit e498215

File tree

4 files changed

+55
-91
lines changed

4 files changed

+55
-91
lines changed

presto-spark-base/src/main/java/com/facebook/presto/spark/execution/nativeprocess/NativeExecutionProcess.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,9 @@ protected void updateWorkerMemoryProperties()
411411
DataSize offHeapMemoryBytes = DataSize.succinctDataSize(
412412
conf.getSizeAsBytes(NATIVE_PROCESS_MEMORY_SPARK_CONF_NAME), BYTE);
413413
DataSize currentSystemMemory = DataSize.valueOf(workerProperty.getSystemConfig().getAllProperties()
414-
.get(NativeExecutionSystemConfig.SYSTEM_MEMORY_GB) + GIGABYTE.getUnitString());
414+
.get("system-memory-gb") + GIGABYTE.getUnitString());
415415
DataSize currentQueryMemory = DataSize.valueOf(workerProperty.getSystemConfig().getAllProperties()
416-
.get(NativeExecutionSystemConfig.QUERY_MEMORY_GB) + GIGABYTE.getUnitString());
416+
.get("query-memory-gb") + GIGABYTE.getUnitString());
417417
if (offHeapMemoryBytes.toBytes() == 0
418418
|| currentSystemMemory.toBytes() == 0
419419
|| offHeapMemoryBytes.toBytes() < currentSystemMemory.toBytes()) {
@@ -440,13 +440,13 @@ protected void updateWorkerMemoryProperties()
440440
newQueryMemoryBytes);
441441

442442
workerProperty.getSystemConfig()
443-
.update(NativeExecutionSystemConfig.SYSTEM_MEMORY_GB,
443+
.update("system-memory-gb",
444444
String.valueOf((int) newSystemMemory.getValue(GIGABYTE)));
445445
workerProperty.getSystemConfig()
446-
.update(NativeExecutionSystemConfig.QUERY_MEMORY_GB,
446+
.update("query-memory-gb",
447447
String.valueOf((int) newQueryMemoryBytes.getValue(GIGABYTE)));
448448
workerProperty.getSystemConfig()
449-
.update(NativeExecutionSystemConfig.QUERY_MAX_MEMORY_PER_NODE,
449+
.update("query.max-memory-per-node",
450450
newQueryMemoryBytes.convertTo(GIGABYTE).toString());
451451
}
452452

presto-spark-base/src/main/java/com/facebook/presto/spark/execution/property/NativeExecutionSystemConfig.java

Lines changed: 20 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,18 @@ public class NativeExecutionSystemConfig
5454
public static final String CONNECTOR_NUM_IO_THREADS_HW_MULTIPLIER = "connector.num-io-threads-hw-multiplier";
5555
public static final String PRESTO_VERSION = "presto.version";
5656
public static final String SHUTDOWN_ONSET_SEC = "shutdown-onset-sec";
57-
public static final String SYSTEM_MEMORY_GB = "system-memory-gb";
58-
public static final String QUERY_MEMORY_GB = "query-memory-gb";
59-
public static final String QUERY_MAX_MEMORY_PER_NODE = "query.max-memory-per-node";
60-
public static final String USE_MMAP_ALLOCATOR = "use-mmap-allocator";
61-
public static final String MEMORY_ARBITRATOR_KIND = "memory-arbitrator-kind";
62-
public static final String SHARED_ARBITRATOR_RESERVED_CAPACITY = "shared-arbitrator.reserved-capacity";
63-
public static final String SHARED_ARBITRATOR_MEMORY_POOL_INITIAL_CAPACITY = "shared-arbitrator.memory-pool-initial-capacity";
64-
public static final String SHARED_ARBITRATOR_MAX_MEMORY_ARBITRATION_TIME = "shared-arbitrator.max-memory-arbitration-time";
57+
// System memory pushback configs - kept for testing purposes only
58+
// Production configs are in native/config_properties.cinc
59+
public static final String SYSTEM_MEM_PUSHBACK_ENABLED = "system-mem-pushback-enabled";
60+
public static final String SYSTEM_MEM_PUSHBACK_ABORT_ENABLED = "system-mem-pushback-abort-enabled";
61+
public static final String SYSTEM_MEM_LIMIT_GB = "system-mem-limit-gb";
62+
public static final String SYSTEM_MEM_SHRINK_GB = "system-mem-shrink-gb";
63+
public static final String WORKER_OVERLOADED_THRESHOLD_MEM_GB = "worker-overloaded-threshold-mem-gb";
64+
public static final String WORKER_OVERLOADED_THRESHOLD_CPU_PCT = "worker-overloaded-threshold-cpu-pct";
6565
public static final String EXPERIMENTAL_SPILLER_SPILL_PATH = "experimental.spiller-spill-path";
66-
public static final String TASK_MAX_DRIVERS_PER_TASK = "task.max-drivers-per-task";
6766
public static final String ENABLE_OLD_TASK_CLEANUP = "enable-old-task-cleanup";
68-
public static final String SHUFFLE_NAME = "shuffle.name";
6967
public static final String HTTP_SERVER_ENABLE_ACCESS_LOG = "http-server.enable-access-log";
7068
public static final String CORE_ON_ALLOCATION_FAILURE_ENABLED = "core-on-allocation-failure-enabled";
71-
public static final String SPILL_ENABLED = "spill-enabled";
72-
public static final String AGGREGATION_SPILL_ENABLED = "aggregation-spill-enabled";
73-
public static final String JOIN_SPILL_ENABLED = "join-spill-enabled";
74-
public static final String ORDER_BY_SPILL_ENABLED = "order-by-spill-enabled";
75-
public static final String MAX_SPILL_BYTES = "max-spill-bytes";
7669
public static final String REMOTE_FUNCTION_SERVER_THRIFT_UDS_PATH = "remote-function-server.thrift.uds-path";
7770
public static final String REMOTE_FUNCTION_SERVER_SIGNATURE_FILES_DIRECTORY_PATH = "remote-function-server.signature.files.directory.path";
7871
public static final String REMOTE_FUNCTION_SERVER_SERDE = "remote-function-server.serde";
@@ -100,25 +93,16 @@ public class NativeExecutionSystemConfig
10093
private final String connectorNumIoThreadsHwMultiplierDefault = "0";
10194
private final String prestoVersionDefault = "dummy.presto.version";
10295
private final String shutdownOnsetSecDefault = "10";
103-
private final String systemMemoryGbDefault = "10";
104-
private final String queryMemoryGbDefault = "8";
105-
private final String queryMaxMemoryPerNodeDefault = "8GB";
106-
private final String useMmapAllocatorDefault = "true";
107-
private final String memoryArbitratorKindDefault = "SHARED";
108-
private final String sharedArbitratorReservedCapacityDefault = "0GB";
109-
private final String sharedArbitratorMemoryPoolInitialCapacityDefault = "4GB";
110-
private final String sharedArbitratorMaxMemoryArbitrationTimeDefault = "5m";
96+
private final String systemMemPushbackEnabledDefault = "true";
97+
private final String systemMemPushbackAbortEnabledDefault = "true";
98+
private final String systemMemLimitGbDefault = "7";
99+
private final String systemMemShrinkGbDefault = "1";
100+
private final String workerOverloadedThresholdMemGbDefault = "6";
101+
private final String workerOverloadedThresholdCpuPctDefault = "85";
111102
private final String experimentalSpillerSpillPathDefault = "";
112-
private final String taskMaxDriversPerTaskDefault = "15";
113103
private final String enableOldTaskCleanupDefault = "false";
114-
private final String shuffleNameDefault = "local";
115104
private final String httpServerEnableAccessLogDefault = "true";
116105
private final String coreOnAllocationFailureEnabledDefault = "false";
117-
private final String spillEnabledDefault = "true";
118-
private final String aggregationSpillEnabledDefault = "true";
119-
private final String joinSpillEnabledDefault = "true";
120-
private final String orderBySpillEnabledDefault = "true";
121-
private final String maxSpillBytesDefault = String.valueOf(600L << 30);
122106

123107
private final Map<String, String> systemConfigs;
124108
private final Map<String, String> defaultSystemConfigs;
@@ -163,27 +147,16 @@ public NativeExecutionSystemConfig(
163147
.put(CONNECTOR_NUM_IO_THREADS_HW_MULTIPLIER, connectorNumIoThreadsHwMultiplierDefault)
164148
.put(PRESTO_VERSION, prestoVersionDefault)
165149
.put(SHUTDOWN_ONSET_SEC, shutdownOnsetSecDefault)
166-
.put(SYSTEM_MEMORY_GB, systemMemoryGbDefault)
167-
.put(QUERY_MEMORY_GB, queryMemoryGbDefault)
168-
.put(QUERY_MAX_MEMORY_PER_NODE, queryMaxMemoryPerNodeDefault)
169-
.put(USE_MMAP_ALLOCATOR, useMmapAllocatorDefault)
170-
.put(MEMORY_ARBITRATOR_KIND, memoryArbitratorKindDefault)
171-
.put(SHARED_ARBITRATOR_RESERVED_CAPACITY, sharedArbitratorReservedCapacityDefault)
172-
.put(SHARED_ARBITRATOR_MEMORY_POOL_INITIAL_CAPACITY,
173-
sharedArbitratorMemoryPoolInitialCapacityDefault)
174-
.put(SHARED_ARBITRATOR_MAX_MEMORY_ARBITRATION_TIME,
175-
sharedArbitratorMaxMemoryArbitrationTimeDefault)
150+
.put(SYSTEM_MEM_PUSHBACK_ENABLED, systemMemPushbackEnabledDefault)
151+
.put(SYSTEM_MEM_PUSHBACK_ABORT_ENABLED, systemMemPushbackAbortEnabledDefault)
152+
.put(SYSTEM_MEM_LIMIT_GB, systemMemLimitGbDefault)
153+
.put(SYSTEM_MEM_SHRINK_GB, systemMemShrinkGbDefault)
154+
.put(WORKER_OVERLOADED_THRESHOLD_MEM_GB, workerOverloadedThresholdMemGbDefault)
155+
.put(WORKER_OVERLOADED_THRESHOLD_CPU_PCT, workerOverloadedThresholdCpuPctDefault)
176156
.put(EXPERIMENTAL_SPILLER_SPILL_PATH, experimentalSpillerSpillPathDefault)
177-
.put(TASK_MAX_DRIVERS_PER_TASK, taskMaxDriversPerTaskDefault)
178157
.put(ENABLE_OLD_TASK_CLEANUP, enableOldTaskCleanupDefault)
179-
.put(SHUFFLE_NAME, shuffleNameDefault)
180158
.put(HTTP_SERVER_ENABLE_ACCESS_LOG, httpServerEnableAccessLogDefault)
181159
.put(CORE_ON_ALLOCATION_FAILURE_ENABLED, coreOnAllocationFailureEnabledDefault)
182-
.put(SPILL_ENABLED, spillEnabledDefault)
183-
.put(AGGREGATION_SPILL_ENABLED, aggregationSpillEnabledDefault)
184-
.put(JOIN_SPILL_ENABLED, joinSpillEnabledDefault)
185-
.put(ORDER_BY_SPILL_ENABLED, orderBySpillEnabledDefault)
186-
.put(MAX_SPILL_BYTES, maxSpillBytesDefault)
187160
.build();
188161
}
189162

presto-spark-base/src/test/java/com/facebook/presto/spark/execution/TestNativeExecutionProcess.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ public void testUpdateWorkerMemoryPropertiesWithoutSparkEnv()
104104
process.updateWorkerMemoryProperties();
105105
// Verify that values remain unchanged
106106
Map<String, String> properties = process.getWorkerProperty().getSystemConfig().getAllProperties();
107-
assertEquals(properties.get(NativeExecutionSystemConfig.SYSTEM_MEMORY_GB), "10");
108-
assertEquals(properties.get(NativeExecutionSystemConfig.QUERY_MEMORY_GB), "8");
109-
assertEquals(properties.get(NativeExecutionSystemConfig.QUERY_MAX_MEMORY_PER_NODE), "8GB");
107+
assertEquals(properties.get("system-memory-gb"), "10");
108+
assertEquals(properties.get("query-memory-gb"), "8");
109+
assertEquals(properties.get("query.max-memory-per-node"), "8GB");
110110
}
111111

112112
@Test
@@ -125,9 +125,9 @@ public void testUpdateWorkerMemoryPropertiesWithOffHeapMemory()
125125
// newSystemMemory = 20GB
126126
// queryMemoryFraction = 8/10 = 0.8
127127
// newQueryMemory = 20 * 0.8 = 16GB
128-
assertEquals(properties.get(NativeExecutionSystemConfig.SYSTEM_MEMORY_GB), "20");
129-
assertEquals(properties.get(NativeExecutionSystemConfig.QUERY_MEMORY_GB), "16");
130-
assertEquals(properties.get(NativeExecutionSystemConfig.QUERY_MAX_MEMORY_PER_NODE), "16GB");
128+
assertEquals(properties.get("system-memory-gb"), "20");
129+
assertEquals(properties.get("query-memory-gb"), "16");
130+
assertEquals(properties.get("query.max-memory-per-node"), "16GB");
131131
}
132132

133133
@Test
@@ -142,9 +142,9 @@ public void testUpdateWorkerMemoryPropertiesWithoutOffHeapSetting()
142142

143143
// Verify that values remain unchanged
144144
Map<String, String> properties = process.getWorkerProperty().getSystemConfig().getAllProperties();
145-
assertEquals(properties.get(NativeExecutionSystemConfig.SYSTEM_MEMORY_GB), "10");
146-
assertEquals(properties.get(NativeExecutionSystemConfig.QUERY_MEMORY_GB), "8");
147-
assertEquals(properties.get(NativeExecutionSystemConfig.QUERY_MAX_MEMORY_PER_NODE), "8GB");
145+
assertEquals(properties.get("system-memory-gb"), "10");
146+
assertEquals(properties.get("query-memory-gb"), "8");
147+
assertEquals(properties.get("query.max-memory-per-node"), "8GB");
148148
}
149149

150150
@Test
@@ -159,9 +159,9 @@ public void testUpdateWorkerMemoryPropertiesWithZeroOffHeapMemory()
159159

160160
// Verify that values remain unchanged when offHeapMemory is 0
161161
Map<String, String> properties = process.getWorkerProperty().getSystemConfig().getAllProperties();
162-
assertEquals(properties.get(NativeExecutionSystemConfig.SYSTEM_MEMORY_GB), "10");
163-
assertEquals(properties.get(NativeExecutionSystemConfig.QUERY_MEMORY_GB), "8");
164-
assertEquals(properties.get(NativeExecutionSystemConfig.QUERY_MAX_MEMORY_PER_NODE), "8GB");
162+
assertEquals(properties.get("system-memory-gb"), "10");
163+
assertEquals(properties.get("query-memory-gb"), "8");
164+
assertEquals(properties.get("query.max-memory-per-node"), "8GB");
165165
}
166166

167167
@Test
@@ -176,9 +176,9 @@ public void testUpdateWorkerMemoryPropertiesWithSmallerOffHeapMemory()
176176

177177
// Verify that values remain unchanged when offHeapMemory is smaller than current system memory
178178
Map<String, String> properties = process.getWorkerProperty().getSystemConfig().getAllProperties();
179-
assertEquals(properties.get(NativeExecutionSystemConfig.SYSTEM_MEMORY_GB), "10");
180-
assertEquals(properties.get(NativeExecutionSystemConfig.QUERY_MEMORY_GB), "8");
181-
assertEquals(properties.get(NativeExecutionSystemConfig.QUERY_MAX_MEMORY_PER_NODE), "8GB");
179+
assertEquals(properties.get("system-memory-gb"), "10");
180+
assertEquals(properties.get("query-memory-gb"), "8");
181+
assertEquals(properties.get("query.max-memory-per-node"), "8GB");
182182
}
183183

184184
@Test
@@ -198,9 +198,9 @@ public void testUpdateWorkerMemoryPropertiesWithDifferentQueryMemoryFraction()
198198
// newSystemMemory = 30GB
199199
// queryMemoryFraction = 6/12 = 0.5
200200
// newQueryMemory = 30 * 0.5 = 15GB
201-
assertEquals(properties.get(NativeExecutionSystemConfig.SYSTEM_MEMORY_GB), "30");
202-
assertEquals(properties.get(NativeExecutionSystemConfig.QUERY_MEMORY_GB), "15");
203-
assertEquals(properties.get(NativeExecutionSystemConfig.QUERY_MAX_MEMORY_PER_NODE), "15GB");
201+
assertEquals(properties.get("system-memory-gb"), "30");
202+
assertEquals(properties.get("query-memory-gb"), "15");
203+
assertEquals(properties.get("query.max-memory-per-node"), "15GB");
204204
}
205205

206206
@Test
@@ -215,9 +215,9 @@ public void testUpdateWorkerMemoryPropertiesWithZeroCurrentSystemMemory()
215215

216216
// Verify that values remain unchanged when current system memory is 0
217217
Map<String, String> properties = process.getWorkerProperty().getSystemConfig().getAllProperties();
218-
assertEquals(properties.get(NativeExecutionSystemConfig.SYSTEM_MEMORY_GB), "0");
219-
assertEquals(properties.get(NativeExecutionSystemConfig.QUERY_MEMORY_GB), "8");
220-
assertEquals(properties.get(NativeExecutionSystemConfig.QUERY_MAX_MEMORY_PER_NODE), "8GB");
218+
assertEquals(properties.get("system-memory-gb"), "0");
219+
assertEquals(properties.get("query-memory-gb"), "8");
220+
assertEquals(properties.get("query.max-memory-per-node"), "8GB");
221221
}
222222

223223
private TestingNativeExecutionProcess createTestingNativeExecutionProcess(
@@ -227,9 +227,9 @@ private TestingNativeExecutionProcess createTestingNativeExecutionProcess(
227227
SparkConf sparkConf)
228228
{
229229
Map<String, String> systemConfigs = new HashMap<>();
230-
systemConfigs.put(NativeExecutionSystemConfig.SYSTEM_MEMORY_GB, systemMemoryGb);
231-
systemConfigs.put(NativeExecutionSystemConfig.QUERY_MEMORY_GB, queryMemoryGb);
232-
systemConfigs.put(NativeExecutionSystemConfig.QUERY_MAX_MEMORY_PER_NODE, queryMaxMemoryPerNode);
230+
systemConfigs.put("system-memory-gb", systemMemoryGb);
231+
systemConfigs.put("query-memory-gb", queryMemoryGb);
232+
systemConfigs.put("query.max-memory-per-node", queryMaxMemoryPerNode);
233233

234234
NativeExecutionSystemConfig systemConfig = new NativeExecutionSystemConfig(systemConfigs);
235235
PrestoSparkWorkerProperty workerProperty = new PrestoSparkWorkerProperty(

presto-spark-base/src/test/java/com/facebook/presto/spark/execution/property/TestNativeExecutionSystemConfig.java

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,25 +60,16 @@ public void testNativeExecutionSystemConfig()
6060
.put("connector.num-io-threads-hw-multiplier", "0")
6161
.put("presto.version", "dummy.presto.version")
6262
.put("shutdown-onset-sec", "10")
63-
.put("system-memory-gb", "10")
64-
.put("query-memory-gb", "8")
65-
.put("query.max-memory-per-node", "8GB")
66-
.put("use-mmap-allocator", "true")
67-
.put("memory-arbitrator-kind", "SHARED")
68-
.put("shared-arbitrator.reserved-capacity", "0GB")
69-
.put("shared-arbitrator.memory-pool-initial-capacity", "4GB")
70-
.put("shared-arbitrator.max-memory-arbitration-time", "5m")
63+
.put("system-mem-pushback-enabled", "true")
64+
.put("system-mem-pushback-abort-enabled", "true")
65+
.put("system-mem-limit-gb", "7")
66+
.put("system-mem-shrink-gb", "1")
67+
.put("worker-overloaded-threshold-mem-gb", "6")
68+
.put("worker-overloaded-threshold-cpu-pct", "85")
7169
.put("experimental.spiller-spill-path", "")
72-
.put("task.max-drivers-per-task", "15")
7370
.put("enable-old-task-cleanup", "false")
74-
.put("shuffle.name", "local")
7571
.put("http-server.enable-access-log", "true")
7672
.put("core-on-allocation-failure-enabled", "false")
77-
.put("spill-enabled", "true")
78-
.put("aggregation-spill-enabled", "true")
79-
.put("join-spill-enabled", "true")
80-
.put("order-by-spill-enabled", "true")
81-
.put("max-spill-bytes", String.valueOf(600L << 30))
8273
.build();
8374
assertEquals(nativeExecutionSystemConfig.getAllProperties(), expectedConfigs);
8475

0 commit comments

Comments
 (0)