# High CPU usage for filebeat under 9000+/sec logs

**URL:** https://discuss.elastic.co/t/high-cpu-usage-for-filebeat-under-9000-sec-logs/45313
**Category:** Beats
**Created:** [March 24, 2016, 8:44am UTC](https://discuss.elastic.co/t/high-cpu-usage-for-filebeat-under-9000-sec-logs/45313 "2016-03-24T08:44:03Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Chen\_Jian](https://avatars.discourse-cdn.com/v4/letter/c/c89c15/32.png) [@Chen\_Jian](https://discuss.elastic.co/u/Chen_Jian)
#### Post date: [March 24, 2016, 8:44am UTC](https://discuss.elastic.co/t/high-cpu-usage-for-filebeat-under-9000-sec-logs/45313/1 "2016-03-24T08:44:03Z")

</div>

I have use filebeats to collect logs and sent to kafka.  
1000 /sec, the cpu usage is 4%.  
9000+ /sec, the CPU usage reach to 500+%.  
AWS ec2 with 24 core.

---

<div class="post-metadata">

### Author: ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)
#### Post date: [March 24, 2016, 10:36am UTC](https://discuss.elastic.co/t/high-cpu-usage-for-filebeat-under-9000-sec-logs/45313/2 "2016-03-24T10:36:41Z")

</div>

can you share your filebeat config please? Any filebeat log?

---

<div class="post-metadata">

### Author: ![Chen\_Jian](https://avatars.discourse-cdn.com/v4/letter/c/c89c15/32.png) [@Chen\_Jian](https://discuss.elastic.co/u/Chen_Jian)
#### Post date: [March 25, 2016, 2:32am UTC](https://discuss.elastic.co/t/high-cpu-usage-for-filebeat-under-9000-sec-logs/45313/3 "2016-03-25T02:32:22Z")

</div>

fielbeat config

filebeat:  
# List of prospectors to fetch data.  
prospectors:

```
    - input_type: log

    
      paths:
        - /opt/xxxx.log
    
      tail_files: true

    
output:
  kafka:
    hosts: ["foo.com:9092"]
    topic: "foo_staging"
    use_type: false
    client_id: "tests"
    # The number fo workers to use for this output
    worker: 2
    # The maximum number of events to bulk in a single request.
    bulk_max_size: 16384
    # The number of seconds to wait for responses from the kafka brokers before timing out.
    broker_timeout: "30s"
    # KeepAlive specifies the keep-alive period for an active network connection. If zero, keep-alives are disabled. (default is 0: disabled).
    keep_alive: 0
    # The maximum amount of time the server will wait for acknowledgments from followers to meet the acknowledgment requirements the producer has specified with the acks configuration
    timeout: 30
    # ACK reliability level required from broker. 0=no response, 1=wait for local commit, -1=wait for all replicas to commit. The default is 1.
    required_acks: 0
    # The number of seconds to wait for new events between two producer API calls.
    flush_interval: 5

logging:

  files:
  
    rotateeverybytes: 10485760 # = 10MB
```

---

<div class="post-metadata">

### Author: ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)
#### Post date: [March 29, 2016, 11:47am UTC](https://discuss.elastic.co/t/high-cpu-usage-for-filebeat-under-9000-sec-logs/45313/4 "2016-03-29T11:47:56Z")

</div>

The higher the throughput, the higher CPU usage due to filebeat reading + encoding more lines. But I've no idea what's going on here or any of your test setup.

You have one filebeat sending to how many kafka nodes? How many partitions does your topic have?

How do you measure throughput and generate different loads? (1000/sec vs 9000+/sec ?)

can you set warning level in filebeat.yml and check log file for any errors/warning?

having set `worker: 2` configures filebeat to double the number of kafka clients + worker routines doing IO.

---

<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: [July 5, 2017, 9:54pm UTC](https://discuss.elastic.co/t/high-cpu-usage-for-filebeat-under-9000-sec-logs/45313/5 "2017-07-05T21:54:05Z")

</div>


