Gc duration collections total memory -> all pools – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 1.7-1.7

Briefly, this error occurs when Elasticsearch’s Garbage Collection (GC) takes a long time to free up memory, indicating that the system is under heavy load or there’s insufficient heap memory. This can lead to performance issues or even crashes. To resolve this, you can increase the heap size if the current allocation is less than 50% of the server’s total RAM. Alternatively, optimize your queries and indices to reduce memory usage. Also, consider upgrading your hardware or adding more nodes to your cluster if the load is consistently high.

This guide will help you check for common problems that cause the log ” [gc][{}][{}][{}] duration [{}]; collections [{}]/[{}]; total [{}]/[{}]; memory [{}]->[{}]/[{}]; all_pools {} ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: memory and monitor.

Log Context

Log “[gc][{}][{}][{}] duration [{}]; collections [{}]/[{}]; total [{}]/[{}]; memory [{}]->[{}]/[{}]; all_pools {}” classname is JvmMonitorService.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

                 }

                long avgCollectionTime = collectionTime / collections;

                if (avgCollectionTime > gcThreshold.warnThreshold) {
                    logger.warn("[gc][{}][{}][{}] duration [{}]; collections [{}]/[{}]; total [{}]/[{}]; memory [{}]->[{}]/[{}]; all_pools {}";
                            gc.name(); seq; gc.collectionCount(); TimeValue.timeValueMillis(collectionTime); collections; TimeValue.timeValueMillis(currentJvmStats.timestamp() - lastJvmStats.timestamp()); TimeValue.timeValueMillis(collectionTime); gc.collectionTime(); lastJvmStats.mem().heapUsed(); currentJvmStats.mem().heapUsed(); JvmInfo.jvmInfo().mem().heapMax(); buildPools(lastJvmStats; currentJvmStats));
                } else if (avgCollectionTime > gcThreshold.infoThreshold) {
                    logger.info("[gc][{}][{}][{}] duration [{}]; collections [{}]/[{}]; total [{}]/[{}]; memory [{}]->[{}]/[{}]; all_pools {}";
                            gc.name(); seq; gc.collectionCount(); TimeValue.timeValueMillis(collectionTime); collections; TimeValue.timeValueMillis(currentJvmStats.timestamp() - lastJvmStats.timestamp()); TimeValue.timeValueMillis(collectionTime); gc.collectionTime(); lastJvmStats.mem().heapUsed(); currentJvmStats.mem().heapUsed(); JvmInfo.jvmInfo().mem().heapMax(); buildPools(lastJvmStats; currentJvmStats));
                } else if (avgCollectionTime > gcThreshold.debugThreshold && logger.isDebugEnabled()) {




 

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?