[ 
https://issues.apache.org/jira/browse/CASSANDRA-15839?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17143525#comment-17143525
 ] 

Anthony Grasso commented on CASSANDRA-15839:
--------------------------------------------

Code review complete. Other than rebasing the _CHANGES.txt_ file the proposed 
changes are good.

I have tested the changes as part of the code review. I tested the changes on 
{{trunk}} commit 
[{{a28d8f7590cc98ef25eced4b2968c577d0156e50}}|https://github.com/apache/cassandra/commit/a28d8f7590cc98ef25eced4b2968c577d0156e50]
 using JDK 11. Below are the steps and the output I used for testing.

*1. Get Java version*
{code}
$ java -version
java version "11.0.6" 2020-01-14 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.6+8-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.6+8-LTS, mixed mode)
{code}

*2. Set JVM setttings*
Update _jvm11-server.options_ file to use {{G1}} and define {{Xmn}}
{code}
$ head -n 58 ./conf/jvm11-server.options
###########################################################################
#                         jvm11-server.options                            #
#                                                                         #
# See jvm-server.options. This file is specific for Java 11 and newer.    #
###########################################################################

#################
#  GC SETTINGS  #
#################



### CMS Settings
#-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



### G1 Settings
## Use the Hotspot garbage-first collector.
-XX:+UseG1GC
-XX:+ParallelRefProcEnabled

#
## 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

-Xmx2G
-Xms2G
-Xmn500M
{code}

*3. Run Cassandra*
We expect Cassandra to fail.
{code}
$ ./bin/cassandra
It is not recommended to set -Xmn with the G1 garbage collector. See comments 
for -Xmn in jvm-server.options for details.

$ ps aux | grep CassandraDaemon
anthony          97459   0.0  0.0  4268324    732 s008  S+    2:51pm   0:00.00 
grep CassandraDaemon
{code}

*4. Set JVM setttings again*
Update _jvm11-server.options_ file to use {{CMS}} and define {{Xmn}}
{code}
$ head -n 58 ./conf/jvm11-server.options
###########################################################################
#                         jvm11-server.options                            #
#                                                                         #
# See jvm-server.options. This file is specific for Java 11 and newer.    #
###########################################################################

#################
#  GC SETTINGS  #
#################



### CMS Settings
-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



### G1 Settings
## Use the Hotspot garbage-first collector.
#-XX:+UseG1GC
#-XX:+ParallelRefProcEnabled

#
## 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

-Xmx2G
-Xms2G
-Xmn500M
{code}

*5. Run Cassandra*
We expect Cassandra to start this time
{code}
$ ./bin/cassandra
Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was 
deprecated in version 9.0 and will likely be removed in a future release.
anthony@agrasso-rmbp16 4.0.0 $ CompileCommand: dontinline 
org/apache/cassandra/db/Columns$Serializer.deserializeLargeSubset(Lorg/apache/cassandra/io/util/DataInputPlus;Lorg/apache/cassandra/db/Columns;I)Lorg/apache/cassandra/db/Columns;
...
INFO  [main] ... StorageService.java:998 - Using saved tokens 
[-1034663135083937599, ... 988197206959246011]
INFO  [main] ... StorageService.java:1520 - JOINING: Finish joining ring
INFO  [main] ... StorageService.java:2533 - Node 127.0.0.1:7000 state jump to 
NORMAL
INFO  [main] ... StorageService.java:2533 - Node 127.0.0.1:7000 state jump to 
NORMAL

$ ps aux | grep CassandraDaemon
anthony          98292   1.4 14.2  8291584 2380492 s004  S     2:48pm   0:15.00 
/Library/Java/JavaVirtualMachines/jdk-11.0.6.jdk/Contents/Home/bin/java -ea 
-da:net.openhft... -XX:+UseThreadPriorities -XX:+HeapDumpOnOutOfMemoryError 
-Xss256k -XX:StringTableSize=1000003 -XX:+AlwaysPreTouch -XX:-UseBiasedLocking 
-XX:+UseTLAB -XX:+ResizeTLAB -XX:+UseNUMA -XX:+PerfDisableSharedMem 
-Djava.net.preferIPv4Stack=true -XX:+UseConcMarkSweepGC 
-XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=1 
-XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly 
-XX:CMSWaitDuration=10000 -XX:+CMSParallelInitialMarkEnabled 
-XX:+CMSEdenChunksRecordAlways -XX:+CMSClassUnloadingEnabled -Xmx2G -Xms2G 
-Xmn500M -Djdk.attach.allowAttachSelf=true --add-exports 
java.base/jdk.internal.misc=ALL-UNNAMED --add-exports 
java.base/jdk.internal.ref=ALL-UNNAMED --add-exports 
java.base/sun.nio.ch=ALL-UNNAMED --add-exports 
java.management.rmi/com.sun.jmx.remote.internal.rmi=ALL-UNNAMED --add-exports 
java.rmi/sun.rmi.registry=ALL-UNNAMED --add-exports 
java.rmi/sun.rmi.server=ALL-UNNAMED --add-exports java.sql/java.sql=ALL-UNNAMED 
--add-opens java.base/java.lang.module=ALL-UNNAMED --add-opens 
java.base/jdk.internal.loader=ALL-UNNAMED --add-opens 
java.base/jdk.internal.ref=ALL-UNNAMED --add-opens 
java.base/jdk.internal.reflect=ALL-UNNAMED --add-opens 
java.base/jdk.internal.math=ALL-UNNAMED --add-opens 
java.base/jdk.internal.module=ALL-UNNAMED --add-opens 
java.base/jdk.internal.util.jar=ALL-UNNAMED --add-opens 
jdk.management/com.sun.management.internal=ALL-UNNAMED 
-Xlog:gc=info,heap*=trace,age*=debug,safepoint=info,promotion*=trace:file=./bin/../logs/gc.log:time,uptime,pid,tid,level:filecount=10,filesize=10485760
 -XX:+UseCondCardMark -XX:CompileCommandFile=./bin/../conf/hotspot_compiler 
-javaagent:./bin/../lib/jamm-0.3.2.jar -Dcassandra.jmx.local.port=7199 
-Dcom.sun.management.jmxremote.authenticate=false 
-Dcom.sun.management.jmxremote.password.file=/etc/cassandra/jmxremote.password 
-Djava.library.path=./bin/../lib/sigar-bin -XX:OnOutOfMemoryError=kill -9 %p 
-Dlogback.configurationFile=logback.xml -Dcassandra.logdir=./bin/../logs 
-Dcassandra.storagedir=./bin/../data -cp 
./bin/../conf:./bin/../build/apache-cassandra-4.0-alpha5-SNAPSHOT.jar:./bin/../lib/HdrHistogram-2.1.9.jar:./bin/../lib/ST4-4.0.8.jar:./bin/../lib/airline-0.8.jar:./bin/../lib/antlr-runtime-3.5.2.jar:./bin/../lib/apache-cassandra-4.0-alpha5-SNAPSHOT.jar:./bin/../lib/asm-7.1.jar:./bin/../lib/caffeine-2.3.5.jar:./bin/../lib/cassandra-driver-core-3.9.0-shaded.jar:./bin/../lib/chronicle-bytes-1.16.3.jar:./bin/../lib/chronicle-core-1.16.4.jar:./bin/../lib/chronicle-queue-4.16.3.jar:./bin/../lib/chronicle-threads-1.16.0.jar:./bin/../lib/chronicle-wire-1.16.1.jar:./bin/../lib/commons-cli-1.1.jar:./bin/../lib/commons-codec-1.9.jar:./bin/../lib/commons-lang3-3.1.jar:./bin/../lib/commons-math3-3.2.jar:./bin/../lib/concurrent-trees-2.4.0.jar:./bin/../lib/ecj-4.6.1.jar:./bin/../lib/guava-27.0-jre.jar:./bin/../lib/high-scale-lib-1.0.6.jar:./bin/../lib/hppc-0.8.1.jar:./bin/../lib/j2objc-annotations-1.3.jar:./bin/../lib/jackson-annotations-2.9.10.jar:./bin/../lib/jackson-core-2.9.10.jar:./bin/../lib/jackson-databind-2.9.10.4.jar:./bin/../lib/jamm-0.3.2.jar:./bin/../lib/javax.inject.jar:./bin/../lib/jbcrypt-0.3m.jar:./bin/../lib/jcl-over-slf4j-1.7.25.jar:./bin/../lib/jcommander-1.30.jar:./bin/../lib/jctools-core-1.2.1.jar:./bin/../lib/jflex-1.6.0.jar:./bin/../lib/jna-4.2.2.jar:./bin/../lib/json-simple-1.1.jar:./bin/../lib/jstackjunit-0.0.1.jar:./bin/../lib/jvm-attach-api-1.5.jar:./bin/../lib/log4j-over-slf4j-1.7.25.jar:./bin/../lib/logback-classic-1.2.3.jar:./bin/../lib/logback-core-1.2.3.jar:./bin/../lib/lz4-java-1.7.1.jar:./bin/../lib/metrics-core-3.1.5.jar:./bin/../lib/metrics-jvm-3.1.5.jar:./bin/../lib/metrics-logback-3.1.5.jar:./bin/../lib/mxdump-0.14.jar:./bin/../lib/netty-all-4.1.50.Final.jar:./bin/../lib/netty-tcnative-boringssl-static-2.0.31.Final.jar:./bin/../lib/ohc-core-0.5.1.jar:./bin/../lib/ohc-core-j8-0.5.1.jar:./bin/../lib/psjava-0.1.19.jar:./bin/../lib/reporter-config-base-3.0.3.jar:./bin/../lib/reporter-config3-3.0.3.jar:./bin/../lib/sigar-1.6.4.jar:./bin/../lib/sjk-cli-0.14.jar:./bin/../lib/sjk-core-0.14.jar:./bin/../lib/sjk-json-0.14.jar:./bin/../lib/sjk-stacktrace-0.14.jar:./bin/../lib/slf4j-api-1.7.25.jar:./bin/../lib/snakeyaml-1.11.jar:./bin/../lib/snappy-java-1.1.2.6.jar:./bin/../lib/snowball-stemmer-1.3.0.581.1.jar:./bin/../lib/stream-2.5.2.jar:./bin/../lib/zstd-jni-1.3.8-5.jar:./bin/../lib/jsr223/*/*.jar:
 org.apache.cassandra.service.CassandraDaemon
anthony          98337   0.0  0.0  4270372    752 s008  S+    2:49pm   0:00.00 
grep CassandraDaemon
{code}

> Warn or fail to start server when G1 is used and Xmn is set
> -----------------------------------------------------------
>
>                 Key: CASSANDRA-15839
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-15839
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Local/Startup and Shutdown
>            Reporter: Jeremy Hanna
>            Assignee: Anthony Grasso
>            Priority: Normal
>
> In jvm.options, we currently have a comment above where Xmn is set that says 
> that you shouldn't set Xmn with G1 GC.  That isn't enough - we should either 
> warn in the logs or fail startup when they are set together.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to