diff --git a/config/startup.options b/config/startup.options index 3829fdb9b5..46bf10b32b 100644 --- a/config/startup.options +++ b/config/startup.options @@ -38,7 +38,7 @@ LS_GC_LOG_FILE=/var/log/logstash/gc.log LS_OPEN_FILES=16384 # Nice level -LS_NICE=19 +LS_NICE=0 # Change these to have the init script named and described differently # This is useful when running multiple instances of Logstash on the same diff --git a/docs/reference/performance-troubleshooting.md b/docs/reference/performance-troubleshooting.md index 69cd49fddf..5ea8eff5e1 100644 --- a/docs/reference/performance-troubleshooting.md +++ b/docs/reference/performance-troubleshooting.md @@ -52,7 +52,13 @@ You may be tempted to jump ahead and change settings like `pipeline.workers` (`- * 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. * 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](/reference/tuning-logstash.md#profiling-the-heap). -4. **Tune Logstash pipeline settings:** +4. **Adjust process `nice` value to `0`:** + + * Logstash historically defaulted to a `nice` value of `19` in order to not interfere with normal operation of services and applications it runs alongside. This causes Logstash to run at **the lowest priority** possible. + * For **RPM/DEB** installations, Logstash's systemd unit file is located at `/usr/lib/systemd/system/logstash.service`. + * For **Tarball** installations, Logstash instead uses `$LS_SETTINGS_DIR/config/startup.options` if it was installed with `bin/system-install`. Running directly from the directory (i.e. `./bin/logstash`) is unaffected. + +5. **Tune Logstash pipeline settings:** * Continue on to [Tuning and profiling logstash pipeline performance](/reference/tuning-logstash.md) to learn about tuning individual pipelines. diff --git a/pkg/service_templates/systemd/lib/systemd/system/logstash.service b/pkg/service_templates/systemd/lib/systemd/system/logstash.service index 68ff3c4e70..ed882ca3ad 100644 --- a/pkg/service_templates/systemd/lib/systemd/system/logstash.service +++ b/pkg/service_templates/systemd/lib/systemd/system/logstash.service @@ -13,7 +13,7 @@ EnvironmentFile=-/etc/sysconfig/logstash ExecStart=/usr/share/logstash/bin/logstash "--path.settings" "/etc/logstash" Restart=always WorkingDirectory=/ -Nice=19 +Nice=0 LimitNOFILE=16384 # When stopping, how long to wait before giving up and sending SIGKILL? diff --git a/pkg/service_templates/sysv/etc/default/logstash b/pkg/service_templates/sysv/etc/default/logstash index 325a8a1e59..1e72edbd7a 100644 --- a/pkg/service_templates/sysv/etc/default/logstash +++ b/pkg/service_templates/sysv/etc/default/logstash @@ -5,6 +5,6 @@ LS_USER="logstash" LS_GROUP="logstash" LS_GC_LOG_FILE="/var/log/logstash/gc.log" LS_OPEN_FILES="16384" -LS_NICE="19" +LS_NICE="0" SERVICE_NAME="logstash" SERVICE_DESCRIPTION="logstash" diff --git a/pkg/service_templates/sysv/etc/init.d/logstash b/pkg/service_templates/sysv/etc/init.d/logstash index 932ccab484..2627c5a701 100755 --- a/pkg/service_templates/sysv/etc/init.d/logstash +++ b/pkg/service_templates/sysv/etc/init.d/logstash @@ -26,7 +26,7 @@ user="logstash" group="logstash" chroot="/" chdir="/" -nice="19" +nice="0" limit_open_files="16384"