Last gc duration collections total reclaimed leaving – 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) process takes longer than expected, indicating potential memory issues. This could be due to insufficient heap size, inefficient GC settings, or heavy indexing/search operations. To resolve this, you can increase the heap size, optimize GC settings, or balance the load by adding more nodes to the cluster. Also, consider optimizing your queries and indexing processes to reduce the load on Elasticsearch. Regular monitoring of Elasticsearch performance can help identify and prevent such issues.

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

Log Context

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

// Ignore any duration > 1hr; getLastGcInfo occasionally returns total crap
                    if (lastGc.duration().hoursFrac() > 1) {
                        continue;
                    }
                    if (lastGc.duration().millis() > gcThreshold.warnThreshold) {
                        logger.warn("[last_gc][{}][{}][{}] duration [{}]; collections [{}]; total [{}]/[{}]; reclaimed [{}]; leaving [{}][{}]/[{}]";
                                gc.name(); seq; gc.getCollectionCount(); lastGc.duration(); collections; TimeValue.timeValueMillis(collectionTime); gc.collectionTime(); lastGc.reclaimed(); lastGc.afterUsed(); lastGc.max());
                    } else if (lastGc.duration().millis() > gcThreshold.infoThreshold) {
                        logger.info("[last_gc][{}][{}][{}] duration [{}]; collections [{}]; total [{}]/[{}]; reclaimed [{}]; leaving [{}]/[{}]";
                                gc.name(); seq; gc.getCollectionCount(); lastGc.duration(); collections; TimeValue.timeValueMillis(collectionTime); gc.collectionTime(); lastGc.reclaimed(); lastGc.afterUsed(); lastGc.max());
                    } else if (lastGc.duration().millis() > 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?