1

I think I'm having problem setting up Apache24 correctly. Apache seems to taking up to much RAM, and I'm not sure how to configure it. The FreeBSD server is using 50% of it's swap space.

We are running Magento with MySQL 5.6 on a FreeBSD VPS with 2Gb RAM. The server only have about 500 unique visitors a day.

My knowledge about this is limited. Slightest clue would be much appreciated.

my.cnf

[mysqld]
innodb_buffer_pool_size = 256M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

prefork mpm

<IfModule mpm_prefork_module>
StartServers              3
MinSpareServers           3
MaxSpareServers           6
MaxRequestWorkers         8
MaxConnectionsPerChild 1000
</IfModule>

php.ini

memory_limit = 256M
opcache.enable=1
opcache.memory_consumption=192
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1

htaccess

php_value memory_limit 512M

httpd-default.conf

Timeout 30
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 2

memory usage from top

last pid:  1404;  load averages:  0.56,  0.37,  0.30, up 26+03:37:16  10:28:58
46 processes:  1 running, 45 sleeping
CPU: 31.4% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
Mem: 99M Active, 1397M Inact, 286M Wired, 3808K Cache, 267M Buf, 187M Free
Swap: 2048M Total, 390M Used, 1658M Free, 19% Inuse

PID USERNAME    THR PRI NICE   SIZE    RES STATE   C   TIME    WCPU COMMAND
1404 www           1  20    0   492M 33400K select  1   0:00   0.00% httpd
1403 www           1  20    0   512M 73372K lockf   1   0:01   0.98% httpd
1402 www           1  22    0   508M 69208K lockf   0   0:01   0.00% httpd
1401 root          1  20    0 21916K  2580K CPU0    0   0:00   0.00% top
1394 www           1  27    0   512M 73500K lockf   0   0:04   2.98% httpd
1354 postfix       1  20    0 17260K  2352K kqread  1   0:00   0.00% pickup
1352 www           1  31    0   512M 80004K lockf   1   0:06   1.95% httpd
1326 www           1  20    0   525M 95344K kqread  1   0:15   0.00% httpd
78989 root          1  20    0 31284K  2448K piperd  1   0:01   0.00% rotatelogs
78988 root          1  20    0 31284K  2428K piperd  1   0:04   0.00% rotatelogs
78987 root          1  20    0 31284K  2428K piperd  1   0:00   0.00% rotatelogs
78986 root          1  20    0 31284K  2480K piperd  0   0:00   0.00% rotatelogs
78985 root          1  20    0 31284K  2476K piperd  1   0:00   0.00% rotatelogs
78984 root          1  20    0 31284K  2468K piperd  1   0:00   0.00% rotatelogs
78983 root          1  20    0 31284K  2452K piperd  0   0:00   0.00% rotatelogs
78982 root          1  20    0 31284K  2432K piperd  1   0:00   0.00% rotatelogs
78981 root          1  28    0 31284K  2388K piperd  1   0:00   0.00% rotatelogs
78980 root          1  20    0 31284K  2464K piperd  0   0:00   0.00% rotatelogs
78979 root          1  29    0 31284K  2388K piperd  1   0:00   0.00% rotatelogs
78978 root          1  28    0 31284K  2384K piperd  0   0:00   0.00% rotatelogs
91062 mysql        30  31    0   880M   335M uwait   1 542:10   3.91% mysqld
90944 mysql         1  52    0 17064K     0K wait    1   0:00   0.00% <sh>
90893 root          1  21    0   492M 33112K select  0   1:14   0.00% httpd
17058 root          1  20    0 23572K  3292K pause   1   0:01   0.00% csh
885 root          1  20    0 86472K  2744K select  1   0:04   0.00% sshd
879 root          1  52    0 14488K   960K ttyin   0   0:00   0.00% getty
878 root          1  52    0 14488K   960K ttyin   1   0:00   0.00% getty
877 root          1  52    0 14488K   960K ttyin   1   0:00   0.00% getty
876 root          1  52    0 14488K   960K ttyin   0   0:00   0.00% getty
875 root          1  52    0 14488K   960K ttyin   1   0:00   0.00% getty
874 root          1  52    0 14488K   960K ttyin   0   0:00   0.00% getty
873 root          1  52    0 14488K   960K ttyin   1   0:00   0.00% getty
872 root          1  52    0 14488K   960K ttyin   0   0:00   0.00% getty
822 root          1  20    0 16592K   444K nanslp  1   0:06   0.00% cron
779 root          1  20    0 61204K  2788K select  1   0:00   0.00% sshd
631 postfix       1  20    0 17316K  1296K kqread  1   0:04   0.00% qmgr
629 root          1  20    0 17192K   572K kqread  0   0:10   0.00% master
556 _sphinx       6  20    0 68080K  5632K select  1  36:56   0.00% searchd
555 _sphinx       1  52    0 40572K     0K wait    1   0:00   0.00% <searchd>
506 root          1  20    0 16844K  1232K select  0   0:00   0.00% pure-ftpd
386 root          1  20    0 14500K  1232K select  1   0:05   0.00% syslogd
304 root          1  20    0 13164K    72K select  1   0:01   0.00% devd
134 root          1  52    0 12332K     0K pause   0   0:00   0.00% <adjkerntz>

Thanks in advance,

Aknot
  • 153
  • 1
  • 9
  • It is not normal. But your configs look imho relatively okay. I suggest to try out the "top" tool (similar to the win taskmanager), to find out, what is eating your disk & cpu. Maybe it has some other cause. After that, extend your question what you have seen there. – peterh Jan 21 '15 at 09:23
  • Thanks for your answer Peter, much appreciated. Added top data to my post. Thanks again. – Aknot Jan 21 '15 at 09:32
  • You could make KeepAliveTimeout higher,. In your top output I can see that your system is not in load. Your mysql takes much more resources as your apache, but it is far from an overloaded system. The 300 megs used swap has other reason, I will explain in an answer. Your system is not overloaded. – peterh Jan 21 '15 at 09:52
  • Your top output shows 1.4GB of RAM (68%) inactive, which means it's available for use for any purpose. Why do you think there's a problem? – David Schwartz Jan 21 '15 at 10:44
  • Thanks for your answer David. I'd believed so, because the swap space was occupied by 50% earlier, and because the server doesn't have that many visitors per day. Wrong? – Aknot Jan 21 '15 at 11:29

0 Answers0