How to set elasticsearch jvm heap size?

If I have a 16C64G machine and install CentOS7.6 on it, There is 62gb available memory.

             total        used        free      shared  buff/cache   available
Mem:             62          34           0           0          27          27
Swap:             0           0           0

According to the reference, I have 3 choices to set the jvm heap size:
31.5gb: The largest size I can set If I want to use compressed object pointers (compressed oops)
31gb: half of the system memory and use compressed object pointers (compressed oops)
30gb: The largest size I can set if I want to use zero based compressed oops.

So which is the best practise?

Half of the system, up to just under 32GB. You will want to check in your Elasticsearch logs at startup if it's using compressed pointers if you get near 31-32GB.

So you mean 31gb is the best,right?
I want to know if it is worth to reduce 1gb memory, from 31gb to 30gb, to use zero based compressed oops.

It 100% is.
Otherwise you need (from memory) about 40+ gig of heap to store the same amount.

Sorry I didn't express it clearly.
I just want to compare zero based compressed oops with compressed oops, both of them(30gb and 31gb) use the compressed object pointers.

The reference manual contains clear instructions:

Set Xmx and Xms to no more than the threshold for zero-based compressed oops.

You can ignore this instruction at your own risk, but if you want to know the recommended practice then that's what it is.

I know the threshold value of compressed oops and zero-based compressed oops.
But I don't know which one is better.
Theoretically zero-based compressed oops has better performance than compressed oops, but if I want to use it ,the largest value must be no more than 30gb. 1gb less than 31gb with compressed oops.

It's better to stick to what the manual says.

So 30gb is better, because it meets all recommendations in the manual, right?

The exact threshold varies from JVM to JVM, I don't think 30GB is always low enough but it often is. As long as your JVM reports that it's using zero-based compressed oops, it's all good.


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.