Mik*_*Do- 6 centos memory-usage systemd journald
I have an AWS EC2 instance running a CentOS 7.7.1908 (systemd 219) with a server application. The server logs quite a lot of information to the system logs (using syslog).
I have recently enabled persistent storage of the system logs using this answer. Since then, the memory consumption of systemd-journald is constantly growing.
After a full day, systemd-journald
ends up using more than 250M of RAM.
我做了一个快速测试来确认 Journald RAM 使用量实际上在增长。
测试 :
systemd-journald
内存使用情况logger
systemd-journald
内存使用情况journalctl --flush
systemd-journald
服务systemd-journald
内存使用情况结果 :
# ps aux | grep journald | grep -v grep
root 23963 0.0 0.1 61320 2500 ? Ss 15:03 0:00 /usr/lib/systemd/systemd-journald
# for i in {0..7000}; do logger -t TEST -p err `python -c 'print "A"*1000'`; done;
# ps aux | grep journald | grep -v grep
root 23963 0.1 0.2 69512 11964 ? Ss 15:08 0:00 /usr/lib/systemd/systemd-journald
# journalctl --flush
# ps aux | grep journald | grep -v grep
root 23963 0.1 0.2 69512 11964 ? Ss 15:08 0:00 /usr/lib/systemd/systemd-journald
# systemctl restart systemd-journald
# ps aux | grep journald | grep -v grep
root 24237 0.0 0.1 55416 2492 ? Ss 15:08 0:00 /usr/lib/systemd/systemd-journald
Run Code Online (Sandbox Code Playgroud)
记录大约 7M 的数据后,内存使用量从 2.5M 增加到近 12M。重新启动守护进程会使内存使用量恢复到约 2.5M。
我的解释:
systemd-journald
内存使用量与其处理的数据量成正比。RuntimeMaxUse
不限制此内存使用。systemd-journald
会清除缓冲区,但我无法配置其大小。systemd-journald
。我的journald.conf:
[Journal]
#Storage=auto # /var/log/journal is created and used, so this is equivalent to 'Persistent'
SyncIntervalSec=1m
RateLimitInterval=0
RateLimitBurst=0
SystemMaxUse=4G
RuntimeMaxUse=1M
Run Code Online (Sandbox Code Playgroud)
如何解决这个“泄漏”而不需要每天重新启动服务呢?
归档时间: |
|
查看次数: |
3482 次 |
最近记录: |