# Logstash high CPU % on startup ~ 190%

**URL:** <https://discuss.elastic.co/t/logstash-high-cpu-on-startup-190/168490>\
**Category:** Logstash\
**Created:** [February 14, 2019, 9:12pm UTC](https://discuss.elastic.co/t/logstash-high-cpu-on-startup-190/168490 "2019-02-14T21:12:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![stash2logs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stash2logs/32/42101_2.png) [@stash2logs](https://discuss.elastic.co/u/stash2logs)\
**Post date:** [February 14, 2019, 9:12pm UTC](https://discuss.elastic.co/t/logstash-high-cpu-on-startup-190/168490/1 "2019-02-14T21:12:26Z")

</div>

I installed a fresh instance of Logstash with basic configurations for testing (no filters) just an input and an output. As soon as I start Logstash the CPU percentage shoots up to ~200%. Is this the normal behavior for starting logstash? What are some tuning suggestions that you can provide, I'm running out of ideas. Your help is greatly appreciated.

**Here are the specs:**  
Logstash version - 6.5.0 and 6.5.2  
OS - Redhat Linux 7.5  
4 CPU Core and 8GB of RAM

**Logstash.conf**  
input {  
stdin{}  
}

output {  
stdout{  
codec =\> rubydebug  
}  
}

**command used to start Logstash**  
./logstash -f logstash.conf

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 14, 2019, 9:33pm UTC](https://discuss.elastic.co/t/logstash-high-cpu-on-startup-190/168490/2 "2019-02-14T21:33:53Z")

</div>

When I start logstash it burns about 50 seconds of CPU before it is ready to do anything. So this sounds normal.

---

<div class="post-metadata">

**Author:** ![stash2logs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stash2logs/32/42101_2.png) [@stash2logs](https://discuss.elastic.co/u/stash2logs)\
**Post date:** [February 14, 2019, 9:59pm UTC](https://discuss.elastic.co/t/logstash-high-cpu-on-startup-190/168490/3 "2019-02-14T21:59:56Z")

</div>

@badger, after Logstash starts, the CPU% percentage does go down to about 40%, but if there is a sudden burst of input logs.... the CPU shoots up again to about 130% before it normalizes at about 70% which is still pretty high.

In an environment where incident would get created for high CPU this would cause a lot of alerts.

Are you experiencing the same behavior? Any recommendations? I'm looking to hear from a few experts here on the forum.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 14, 2019, 10:21pm UTC](https://discuss.elastic.co/t/logstash-high-cpu-on-startup-190/168490/4 "2019-02-14T22:21:53Z")

</div>

If it is not processing anything I would not expect it to use any CPU unless you have inputs that run on a scheduler. If logs are available to process then by default it will use as many threads as you have CPUs, so it could conceivably max out every CPU if the filters are complex. However, with the configuration you show I would not expect it to use much CPU.

Take a look at the [monitoring APIs](https://www.elastic.co/guide/en/logstash/current/monitoring.html). In particular the stats/process and hot-threads requests.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 14, 2019, 10:21pm UTC](https://discuss.elastic.co/t/logstash-high-cpu-on-startup-190/168490/5 "2019-03-14T22:21:54Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
