{"id":8862,"date":"2022-04-21T11:34:04","date_gmt":"2022-04-21T16:34:04","guid":{"rendered":"https:\/\/www.rushworth.us\/lisa\/?p=8862"},"modified":"2022-04-21T14:39:19","modified_gmt":"2022-04-21T19:39:19","slug":"elasticsearch-java-heap-size-order-of-precedence","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=8862","title":{"rendered":"ElasticSearch Java Heap Size &#8212; Order of Precedence"},"content":{"rendered":"<p>I was asked to look at a malfunctioning ElasticSearch server this week. It&#8217;s a lab sandbox, so not a huge deal &#8230; but still something they wanted online and functioning for some proof-of-concept testing. And, as a bonus, they&#8217;re willing to let us use their lab servers for our own sandboxing (IPv6 implementation, ELK upgrades). There were a handful of problems (it <em>looks<\/em> like the whole thing used to be a multi-node cluster but the second cluster node has vanished without any trace, the entire platform was re-IP&#8217;d, vm.max_map_count wasn&#8217;t set on the Docker server, and the logstash folder had a backup of a pipeline config in \/path\/to\/logstash\/pipeline\/ &#8230; which still loads, so causes a continual stream of port-in-use exceptions). But the biggest problem was that any attempt at actually <em>using<\/em> the ElasticSearch server resulted in it falling over. Java crashed with an out of memory error because the heap space was exhausted. Now I&#8217;ve had really small sandboxes before &#8212; my first ES sandbox only had a gig of memory and was quite prone to this crash. But the lab server they&#8217;ve set up has 64GB of memory. So allocating a few gigs seemed like a quick solution.<\/p>\n<p>The jvm.options file and jvm.options.d folder weren&#8217;t mounted into the container &#8212; they were the default files held within the container. Which seemed odd, and I made a mental note that it was something we&#8217;d need to either mount in or update again when the container gets updated. But no matter how much heap space I allocated, ES crashed.<\/p>\n<p>I discovered that the Docker deployment set an ENV variable for ES_JAVA_OPTS &#8212; something which, <a href=\"https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/reference\/current\/advanced-configuration.html#set-jvm-heap-size\" target=\"_blank\" rel=\"noopener\">per the ElasticSearch documentation<\/a>, overrides all other JVM options. So no matter what I was putting into the jvm options file, the 256 meg set in the ENV was actually being used.<\/p>\n<p><a href=\"https:\/\/www.rushworth.us\/lisa\/?attachment_id=8863\" rel=\"attachment wp-att-8863\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8863\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2022\/04\/ELK-JVMHeapSize.png\" alt=\"\" width=\"499\" height=\"150\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2022\/04\/ELK-JVMHeapSize.png 499w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2022\/04\/ELK-JVMHeapSize-300x90.png 300w\" sizes=\"auto, (max-width: 499px) 100vw, 499px\" \/><\/a><\/p>\n<p>Luckily it&#8217;s not terribly difficult to <a href=\"https:\/\/www.rushworth.us\/lisa\/?p=8865\" target=\"_blank\" rel=\"noopener\">modify the ENV&#8217;s within an existing container<\/a>. You could, of course, redeploy the container with the new settings (and I&#8217;ll do that next time, since I&#8217;ve also got to get IPv6 enabled). But I wasn&#8217;t planning on making any other changes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was asked to look at a malfunctioning ElasticSearch server this week. It&#8217;s a lab sandbox, so not a huge deal &#8230; but still something they wanted online and functioning for some proof-of-concept testing. And, as a bonus, they&#8217;re willing to let us use their lab servers for our own sandboxing (IPv6 implementation, ELK upgrades). &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1588],"tags":[231,1590,1589,1593,578,1592,1591],"class_list":["post-8862","post","type-post","status-publish","format-standard","hentry","category-elk","tag-docker","tag-elasticsearch","tag-elk","tag-heap-space","tag-java","tag-jvm","tag-kibana"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/8862","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8862"}],"version-history":[{"count":2,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/8862\/revisions"}],"predecessor-version":[{"id":8868,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/8862\/revisions\/8868"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8862"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8862"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8862"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}