Skip to content

Commit 9a2ab9e

Browse files
author
宋光璠
committed
fix1210
1 parent 9c04f99 commit 9a2ab9e

File tree

2 files changed

+172
-4
lines changed

2 files changed

+172
-4
lines changed

fe/fe-core/src/main/java/org/apache/doris/common/profile/SummaryProfile.java

Lines changed: 145 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,19 @@ public class SummaryProfile {
8888
public static final String SINK_SET_PARTITION_VALUES_TIME = "Sink Set Partition Values Time";
8989
public static final String CPU_SHARE = "CPU Share";
9090
public static final String MEMORY_LIMIT = "Memory Limit";
91+
public static final String ENABLE_MEMORY_OVERCOMMIT = "Enable Memory Overcommit";
92+
public static final String MAX_CONCURRENCY = "Max Concurrency";
93+
public static final String MAX_QUEUE_SIZE = "Max Queue Size";
94+
public static final String QUEUE_TIMEOUT = "Queue Timeout";
95+
public static final String CPU_HARD_LIMIT = "CPU Hard Limit";
96+
public static final String SCAN_THREAD_NUM = "Scan Thread Num";
97+
public static final String MAX_REMOTE_SCAN_THREAD_NUM = "Max Remote Scan Thread Num";
98+
public static final String MIN_REMOTE_SCAN_THREAD_NUM = "Min Remote Scan Thread Num";
99+
public static final String MEMORY_LOW_WATERMARK = "Memory Low Watermark";
100+
public static final String MEMORY_HIGH_WATERMARK = "Memory High Watermark";
101+
public static final String TAG = "Tag";
102+
public static final String READ_BYTES_PER_SECOND = "Read Bytes Per Second";
103+
public static final String REMOTE_READ_BYTES_PER_SECOND = "Remote Read Bytes Per Second";
91104
public static final String PLAN_TIME = "Plan Time";
92105
public static final String SCHEDULE_TIME = "Schedule Time";
93106
public static final String ASSIGN_FRAGMENT_TIME = "Fragment Assign Time";
@@ -150,6 +163,19 @@ public class SummaryProfile {
150163
WORKLOAD_GROUP,
151164
CPU_SHARE,
152165
MEMORY_LIMIT,
166+
ENABLE_MEMORY_OVERCOMMIT,
167+
MAX_CONCURRENCY,
168+
MAX_QUEUE_SIZE,
169+
QUEUE_TIMEOUT,
170+
CPU_HARD_LIMIT,
171+
SCAN_THREAD_NUM,
172+
MAX_REMOTE_SCAN_THREAD_NUM,
173+
MIN_REMOTE_SCAN_THREAD_NUM,
174+
MEMORY_LOW_WATERMARK,
175+
MEMORY_HIGH_WATERMARK,
176+
TAG,
177+
READ_BYTES_PER_SECOND,
178+
REMOTE_READ_BYTES_PER_SECOND,
153179
PARSE_SQL_TIME,
154180
PLAN_TIME,
155181
NEREIDS_GARBAGE_COLLECT_TIME,
@@ -241,6 +267,19 @@ public class SummaryProfile {
241267
.put(HMS_UPDATE_PARTITION_CNT, 2)
242268
.put(CPU_SHARE, 1)
243269
.put(MEMORY_LIMIT, 1)
270+
.put(ENABLE_MEMORY_OVERCOMMIT, 1)
271+
.put(MAX_CONCURRENCY, 1)
272+
.put(MAX_QUEUE_SIZE, 1)
273+
.put(QUEUE_TIMEOUT, 1)
274+
.put(CPU_HARD_LIMIT, 1)
275+
.put(SCAN_THREAD_NUM, 1)
276+
.put(MAX_REMOTE_SCAN_THREAD_NUM, 1)
277+
.put(MIN_REMOTE_SCAN_THREAD_NUM, 1)
278+
.put(MEMORY_LOW_WATERMARK, 1)
279+
.put(MEMORY_HIGH_WATERMARK, 1)
280+
.put(TAG, 1)
281+
.put(READ_BYTES_PER_SECOND, 1)
282+
.put(REMOTE_READ_BYTES_PER_SECOND, 1)
244283
.build();
245284

246285
@SerializedName(value = "summaryProfile")
@@ -371,6 +410,32 @@ public class SummaryProfile {
371410
private int cpuShare = 0;
372411
@SerializedName(value = "memoryLimit")
373412
private double memoryLimit = 0.0;
413+
@SerializedName("enableMemoryOvercommit")
414+
private boolean enableMemoryOvercommit = true;
415+
@SerializedName("maxConcurrency")
416+
private int maxConcurrency = Integer.MAX_VALUE;
417+
@SerializedName("maxQueueSize")
418+
private int maxQueueSize = 0;
419+
@SerializedName("queueTimeout")
420+
private int queueTimeout = 0;
421+
@SerializedName("cpuHardLimit")
422+
private int cpuHardLimit = -1;
423+
@SerializedName("scanThreadNum")
424+
private int scanThreadNum = -1;
425+
@SerializedName("maxRemoteScanThreadNum")
426+
private int maxRemoteScanThreadNum = -1;
427+
@SerializedName("minRemoteScanThreadNum")
428+
private int minRemoteScanThreadNum = -1;
429+
@SerializedName("memoryLowWatermark")
430+
private int memoryLowWatermark = 0;
431+
@SerializedName("memoryHighWatermark")
432+
private int memoryHighWatermark = 0;
433+
@SerializedName("tag")
434+
private String tag = "";
435+
@SerializedName("readBytesPerSecond")
436+
private long readBytesPerSecond = -1L;
437+
@SerializedName("remoteReadBytesPerSecond")
438+
private long remoteReadBytesPerSecond = -1L;
374439
// BE -> (RPC latency from FE to BE, Execution latency on bthread, Duration of doing work, RPC latency from BE
375440
// to FE)
376441
private Map<TNetworkAddress, List<Long>> rpcPhase1Latency;
@@ -518,7 +583,31 @@ private void updateExecutionSummaryProfile() {
518583
RuntimeProfile.printCounter(queryFetchResultConsumeTime, TUnit.TIME_MS));
519584
executionSummaryProfile.addInfoString(WRITE_RESULT_TIME,
520585
RuntimeProfile.printCounter(queryWriteResultConsumeTime, TUnit.TIME_MS));
521-
executionSummaryProfile.addInfoString(CPU_SHARE, RuntimeProfile.printCounter(cpuShare, TUnit.BYTES));
586+
executionSummaryProfile.addInfoString(CPU_SHARE, RuntimeProfile.printCounter(cpuShare, TUnit.NONE));
587+
executionSummaryProfile.addInfoString(CPU_HARD_LIMIT,
588+
RuntimeProfile.printCounter(cpuHardLimit, TUnit.NONE));
589+
executionSummaryProfile.addInfoString(MEMORY_LIMIT, memoryLimit + "%");
590+
executionSummaryProfile.addInfoString(MEMORY_LOW_WATERMARK, memoryLowWatermark + "%");
591+
executionSummaryProfile.addInfoString(MEMORY_HIGH_WATERMARK, memoryHighWatermark + "%");
592+
executionSummaryProfile.addInfoString(ENABLE_MEMORY_OVERCOMMIT,
593+
String.valueOf(enableMemoryOvercommit));
594+
executionSummaryProfile.addInfoString(MAX_CONCURRENCY,
595+
RuntimeProfile.printCounter(maxConcurrency, TUnit.NONE));
596+
executionSummaryProfile.addInfoString(MAX_QUEUE_SIZE,
597+
RuntimeProfile.printCounter(maxQueueSize, TUnit.NONE));
598+
executionSummaryProfile.addInfoString(QUEUE_TIMEOUT,
599+
RuntimeProfile.printCounter(queueTimeout, TUnit.TIME_MS));
600+
executionSummaryProfile.addInfoString(SCAN_THREAD_NUM,
601+
RuntimeProfile.printCounter(scanThreadNum, TUnit.NONE));
602+
executionSummaryProfile.addInfoString(MAX_REMOTE_SCAN_THREAD_NUM,
603+
RuntimeProfile.printCounter(maxRemoteScanThreadNum, TUnit.NONE));
604+
executionSummaryProfile.addInfoString(MIN_REMOTE_SCAN_THREAD_NUM,
605+
RuntimeProfile.printCounter(minRemoteScanThreadNum, TUnit.NONE));
606+
executionSummaryProfile.addInfoString(TAG, tag);
607+
executionSummaryProfile.addInfoString(READ_BYTES_PER_SECOND,
608+
RuntimeProfile.printCounter(readBytesPerSecond, TUnit.BYTES_PER_SECOND));
609+
executionSummaryProfile.addInfoString(REMOTE_READ_BYTES_PER_SECOND,
610+
RuntimeProfile.printCounter(remoteReadBytesPerSecond, TUnit.BYTES_PER_SECOND));
522611
setTransactionSummary();
523612

524613
if (Config.isCloudMode()) {
@@ -739,9 +828,64 @@ public void setCpuShare(int cpuShare) {
739828
this.cpuShare = cpuShare;
740829
}
741830

831+
742832
public void setMemoryLimit(double memoryLimit) {
743833
this.memoryLimit = memoryLimit;
744834
}
835+
836+
837+
public void setEnableMemoryOvercommit(boolean enableMemoryOvercommit) {
838+
this.enableMemoryOvercommit = enableMemoryOvercommit;
839+
}
840+
841+
public void setMaxConcurrency(int maxConcurrency) {
842+
this.maxConcurrency = maxConcurrency;
843+
}
844+
845+
public void setMaxQueueSize(int maxQueueSize) {
846+
this.maxQueueSize = maxQueueSize;
847+
}
848+
849+
public void setQueueTimeout(int queueTimeout) {
850+
this.queueTimeout = queueTimeout;
851+
}
852+
853+
public void setCpuHardLimit(int cpuHardLimit) {
854+
this.cpuHardLimit = cpuHardLimit;
855+
}
856+
857+
public void setScanThreadNum(int scanThreadNum) {
858+
this.scanThreadNum = scanThreadNum;
859+
}
860+
861+
public void setMaxRemoteScanThreadNum(int maxRemoteScanThreadNum) {
862+
this.maxRemoteScanThreadNum = maxRemoteScanThreadNum;
863+
}
864+
865+
public void setMinRemoteScanThreadNum(int minRemoteScanThreadNum) {
866+
this.minRemoteScanThreadNum = minRemoteScanThreadNum;
867+
}
868+
869+
public void setMemoryLowWatermark(int memoryLowWatermark) {
870+
this.memoryLowWatermark = memoryLowWatermark;
871+
}
872+
873+
public void setMemoryHighWatermark(int memoryHighWatermark) {
874+
this.memoryHighWatermark = memoryHighWatermark;
875+
}
876+
877+
public void setTag(String tag) {
878+
this.tag = tag;
879+
}
880+
881+
public void setReadBytesPerSecond(long readBytesPerSecond) {
882+
this.readBytesPerSecond = readBytesPerSecond;
883+
}
884+
885+
public void setRemoteReadBytesPerSecond(long remoteReadBytesPerSecond) {
886+
this.remoteReadBytesPerSecond = remoteReadBytesPerSecond;
887+
}
888+
745889
public static class SummaryBuilder {
746890
private Map<String, String> map = Maps.newHashMap();
747891

fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,11 +347,35 @@ private Map<String, String> getSummaryInfo(boolean isFinished) {
347347

348348
if (!list.isEmpty()) {
349349
WorkloadGroup wg = list.get(0);
350-
getSummaryProfile().setCpuShare(wg.getMaxCpuPercent());
351-
getSummaryProfile().setMemoryLimit(wg.getMaxMemoryPercent());
350+
SummaryProfile summary = getSummaryProfile();
351+
summary.setCpuShare(wg.getMaxCpuPercent());
352+
summary.setMemoryLimit(wg.getMaxMemoryPercent());
353+
summary.setEnableMemoryOvercommit(Boolean.parseBoolean(wg.getProperties().getOrDefault(WorkloadGroup.ENABLE_MEMORY_OVERCOMMIT, "")));
354+
summary.setCpuHardLimit(Integer.parseInt(wg.getProperties().getOrDefault(WorkloadGroup.CPU_HARD_LIMIT, "")));
355+
summary.setMaxConcurrency(Integer.parseInt(wg.getProperties().getOrDefault(WorkloadGroup.MAX_CONCURRENCY, "")));
356+
summary.setMaxQueueSize(Integer.parseInt(wg.getProperties().getOrDefault(WorkloadGroup.MAX_QUEUE_SIZE, "")));
357+
summary.setQueueTimeout(Integer.parseInt(
358+
wg.getProperties().getOrDefault(WorkloadGroup.QUEUE_TIMEOUT, "")));
359+
summary.setScanThreadNum(Integer.parseInt(
360+
wg.getProperties().getOrDefault(WorkloadGroup.SCAN_THREAD_NUM, "")));
361+
summary.setMaxRemoteScanThreadNum(Integer.parseInt(
362+
wg.getProperties().getOrDefault(WorkloadGroup.MAX_REMOTE_SCAN_THREAD_NUM, "")));
363+
summary.setMinRemoteScanThreadNum(Integer.parseInt(
364+
wg.getProperties().getOrDefault(WorkloadGroup.MIN_REMOTE_SCAN_THREAD_NUM, "")));
365+
summary.setMemoryLowWatermark(Integer.parseInt(
366+
wg.getProperties().getOrDefault(WorkloadGroup.MEMORY_LOW_WATERMARK, "")));
367+
summary.setMemoryHighWatermark(Integer.parseInt(
368+
wg.getProperties().getOrDefault(WorkloadGroup.MEMORY_HIGH_WATERMARK, "")));
369+
summary.setTag(wg.getProperties().getOrDefault(
370+
WorkloadGroup.TAG, ""));
371+
summary.setReadBytesPerSecond(Long.parseLong(
372+
wg.getProperties().getOrDefault(WorkloadGroup.READ_BYTES_PER_SECOND, "")));
373+
summary.setRemoteReadBytesPerSecond(Long.parseLong(
374+
wg.getProperties().getOrDefault(WorkloadGroup.REMOTE_READ_BYTES_PER_SECOND, "")));
375+
352376
}
353377
} catch (UserException e) {
354-
throw new RuntimeException(e);
378+
LOG.warn(e);
355379
}
356380
return builder.build();
357381
}

0 commit comments

Comments
 (0)