ISUCON - arosh/arosh.github.com GitHub Wiki
http://qa.atmarkit.co.jp/q/2923
MySQLの設定
https://yakst.com/en/posts/200
5.6以降が高速で良い
innodb_flush_log_at_trx_commit
- 0: 最も高速.MySQLのクラッシュによってデータが消失する可能性がある.
- 1: デフォルト.最も低速.最もデータが安全.
- 2: 中間の速度.OSのクラッシュや停電によってデータが消失する可能性がある.
http://tech.g.hatena.ne.jp/rx7/20110211/p1
「『OSのクラッシュや停電によってデータが消失する可能性がある』って当たり前やん。1と2で違いあるん?」と一瞬思ったが,おそらくACIDのD (durability, 永続性) のこと。1は書き込みが完了したデータは安全と言っているが,2は書き込みが完了したデータでも消失の危険が微粒子レベルで存在するという意味っぽい。
1と2は3倍程度の差があるらしい.ISUCONなら0で良さそう.
MySQL設定ファイルの罠
http://gihyo.jp/dev/serial/01/MySQL-tuning-scale/0003
- my.cnfは複数存在する。後から読み込まれたファイルが優先
- 全ユーザが書き換え可能な設定ファイルは読み込まない
http://www.slideshare.net/tmtm/nseg49-mysql
Gunicorn
http://docs.gunicorn.org/en/stable/settings.html
CPUを使い切るのが必ずしも良いとは限らない。1から順に増やしていくべき。
MeilheldというWebサーバを使うと若干スコアが向上した
Nginx
http://imoz.jp/note/isucon7-prep.html
# http://kazeburo.hatenablog.com/entry/2014/10/14/170129
# https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/frameworks/Python/bottle/nginx.conf
# http://docs.gunicorn.org/en/stable/deploy.html
# https://speakerdeck.com/cubicdaiya/nginxfalsepahuomansutiyuningu
events {
worker_connections 10240;
accept_mutex_delay 100ms;
}
http {
include mime.types;
default_type application/octet-stream;
log_format with_time '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" $request_time';
# access_log off;
access_log /var/log/nginx/access.log with_time;
sendfile on;
open_file_cache max=100 inactive=20s;
tcp_nopush on;
keepalive_timeout 65;
upstream app {
server unix:/dev/shm/app.sock;
}
server {
location / {
proxy_pass http://app;
}
location ~ ^/(css|fonts|js)/ {
root /home/isucon/webapp/static;
}
}
}