diff --git a/api-test/backend/src/main/java/io/metersphere/api/jmeter/MsApiBackendListener.java b/api-test/backend/src/main/java/io/metersphere/api/jmeter/MsApiBackendListener.java
index 11d7091983..55579c416b 100644
--- a/api-test/backend/src/main/java/io/metersphere/api/jmeter/MsApiBackendListener.java
+++ b/api-test/backend/src/main/java/io/metersphere/api/jmeter/MsApiBackendListener.java
@@ -4,10 +4,7 @@ package io.metersphere.api.jmeter;
import io.metersphere.api.exec.queue.PoolExecBlockingQueueUtil;
import io.metersphere.api.jmeter.utils.ReportStatusUtil;
import io.metersphere.commons.constants.CommonConstants;
-import io.metersphere.commons.utils.CommonBeanFactory;
-import io.metersphere.commons.utils.FileUtils;
-import io.metersphere.commons.utils.FixedCapacityUtil;
-import io.metersphere.commons.utils.JSON;
+import io.metersphere.commons.utils.*;
import io.metersphere.commons.vo.ResultVO;
import io.metersphere.constants.BackendListenerConstants;
import io.metersphere.constants.RunModeConstants;
@@ -111,6 +108,8 @@ public class MsApiBackendListener extends AbstractBackendListenerClient implemen
apiExecutionQueueService.testPlanReportTestEnded(dto.getTestPlanReportId());
}
LoggerUtil.info("TEST-END处理结果集完成", dto.getReportId());
+
+ JvmUtil.memoryInfo();
} catch (Exception e) {
LoggerUtil.error("结果集处理异常", dto.getReportId(), e);
} finally {
diff --git a/api-test/backend/src/main/java/io/metersphere/api/jmeter/MsDebugListener.java b/api-test/backend/src/main/java/io/metersphere/api/jmeter/MsDebugListener.java
index aaf4d48757..32a0694bcd 100644
--- a/api-test/backend/src/main/java/io/metersphere/api/jmeter/MsDebugListener.java
+++ b/api-test/backend/src/main/java/io/metersphere/api/jmeter/MsDebugListener.java
@@ -111,6 +111,7 @@ public class MsDebugListener extends AbstractListenerElement implements SampleLi
LoggerUtil.debug("send. " + this.getName());
WebSocketUtil.sendMessageSingle(dto);
PoolExecBlockingQueueUtil.offer(this.getName());
+ JvmUtil.memoryInfo();
}
@Override
diff --git a/api-test/backend/src/main/java/io/metersphere/api/jmeter/MsKafkaListener.java b/api-test/backend/src/main/java/io/metersphere/api/jmeter/MsKafkaListener.java
index 4d68803505..faa49c1f3e 100644
--- a/api-test/backend/src/main/java/io/metersphere/api/jmeter/MsKafkaListener.java
+++ b/api-test/backend/src/main/java/io/metersphere/api/jmeter/MsKafkaListener.java
@@ -3,10 +3,7 @@ package io.metersphere.api.jmeter;
import io.metersphere.api.dto.MsgDTO;
import io.metersphere.commons.constants.ApiRunMode;
import io.metersphere.commons.constants.KafkaTopicConstants;
-import io.metersphere.commons.utils.CommonBeanFactory;
-import io.metersphere.commons.utils.JSONUtil;
-import io.metersphere.commons.utils.NamedThreadFactory;
-import io.metersphere.commons.utils.WebSocketUtil;
+import io.metersphere.commons.utils.*;
import io.metersphere.service.ApiExecutionQueueService;
import io.metersphere.service.TestResultService;
import io.metersphere.service.definition.ApiDefinitionEnvService;
@@ -59,8 +56,8 @@ public class MsKafkaListener {
task.setTestResultService(testResultService);
task.setRecord(item);
threadPool.execute(task);
- this.outKafkaPoolLogger();
});
+ JvmUtil.memoryInfo();
} catch (Exception e) {
LoggerUtil.error("KAFKA消费失败:", e);
} finally {
diff --git a/api-test/backend/src/main/java/io/metersphere/commons/utils/JvmUtil.java b/api-test/backend/src/main/java/io/metersphere/commons/utils/JvmUtil.java
new file mode 100644
index 0000000000..601a99a52a
--- /dev/null
+++ b/api-test/backend/src/main/java/io/metersphere/commons/utils/JvmUtil.java
@@ -0,0 +1,22 @@
+package io.metersphere.commons.utils;
+
+import io.metersphere.utils.LoggerUtil;
+
+public class JvmUtil {
+
+ public static void memoryInfo() {
+ int byteToMb = 1024 * 1024;
+ Runtime rt = Runtime.getRuntime();
+ long vmTotal = rt.totalMemory() / byteToMb;
+ long vmFree = rt.freeMemory() / byteToMb;
+ long vmMax = rt.maxMemory() / byteToMb;
+ long vmUse = vmTotal - vmFree;
+
+ StringBuilder builder = new StringBuilder("当前执行节点内存信息:").append("\n");
+ builder.append("当前JVM最大内存:" + vmMax + " M").append("\n");
+ builder.append("当前JVM占用的总内存:" + vmTotal + " M").append("\n");
+ builder.append("当前JVM空闲内存为:" + vmFree + " M").append("\n");
+ builder.append("当前JVM已用内存为:" + vmUse + " M").append("\n");
+ LoggerUtil.info(builder.toString());
+ }
+}
diff --git a/api-test/backend/src/main/resources/logback.xml b/api-test/backend/src/main/resources/logback.xml
index 29d3a5e8af..21dcae3e28 100644
--- a/api-test/backend/src/main/resources/logback.xml
+++ b/api-test/backend/src/main/resources/logback.xml
@@ -210,40 +210,6 @@
-
-
-
-
- INFO
-
- ${logging.file.path}/testPlan/info.log
-
- ${logging.file.path}/history/testPlan/info.%d{yyyyMMdd}-%i.log
-
- ${logger.max.history:-30}
-
- 50MB
-
-
-
- UTF-8
- %d %t %-5level %logger{36} %line - %msg%n
-
-
-
-
- INFO
-
- 10000
-
-
-
-
-
-
-