Garbage collection optimization in Java / Tomcat / Solr

When there is replication between master and slave in solr (tomcat is a container), there is a GC surge (takes about 200 ms), and it seems to return much more resources (memory) than necessary (a large and sharp drop from used memory) . First of all, is 200 ms reasonable? Something that other people see? Secondly, there is a way to make the GC less radical (restoration is less because the destruction is less), but I'm not sure what I'm trying to do is doable or I am attacking the problem in the right direction.

Here are my GC options for your reference:

-XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:CMSInitiatingOccupancyFraction=30 -XX:ParallelCMSThreads=6 -XX:PermSize=64m -XX:MaxPermSize=64m -Xms32g -Xmx32g -XX:NewSize=512m -XX:MaxNewSize=512m -XX:TargetSurvivorRatio=90 -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=15 -XX:+UseStringCache -XX:+OptimizeStringConcat -XX:+UseCompressedOops -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=... -XX:+UseNUMA -XX:+UseCompressedStrings -XX:+UseBiasedLocking 
+4
source share
4 answers

In fact, there is a quick and easy way of this kind of GC-related timeouts, which does not depend on the complex collection and configuration of data, and this will work every time you work on Linux.

As noted elsewhere, whether timeout recessions caused by your Newgen, CMS or FullGC expectations are acceptable depends on your requirements. It's also true that setting up GC HotSpot mechanisms is a complex art, and you usually need a lot more detail and iterative experimentation to figure out how to improve your current behavior.

However, if you want all these pauses and associated timeouts to disappear without getting a PhD in the GC setup, there is a simple hack way: the Zing JVM will run this 32GB Solr heap with the GC, never breaking a sweat, and without any associated with GC pauses, crashes, or related timeouts. And he will do it out of the box, with default settings and virtually no configuration.

And yes, I work in Azul and am proud of it. We save people with such difficult weeks of effort and tons if the embarrassment of a timeout all the time.

+5
source

Setting up garbage collection is a complex topic. Your pause for garbage collection may or may not be too long, depending on your needs. We cannot know these requirements. The size of your heap may or may not be correct. Your heap cannot be broken correctly. You can use various garbage collection algorithms. We cannot answer these questions for you. There is no proper garbage collection formula. Thus, all you can do is change it until you meet everything that suits your application runtime behavior characteristics.

There are many options for managing your JVM. You can run here .

+3
source

What is and is not reasonable in terms of a GC surge depends on the application.

You need to observe the behavior of the HA for a longer period of time in order to reason that some spikes are unreasonably higher than others.

FullGC pauses in 1-3 seconds are relatively reasonable with heap sizes of 16-32 GB. YoungGC can be around 200 ms.

+1
source

One way to solve Solr garbage collection problems is to move many large data structures such as filterCache and offCool FieldCache.

Heliosearch is a Solr fork that does just that (heap data structures). So far, see the following blogs:

http://heliosearch.org/off-heap-filters/

http://heliosearch.org/solr-off-heap-fieldcache/

+1
source

Source: https://habr.com/ru/post/1502894/


All Articles