0

Details: Node is having 31G of memory. DSE: 5.1.3 => Cassandra 3.11.2

java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)

Configuration changes tried are as below.

Tried changing cassandra-env.sh

MAX_HEAP_SIZE="16g"
HEAP_NEWSIZE="16g"

Also, updated $CASSANDRA_CONF in cassandra-env.sh to /etc/dse/cassandra and tried.

And also tired changing jvm.options by commenting out in cassandra-env.sh file

-Xms16G
-Xmx16G

With any of the changes above, why is the heap size not changing to 16GB.

1)

java -XX:+PrintFlagsFinal -version | grep -iE 'MaxHeapSize'
uintx MaxHeapSize                              := 8392802304                          {product}
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)

2)

java -XX:+PrintCommandLineFlags -version
-XX:InitialHeapSize=524467520 -XX:MaxHeapSize=8391480320 -XX:+PrintCommandLineFlags -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseParallelGC
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)

Why is it showing only around 8GB although setting to 16GB and why is there difference in maxheapsize from JVM flag outputs.

Pramod
  • 113
  • 2
  • 14
  • 1
    When you run `java -XX:+PrintFlagsFinal`, you just start a *new* Java process which has no connection with Cassandra at all. If you want to inspect an *existing* Java process, use [`jcmd`](https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr006.html) instead. E.g. `jcmd PID VM.flags` or `jcmd PID GC.heap_info` – apangin Aug 26 '19 at 21:10
  • Thanks, But why is there difference between MaxHeapSize with +PrintCommandLineFlags & +PrintFlagsFinal – Pramod Aug 26 '19 at 21:35
  • `PrintFlagsFinal` prints the *final* values after applying JVM ergonimics, adjustments, alignment etc. In this case 8392802304 is the result of rounding 8391480320 up to the 2 MB boundary (remember about heap alignment that I mentioned in the [previous answer](https://stackoverflow.com/a/57633894/3448419))? – apangin Aug 26 '19 at 22:29
  • Yes, that's where the confusion. I thought it should be difference of either 2MB or 0. So the difference of 1321984(1.2MB) is the rounded difference(why rounded?). So, In which scenarios do we need to use these flags "+PrintCommandLineFlags & +PrintFlagsFinal" if these were giving the new java process outputs (Is it just to know the defaults available). – Pramod Aug 27 '19 at 15:17
  • I've never used `PrintCommandLineFlags`. But `PrintFlagsFinal` is actually useful to see the whole list of JVM options with their default or overridden values. – apangin Aug 27 '19 at 16:02
  • "default or overridden values" in the sense it should show the correct MaxHeapSize instead of using jmcd command. Not sure If my understanding was correct, the above flags will be showing the values set on command line. If that was the case, its going to affect the only process that command was invoked but not to the running JVM process. **Statement in the doc below:** "Enables printing of ergonomically selected JVM flags that appeared on the command line" Doc: [link](https://docs.oracle.com/javase/8/docs/technotes/tools/unix/java.html) No details for +PrintFlagsFinal on this doc. – Pramod Aug 27 '19 at 16:11
  • *"its going to affect the only process that command was invoked"* - yes – apangin Aug 27 '19 at 16:18

1 Answers1

0

Please check your /etc/dse/cassandra/jvm.options file (look for -Xmx and -Xms). If there are settings in that file, I believe they override your cassandra-env.sh. What does the "ps -ef | grep java" show you for the dse/cassandra process (look for Xmx and Xms)?

Jim Wartnick
  • 1,974
  • 1
  • 9
  • 19
  • I have commented out the parameters in the jvm.options file when enabled MAX_HEAP_SIZE in cassandra-env.sh and vice-versa. "ps -ef | grep java" shows as "-Xms16G -Xmx16G" But why are the flags showing 8GB. – Pramod Aug 26 '19 at 20:27
  • Are you just running the java command yourself? Where is that command coming from? The one that you're concerned with is the one that cassandra is running, not a java command you'd run your self, which looks like what you're doing (but am unsure) – Jim Wartnick Aug 27 '19 at 12:23
  • Yes, I am looking for how much does DSE/Cassandra process is utilizing for Heap. So ran the print flags thinking that those will show the running JVM details. – Pramod Aug 27 '19 at 14:43