Can't set JVM Cheap memory setting

Hi,

I have a circuit_breaking_exception error in my cluster. When I look into logs I see that nodes need 32gb JVM memory to load indices.

[parent] Data too large, data for [indices:data/read/search[phase/query]] would be [31996760742/29.7gb], which is larger than the limit of [31621696716/29.4gb], real usage: [31996748928/29.7gb], new bytes reserved: [11814/11.5kb], usages [fielddata=0/0b, request=0/0b, inflight_requests=13994/13.6kb, model_inference=0/0b, eql_sequence=0/0b]

So I add ES_JAVA_OPTS=-Xms32g -Xmx32g environment variable to my containers via docker service update --env-add "ES_JAVA_OPTS=-Xms32g -Xmx32g" elastic_node1. But in logs I see that elasticsearch set this memory to only 30.6gb.

I think this value should be equal to 32gb. Somebody know why this happening ?

Thanks for help.

PS. I running elasticsearch nodes as a docker services

I would recommend reading this blog post on the topic. It explains why it is important to set the heap size below 32GB in order to benefit from compressed pointers.

Which version of Elasticsearch are you using?

What is the size of the cluster? How much data does it hold? What load is it under?