I have a problem with one of my servers.
Web server works well in 'normal' time period but one or two times per day there are spikes in RAM memory usage.
I put the Zabbix monitoring tool there, and got something like this from the server.
Those circled spikes are above 90% of RAM utilization that make problems
zabbix_monitoring
Also, I put there my script for memory usage that gives me something like this as output.
8954 elastic+ 20 0 4948244 493160 6788 S 0.0 12.7 9:35.61 java
14076 apache 20 0 703616 275800 6152 S 0.0 7.1 0:05.56 httpd
13498 apache 20 0 703692 275744 6156 S 0.0 7.1 0:06.30 httpd
13441 apache 20 0 703716 275308 6128 S 0.0 7.1 0:06.37 httpd
15730 apache 20 0 703560 275168 6104 S 0.0 7.1 0:05.48 httpd
14068 apache 20 0 703628 275096 6076 S 0.0 7.1 0:05.32 httpd
14501 apache 20 0 703568 275084 6096 S 0.0 7.1 0:05.31 httpd
16593 apache 20 0 701348 272868 5512 S 0.0 7.0 0:04.52 httpd
10515 apache 20 0 700200 271988 6212 S 0.0 7.0 0:12.95 httpd
4571 apache 20 0 441896 14236 6200 S 0.0 0.4 0:04.87 httpd
12083 apache 20 0 441860 12660 6136 S 0.0 0.3 0:02.07 httpd
447 root 20 0 47652 12376 12248 S 0.0 0.3 20:11.71 systemd-jo+
And those apache RAM utilization comes from
14076 14536 7.1 0.2 /usr/sbin/httpd -DFOREGROUND
13498 14536 7.1 0.2 /usr/sbin/httpd -DFOREGROUND
13441 14536 7.0 0.2 /usr/sbin/httpd -DFOREGROUND
15730 14536 7.0 0.5 /usr/sbin/httpd -DFOREGROUND
14068 14536 7.0 0.2 /usr/sbin/httpd -DFOREGROUND
14501 14536 7.0 0.3 /usr/sbin/httpd -DFOREGROUND
16593 14536 7.0 0.9 /usr/sbin/httpd -DFOREGROUND
In normal working conditions, I have this
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
8954 elastic+ 20 0 4938960 471252 12868 S 0.0 12.1 5:01.40 java
23364 mysql 20 0 2894976 423432 2712 S 0.0 10.9 1331:14 mysqld
19880 apache 20 0 647864 219324 6084 S 0.0 5.7 0:06.17 httpd
19475 apache 20 0 446428 17884 6092 S 0.0 0.5 0:03.33 httpd
20327 apache 20 0 442796 13680 6048 S 0.0 0.4 0:00.43 httpd
Is there anything that I can do to prevent these spikes in RAM utilization?
In logs, there are not so unusual requests in those certain time periods.
Plus, if you are interested in my monitoring script written in bash you can clone it from:
https://github.com/milanpetrovic87/ram_memory_mail_notification