LoginSignup
8
8

More than 5 years have passed since last update.

ISUCON2 向けのOSの初期設定

Last updated at Posted at 2012-12-26

isucon2 に向けた、 CentOS の競技用チューニング。

SELinux無効

/etc/selinuc/configSELINUX=disabled

iptables切る

/etc/init.d/iptables stop
chkconfig iptables off

カーネルの設定

TCPのチューニングと、カーネルパニックになったら再起動するように。

/etc/sysctl.conf の最後に次のを追記しておく。

net.ipv4.tcp_tw_reuse = 1  # recycle は危険. reuseだけで十分
net.ipv4.tcp_fin_timeout = 2
net.ipv4.tcp_rmem = 16384 131072 262144
net.ipv4.tcp_wmem = 16384 131072 262144
net.ipv4.tcp_mem  = 2048000 4096000 4096000

kernel.panic = 10

再起動もしくは sysctl -p で反映

kernel.panic がこれで反映されるか不明。起動オプションに panic=10 とつけたほうがいいかもしれない。

パッケージ

yum install -y \
  vim screen tmux rsync \
  pcre-devel perf strace gcc kernel-devel kernel-headers \
  apr-util bzip2-devel bzip2 ctags diffutils dstat \
  gcc gdb git httpd-tools man-pages patch pcre-devel \
  sqlite-devel zlib-devel

nginx

1.3.7 を使用。

http {
    open_file_cache max=10000;
    sendfile on;
    …
}

open_file_cache を設定しておくと、ファイルを開き直し&読み直ししないので、statsを含めるとかなりのシステムコールを削減できる。小さい静的ファイルの配信速度がかなり上がるはず。

8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8