Skip to content

Commit d8ed011

Browse files
committed
Doc:Expand and clarify guidance for jvm settings
Change fixed heap size recommendation to a percentage. Note that large configs may require more stack space Fixes: elastic#11605 elastic#11842 Fixes elastic#11867
1 parent b00710a commit d8ed011

File tree

3 files changed

+45
-15
lines changed

3 files changed

+45
-15
lines changed

docs/static/config-details.asciidoc

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
1+
[[jvm-settings]]
2+
=== JVM settings
3+
4+
Configure the jvm settings in the `jvm.options` <<settings-files,settings file>>.
5+
16
[[heap-size]]
2-
=== Setting the heap size
7+
==== Setting the JVM heap size
38

4-
Set the jvm heap size in the `jvm.options` <<config-setting-files,configuration
5-
file>>.
9+
Here are some tips for adjusting the JVM heap size:
610

7-
NOTE: The recommended heap size for typical ingestion scenarios should be no
11+
// tag::heap-size-tips[]
12+
* The recommended heap size for typical ingestion scenarios should be no
813
less than 4GB and no more than 8GB.
914

10-
Here are some additional tips for adjusting the JVM heap size:
11-
1215
* CPU utilization can increase unnecessarily if the heap size is too low,
1316
resulting in the JVM constantly garbage collecting. You can check for this issue
1417
by doubling the heap size to see if performance improves.
1518

16-
* Do not increase the heap size past the amount of physical
17-
memory. Leave at least 1GB free for the OS and other processes.
19+
* Do not increase the heap size past the amount of physical memory. Some memory
20+
must be left to run the OS and other processes. As a general guideline for most
21+
installations, don't exceed 50-75% of physical memory. The more memory you have,
22+
the higher percentage you can use.
1823

1924
* Set the minimum (Xms) and maximum (Xmx) heap allocation size to the same
2025
value to prevent the heap from resizing at runtime, which is a very costly
@@ -23,12 +28,31 @@ process.
2328
* You can make more accurate measurements of the JVM heap by using either the
2429
`jmap` command line utility distributed with Java or by using VisualVM. For more
2530
info, see <<profiling-the-heap>>.
31+
// end::heap-size-tips[]
2632

33+
[[stacks-size]]
34+
==== Setting the JVM stack size
2735

36+
Large configurations may require additional JVM stack memory.
37+
If you see a stack overflow error, try increasing the JVM stack size.
38+
Add an entry similar to this one in the `jvm.options`
39+
<<settings-files,settings file>>:
2840

41+
[source,sh]
42+
-----
43+
-Xss4M
44+
-----
2945

46+
Note that the default stack size is different per platform and per OS
47+
flavor. You can find out what the default is by running:
3048

49+
[source,sh]
50+
-----
51+
java -XX:+PrintFlagsFinal -version | grep ThreadStackSize
52+
-----
3153

54+
Depending on the default stack size, start by multiplying by 4x, then 8x, and
55+
then 16x until the overflow error resolves.
3256

3357

3458

docs/static/performance-checklist.asciidoc

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@ performance:
88
* <<tuning-logstash>>
99

1010
[[performance-troubleshooting]]
11-
=== Performance Troubleshooting Guide
11+
=== Performance Troubleshooting
1212

13-
You can use this troubleshooting guide to quickly diagnose and resolve Logstash performance problems. Advanced knowledge of pipeline internals is not required to understand this guide. However, the <<pipeline,pipeline documentation>> is recommended reading if you want to go beyond this guide.
13+
You can use these troubleshooting tips to quickly diagnose and resolve Logstash performance problems.
14+
Advanced knowledge of pipeline internals is not required to understand this guide.
15+
However, the <<pipeline,pipeline documentation>> is recommended reading if you want to go beyond these tips.
1416

15-
You may be tempted to jump ahead and change settings like `pipeline.workers` (`-w`) as a first attempt to improve performance. In our experience, changing this setting makes it more difficult to troubleshoot performance problems because you increase the number of variables in play. Instead, make one change at a time and measure the results. Starting at the end of this list is a sure-fire way to create a confusing situation.
17+
You may be tempted to jump ahead and change settings like `pipeline.workers`
18+
(`-w`) as a first attempt to improve performance. In our experience, changing
19+
this setting makes it more difficult to troubleshoot performance problems
20+
because you increase the number of variables in play. Instead, make one change
21+
at a time and measure the results. Starting at the end of this list is a
22+
sure-fire way to create a confusing situation.
1623

1724
[float]
1825
==== Performance Checklist
@@ -40,10 +47,7 @@ You may be tempted to jump ahead and change settings like `pipeline.workers` (`-
4047

4148
. *Check the JVM heap:*
4249
+
43-
* Often times CPU utilization can go through the roof if the heap size is too low, resulting in the JVM constantly garbage collecting.
44-
* A quick way to check for this issue is to double the heap size and see if performance improves. Do not increase the heap size past the amount of physical memory. Leave at least 1GB free for the OS and other processes.
45-
* You can make more accurate measurements of the JVM heap by using either the `jmap` command line utility distributed with Java or by using VisualVM. For more info, see <<profiling-the-heap>>.
46-
* Always make sure to set the minimum (Xms) and maximum (Xmx) heap allocation size to the same value to prevent the heap from resizing at runtime, which is a very costly process.
50+
include::config-details.asciidoc[tag=heap-size-tips]
4751

4852
. *Tune Logstash worker settings:*
4953
+

docs/static/setting-up-logstash.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ to standard output.
168168
Logstash has two types of configuration files: _pipeline configuration files_, which define the Logstash processing
169169
pipeline, and _settings files_, which specify options that control Logstash startup and execution.
170170

171+
[[pipeline-config-files]]
171172
==== Pipeline Configuration Files
172173

173174
You create pipeline configuration files when you define the stages of your Logstash processing pipeline. On deb and
@@ -176,6 +177,7 @@ files with `.conf` extension in the `/etc/logstash/conf.d directory` and ignores
176177

177178
See <<configuration>> for more info.
178179

180+
[[settings-files]]
179181
==== Settings Files
180182

181183
The settings files are already defined in the Logstash installation. Logstash includes the following settings files:

0 commit comments

Comments
 (0)