VPSで契約しているサーバに追加でアプリケーションをインストールできるか調査をしました。
ほとんどアクセスがないのでCPUは問題はありません。
問題があるとすればメモリ容量です。
メモリは各アプリケーションが確保するのでアクセス数に関係なく必要になります。
まずはfreeコマンドで全体を確認します。
$ free total used free shared buffers cached Mem: 1020064 956900 63164 2416 103800 66524 -/+ buffers/cache: 786576 233488 Swap: 2064380 31948 2032432
結果を見ると空きメモリは63MBしかありません。
実際のところはbuffersとcechedを足すので230MBほど空いているということになります。
(63164+103800+66524)
続いてプロセス毎のメモリ使用量をpsコマンドで確認します。
–sortオプションを付けて使用量順にソートします。
$ ps aux --sort -rss USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND apache 11631 0.0 13.5 453312 138356 ? Sl 07:58 0:00 Passenger RubyApp: /var/lib/redmine apache 11614 0.1 11.5 318224 117524 ? Sl 07:58 0:03 Passenger AppPreloader: /var/lib/redmine apache 25059 0.0 5.7 380052 58416 ? S Aug28 0:07 /usr/sbin/httpd apache 22031 0.0 5.4 376624 55160 ? S Aug28 0:08 /usr/sbin/httpd apache 22036 0.0 5.4 376856 55148 ? S Aug28 0:07 /usr/sbin/httpd apache 22037 0.0 5.3 376316 54884 ? S Aug28 0:07 /usr/sbin/httpd apache 22033 0.0 5.3 376480 54780 ? S Aug28 0:08 /usr/sbin/httpd apache 22034 0.0 5.3 376312 54752 ? S Aug28 0:06 /usr/sbin/httpd apache 22030 0.0 5.1 374616 52796 ? S Aug28 0:07 /usr/sbin/httpd apache 25058 0.0 4.8 362892 49264 ? S Aug28 0:05 /usr/sbin/httpd apache 22035 0.0 4.6 361388 47920 ? S Aug28 0:05 /usr/sbin/httpd apache 25060 0.0 4.2 356296 42956 ? S Aug28 0:04 /usr/sbin/httpd apache 22032 0.0 3.8 352248 39120 ? S Aug28 0:08 /usr/sbin/httpd apache 25005 0.0 3.3 347760 34380 ? S Aug28 0:06 /usr/sbin/httpd root 13320 0.0 1.6 327292 17184 ? Ss Jun02 3:59 /usr/sbin/httpd mysql 1625 0.0 1.5 1170944 15316 ? Sl May12 34:34 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql root 22001 0.0 0.8 996136 8736 ? Sl Aug28 0:29 Passenger core nobody 22010 0.0 0.6 438340 6404 ? Sl Aug28 0:05 Passenger ust-router postgres 11638 0.0 0.6 218116 6392 ? Ss 07:58 0:00 postgres: redmine redmine ::1(48695) idle postgres 11621 0.0 0.6 218044 6140 ? Ss 07:58 0:00 postgres: redmine redmine ::1(48694) idle root 21995 0.0 0.4 427848 4236 ? Ssl Aug28 0:01 Passenger watchdog root 12277 0.0 0.3 99968 4076 ? Ss 08:23 0:00 sshd: root@pts/0 root 1217 0.0 0.3 256260 3788 ? Sl May12 0:22 /sbin/rsyslogd -i /var/run/syslogd.pid -c 5 postfix 11437 0.0 0.3 80952 3400 ? S 07:24 0:00 pickup -l -t fifo -u
redmineのプロセスがが大きくメモリを使用しています。
下記のようにredmineの設定ファイルを消し、apacheを再起動します。
$ cd /etc/httpd
$ mv conf.d/redmine.conf /tmp/
$ /etc/init.d/httpd restart
再度メモリ使用量を確認します。
$ free
total used free shared buffers cached
Mem: 1020064 291232 728832 2376 96292 71724
-/+ buffers/cache: 123216 896848
Swap: 2064380 29772 2034608
メモリの空容量が900MB(728832+96292+71724)と大きく増えました。
なお、Redmineは600MBほど使用していたようです、