0

systemd-journal seems to have hig CPU usage, compare to HAProxy that is the actual service on the node:

385   root      20   0   69948  26152  25776 S   3.0  0.2   0:04.05 systemd-journal
22509 haproxy   20   0   58264   7256   1812 S   1.3  0.0   0:00.45 haproxy

CPU:

vendor_id       : GenuineIntel
cpu family      : 6
model           : 63
model name      : Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz
stepping        : 2
microcode       : 0x25
cpu MHz         : 2400.139
cache size      : 30720 KB

OS:

Linux ip-172-33-30-32.eu-central-1.compute.internal 3.10.0-514.10.2.el7.x86_64 #1 SMP Fri Mar 3 00:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Systemd:

systemd-219-30.el7_3.7.x86_64
systemd-libs-219-30.el7_3.7.x86_64
systemd-sysv-219-30.el7_3.7.x86_64

Is there a way to optimize systemd-journal to have lower CPU usage? Is this supposed to be normal for logging to use this much CPU?

Istvan
  • 2,582
  • 3
  • 22
  • 29
  • 1
    You show no actual evidence of "high CPU usage" of `systemd-journal`. You have one process using 3.0% of one of the 12 cores of that CPU and one that uses 1.3%. The journal has used 4.05 secs CPU time since the start of the system (how long ago was that?) and the `haproxy` a little bit less but it was also started way later (pid 385 vs 22509). So, what is your problem really? – Sven Apr 03 '17 at 08:28
  • I think it is high compare to HAProxy. – Istvan Apr 03 '17 at 08:54
  • Then you have wrong expectations. – Sven Apr 03 '17 at 08:54

1 Answers1

2

Firstly, it doesn't seems much of high cpu-usage.

journald, has a more complex workflow than rsyslogd, since it process and keep the data in a more structured form. If you have very high log output to the journaldby your services, it is normal that journaldis overloaded.

In order to optimize journald; Journald has following settings as defaults within following file:

/etc/sysconfig/journald.conf

   #RateLimitInterval=30s
   #RateLimitBurst=1000

If your service logs are non-critical, you can lower the rate limits to suspend the logs of the service which overloads the journald. It also comes with disadvantage that you may lose your logs. Which you will be notifed by journaldstating the suspended log counts within RateLimitInterval, as an enrty instead of logs which are suspended.

Setting does to "0" will disable suspending, and you will have much higher cpu-usage.

If logs are important for you seperate service logs from journald and use rsyslogd. But again this is not high cpu-usage.

Aesnak
  • 571
  • 4
  • 12