如何在apache cassandra 3.11.4中启用G1 gc

如何在apache cassandra 3.11.4中启用G1 gc,cassandra,Cassandra,我使用的是ApacheCassandra3.11.4和Java8。我使用的是48GB的ram,并且面临很多gc问题。 我想从CMS迁移到G1,并在jvm.options中做了以下更改,注释了所有CMS更改。启用了G1 ### CMS Settings ####-XX:+UseParNewGC ####-XX:+UseConcMarkSweepGC ####-XX:+CMSParallelRemarkEnabled ####-XX:SurvivorRatio=8 ####-XX:MaxTenur

我使用的是ApacheCassandra3.11.4和Java8。我使用的是48GB的ram,并且面临很多gc问题。 我想从CMS迁移到G1,并在jvm.options中做了以下更改,注释了所有CMS更改。启用了G1

### CMS Settings

####-XX:+UseParNewGC
####-XX:+UseConcMarkSweepGC
####-XX:+CMSParallelRemarkEnabled
####-XX:SurvivorRatio=8
####-XX:MaxTenuringThreshold=1
####-XX:CMSInitiatingOccupancyFraction=75
####-XX:+UseCMSInitiatingOccupancyOnly
####-XX:CMSWaitDuration=10000
####-XX:+CMSParallelInitialMarkEnabled
####-XX:+CMSEdenChunksRecordAlways
#### some JVMs will fill up their heap when accessed via JMX, see CASSANDRA-6541
####-XX:+CMSClassUnloadingEnabled

### GC logging options -- uncomment to enable

--XX:+PrintGCDetails
--XX:+PrintGCDateStamps
--XX:+PrintHeapAtGC
--XX:+PrintTenuringDistribution
--XX:+PrintGCApplicationStoppedTime
--XX:+PrintPromotionFailure
--XX:PrintFLSStatistics=1
--Xloggc:/var/log/cassandra/gc.log
--XX:+UseGCLogFileRotation
--XX:NumberOfGCLogFiles=10
--XX:GCLogFileSize=10M

但我作为GC获得CMS。请建议如何从CNS切换到G1 gc。

之所以如此,是因为CMS是Java 8中的默认垃圾收集器。即使你把它注释掉,除非你添加了G1设置,它仍然会使用CMS

在CMS和GC日志部分之间,该文件中应该还有一个部分-G1部分,如下所示:

### G1 Settings (experimental, comment previous section and uncomment section below to enable)

## Use the Hotspot garbage-first collector.
-XX:+UseG1GC
#
## Have the JVM do less remembered set work during STW, instead
## preferring concurrent GC. Reduces p99.9 latency.
-XX:G1RSetUpdatingPauseTimePercent=5
#
## Main G1GC tunable: lowering the pause target will lower throughput and vise versa.
## 200ms is the JVM default and lowest viable setting
## 1000ms increases throughput. Keep it smaller than the timeouts in cassandra.yaml.
-XX:MaxGCPauseMillis=500

## Optional G1 Settings

# Save CPU time on large (>= 16GB) heaps by delaying region scanning
# until the heap is 70% full. The default in Hotspot 8u40 is 40%.
#-XX:InitiatingHeapOccupancyPercent=70

# For systems with > 8 cores, the default ParallelGCThreads is 5/8 the number of logical cores.
# Otherwise equal to the number of cores when 8 or less.
# Machines with > 10 cores should try setting these to <= full cores.
#-XX:ParallelGCThreads=16
# By default, ConcGCThreads is 1/4 of ParallelGCThreads.
# Setting both to the same value can reduce STW durations.
#-XX:ConcGCThreads=16
如果您确保UseG1GC、updateingPausetimePercent和MaxGCPauseMillis没有注释,那么Cassandra应该从G1开始作为垃圾收集器