ウェブサーバが死ぬほど重い。
$ ps aux | grep httpd
apache 1858 0.6 0.5 550496 10276 ? D 02:11 0:11 /usr/sbin/httpd -DFOREGROUND
apache 2435 0.6 0.5 548368 11040 ? D 02:22 0:08 /usr/sbin/httpd -DFOREGROUND
apache 2502 0.7 0.5 555208 10348 ? D 02:22 0:08 /usr/sbin/httpd -DFOREGROUND
apache 2524 0.7 0.4 555156 9992 ? D 02:22 0:08 /usr/sbin/httpd -DFOREGROUND
apache 2531 0.7 0.6 550268 12760 ? R 02:22 0:08 /usr/sbin/httpd -DFOREGROUND
apache 2572 0.7 0.5 628736 10716 ? D 02:23 0:08 /usr/sbin/httpd -DFOREGROUND
apache 2587 0.7 0.7 525836 15772 ? D 02:23 0:08 /usr/sbin/httpd -DFOREGROUND
apache 2604 0.7 0.4 554872 9216 ? D 02:24 0:08 /usr/sbin/httpd -DFOREGROUND
apache 2693 0.7 0.5 552356 12200 ? R 02:26 0:08
$ free -h
total used free shared buff/cache available
Mem: 2.0G 1.9G 51M 396K 40M 15M
Swap: 4.0G 4.0G 0B
apacheがなんかすごいことになってる。慌ててとめた。
$ sudo systemctl stop httpd
$ free -h
total used free shared buff/cache available
Mem: 2.0G 177M 1.7G 452K 102M 1.7G
Swap: 4.0G 219M 3.8G
$ uptime
02:52:22 up 2733 days, 15:19, 1 user, load average: 6.50, 96.16, 112.19
すぐ落ち着いた。
どうも米国のセキュリティ会社からの大規模なポートスキャンであっぷあっぷになったらしい。そのIPをdropする。
そしてApachのプロセス数を20で打ち切る。
sudo vi /etc/httpd/conf.d/mpm_prefork.conf
以下の中身を書く。
<IfModule mpm_prefork_module>
StartServers 3
MinSpareServers 3
MaxSpareServers 5
MaxRequestWorkers 20
MaxConnectionsPerChild 1000
</IfModule>
再起動。
$ sudo apachectl configtest
Syntax OK
$ sudo systemctl start httpd
これで大丈夫。
GitHub演習のレポート採点。第二回と第三回。
K-LMSに手書きで提出されたレポートをマウスで選択、コピーできることに気がついた。OCR標準装備だったのか。