Bug 195861 - [patch] textproc/elasticsearch set Min JVM heap size = Max JVM heap size
Summary: [patch] textproc/elasticsearch set Min JVM heap size = Max JVM heap size
Status: Closed Not Accepted
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Tom Judge
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-10 21:49 UTC by Dan Langille
Modified: 2016-03-29 13:30 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (tj)


Attachments
patch rc.d file (1.09 KB, patch)
2014-12-10 21:49 UTC, Dan Langille
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Langille freebsd_committer freebsd_triage 2014-12-10 21:49:35 UTC
Created attachment 150439 [details]
patch rc.d file

In the past, it was standard to set min heap size < max heap size for a JVM.The current standard approach is to keep them the same.  This avoids the cost of resizing the JVM heap.

I encountered this issue today when the JVM started spouting repeated errors (see below).

Conversations in the elasticsearch IRC channel brought the above recommendation. I implemented it in my /etc/rc.conf file and the problem did not occur upon restart.


2014-12-10 19:38:26,155][WARN ][index.translog           ] [James Dr. Power] [logstash-2014.12.10][3] failed to flush shard on translog threshold
org.elasticsearch.index.engine.FlushFailedEngineException: [logstash-2014.12.10][3] Flush failed
	at org.elasticsearch.index.engine.internal.InternalEngine.flush(InternalEngine.java:901)
	at org.elasticsearch.index.shard.service.InternalIndexShard.flush(InternalIndexShard.java:627)
	at org.elasticsearch.index.translog.TranslogService$TranslogBasedFlush$1.run(TranslogService.java:201)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.lucene.store.AlreadyClosedException: this IndexWriter is closed
	at org.apache.lucene.index.IndexWriter.ensureOpen(IndexWriter.java:698)
	at org.apache.lucene.index.IndexWriter.ensureOpen(IndexWriter.java:712)
	at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:3063)
	at org.elasticsearch.index.engine.internal.InternalEngine.flush(InternalEngine.java:891)
	... 5 more
Caused by: java.lang.OutOfMemoryError: Java heap space
Comment 1 Bugzilla Automation freebsd_committer freebsd_triage 2014-12-10 21:49:35 UTC
Auto-assigned to maintainer tj@FreeBSD.org
Comment 2 Anton Saietskii 2015-06-02 17:22:25 UTC
I think that maintainer timeout was hit many times. Could be this change committed?
Comment 3 loic.blot 2015-11-25 21:15:26 UTC
The best practice is to have a Xms ~= 75% Xmx, not 100%.
Comment 4 Anton Saietskii 2015-11-26 11:09:11 UTC
(In reply to loic.blot from comment #3)
You're wrong. According to official ElasticSearch documentation, Xmx _must_ be equal to Xms.
https://www.elastic.co/guide/en/elasticsearch/guide/current/heap-sizing.html
>Ensure that the min (Xms) and max (Xmx) sizes are the same to prevent the heap from resizing at runtime, a very costly process.
Comment 5 commit-hook freebsd_committer freebsd_triage 2015-12-15 17:07:10 UTC
A commit references this bug:

Author: tj
Date: Tue Dec 15 17:06:12 UTC 2015
New revision: 403794
URL: https://svnweb.freebsd.org/changeset/ports/403794

Log:
  Update to 2.1.

  Changes: https://www.elastic.co/guide/en/elasticsearch/reference/2.1/release-notes-2.1.0.html

  - Fix path to allow service to start at boot
  - Misc cleanup from ohauer

  PR:		195861, 204821, 204902, 204910

Changes:
  head/textproc/elasticsearch2/Makefile
  head/textproc/elasticsearch2/distinfo
  head/textproc/elasticsearch2/files/patch-bin-elasticsearch.in.sh
  head/textproc/elasticsearch2/pkg-descr
  head/textproc/elasticsearch2/pkg-plist
Comment 6 Anton Saietskii 2016-03-29 10:13:52 UTC
Hello, Tom

Can you please explain why this PR rejected? Do you really think that official documentation (with explanation) is not enough to make this change?
Comment 7 Tom Judge freebsd_committer freebsd_triage 2016-03-29 13:30:23 UTC
1) textproc/elasticsearch is a legacy port for the 1.x line of elasticsearch,  textproc/elasticsearch2 does not use the same rc script and uses the defaults provided by upstream elasticsearch.

2) The documentation you provided states that the defaults are inadequate for almost every deployment and should be tune to the hardware used, as such having defaults that 'work' is ok but as everyone needs to change them there are no optimal defaults:

<quote>

The default installation of Elasticsearch is configured with a 1 GB heap. For just about every deployment, this number is far too small. If you are using the default heap values, your cluster is probably configured incorrectly.

</quote>

3) Everyone should be upgrading to the 2.x line of elasticsearch and shortly the 5.x unified version numbering releases of elastic/logstash/kibana/etc