This is an automated email from the ASF dual-hosted git repository.

ibessonov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new d4d74253550 IGNITE-27049 Print VM memory and GC info on node start 
(#7139)
d4d74253550 is described below

commit d4d74253550f273b51225f343781cd5d5a3a556a
Author: Viacheslav Blinov <[email protected]>
AuthorDate: Fri Dec 5 12:51:36 2025 +0300

    IGNITE-27049 Print VM memory and GC info on node start (#7139)
---
 .../ignite/internal/app/IgniteServerImpl.java      | 57 +++++++++++++++++++++-
 1 file changed, 56 insertions(+), 1 deletion(-)

diff --git 
a/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteServerImpl.java
 
b/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteServerImpl.java
index bbb2262732f..193839cf5d2 100644
--- 
a/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteServerImpl.java
+++ 
b/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteServerImpl.java
@@ -27,14 +27,22 @@ import static 
org.apache.ignite.lang.ErrorGroups.Common.INTERNAL_ERR;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.lang.management.GarbageCollectorMXBean;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryMXBean;
+import java.lang.management.MemoryManagerMXBean;
+import java.lang.management.MemoryUsage;
+import java.lang.management.RuntimeMXBean;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.util.List;
 import java.util.Random;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Executor;
 import java.util.function.Supplier;
+import java.util.stream.Collectors;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteServer;
 import org.apache.ignite.InitParameters;
@@ -413,6 +421,12 @@ public class IgniteServerImpl implements IgniteServer {
 
         logVmInfo();
 
+        logJvmArguments();
+
+        logAvailableVmMemory();
+
+        logGcConfiguration();
+
         ackRemoteManagement();
 
         return instance.startAsync().thenCompose(unused -> {
@@ -491,7 +505,6 @@ public class IgniteServerImpl implements IgniteServer {
 
     private static void logAvailableResources() {
         LOG.info("Available processors: {}", 
Runtime.getRuntime().availableProcessors());
-        LOG.info("Max heap: {}", Runtime.getRuntime().maxMemory());
     }
 
     private static void logOsInfo() {
@@ -527,6 +540,48 @@ public class IgniteServerImpl implements IgniteServer {
         );
     }
 
+    private static void logAvailableVmMemory() {
+        MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
+        MemoryUsage heapMemoryUsage = memoryBean.getHeapMemoryUsage();
+        MemoryUsage nonHeapMemoryUsage = memoryBean.getNonHeapMemoryUsage();
+
+        LOG.info(
+                "VM Memory Configuration: heap [init={}, max={}], non-heap 
[init={}, max={}]",
+                toHumanReadableMemoryString(heapMemoryUsage.getInit()),
+                toHumanReadableMemoryString(heapMemoryUsage.getMax()),
+                toHumanReadableMemoryString(nonHeapMemoryUsage.getInit()),
+                toHumanReadableMemoryString(nonHeapMemoryUsage.getMax())
+        );
+    }
+
+    private static void logJvmArguments() {
+        RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
+        List<String> jvmArgs = runtimeMxBean.getInputArguments();
+
+        LOG.info("VM arguments: {}", String.join(" ", jvmArgs));
+    }
+
+    private static String toHumanReadableMemoryString(long bytes) {
+        String[] suffix = { "KB", "MB", "GB", "TB" };
+        for (int i = suffix.length; i > 0; i--) {
+            int shift = i * 10;
+            long valueInUnits = bytes >> shift;
+            if (valueInUnits > 0) {
+                return valueInUnits + " " + suffix[i - 1];
+            }
+        }
+        return bytes + " B";
+    }
+
+    private static void logGcConfiguration() {
+        List<GarbageCollectorMXBean> gcBeans = 
ManagementFactory.getGarbageCollectorMXBeans();
+        String gcConfiguration = gcBeans.stream()
+                .map(MemoryManagerMXBean::getName)
+                .collect(Collectors.joining(", "));
+
+        LOG.info("VM GC: {}", gcConfiguration);
+    }
+
     private static void ackRemoteManagement() {
         if (LOG.isInfoEnabled()) {
             boolean jmxEnabled = 
System.getProperty("com.sun.management.jmxremote") != null;

Reply via email to