Skip to content

Instantly share code, notes, and snippets.

@koemu
Last active September 26, 2015 01:01
Show Gist options
  • Save koemu/f7bc923918d687cc3a67 to your computer and use it in GitHub Desktop.
Save koemu/f7bc923918d687cc3a67 to your computer and use it in GitHub Desktop.
ISUCON3 過去問 個人演習

選択言語: go

  • 処理系バージョンアップ無し
  • ミドルウェア nginxのみ最新(1.9.4), mysqlはインストール済みのものを利用

initial

Result:   SUCCESS
RawScore: 2632.6
Fails:    12
Score:    500.2

update sysctl.conf

秘伝のタレ

Result:   SUCCESS
RawScore: 2810.6
Fails:    0
Score:    2810.6

update GOMAXPROCS=4

(ソース良く見たらここは設定されていてやる必要がなかった)

Result:   SUCCESS
RawScore: 2717.2
Fails:    0
Score:    2717.2

update my.cnf

秘伝のタレ

Result:   SUCCESS
RawScore: 2924.0
Fails:    0
Score:    2924.0

create index to memos(user, is_private)

pt-query-digest

Result:   SUCCESS
RawScore: 3439.7
Fails:    0
Score:    3439.7

create index idx_memos_2 on memos (is_private);

pt-query-digest

Result:   SUCCESS
RawScore: 3201.2
Fails:    0
Score:    3201.2

drop index idx_memos_2 on memos;

enable query cache

Result:   SUCCESS
RawScore: 3759.1
Fails:    0
Score:    3759.1

mysqltuner.pl -> innodb_buffer_pool_instances=10, thread_cache_size=16

Result:   SUCCESS
RawScore: 3743.7
Fails:    0
Score:    3743.7

disable mysql memcached plugin

Result:   FAIL
RawScore: 2820.1
Fails:    36
Score:    0.0

reinstall memcached

Result:   SUCCESS
RawScore: 3489.7
Fails:    0
Score:    3489.7

※答えあわせの際にわかったこと: memcachedのプロセスは11212で動いていた。変だなと思って入れ直さなくてもよかった。

change markdown processling logic

Result:   SUCCESS
RawScore: 5240.5
Fails:    0
Score:    5240.5

update httpd mpm_prefork procs = 30

Result:   SUCCESS
RawScore: 4181.5
Fails:    0
Score:    4181.5

create index idx_memos_2 on memos (is_private, created_at)

Result:   SUCCESS
RawScore: 4488.6
Fails:    0
Score:    4488.6

update httpd mpm_prefork procs = 64

Result:   SUCCESS
RawScore: 5292.1
Fails:    0
Score:    5292.1

switch apache to nginx

Result:   SUCCESS
RawScore: 5400.8
Fails:    0
Score:    5400.8

re: create index idx_memos_1 on memos (user, created_at)

pt-query-digest

Result:   SUCCESS
RawScore: 6150.5
Fails:    0
Score:    6150.5

re: create index idx_memos_2 on memos (is_private, created_at, id)

pt-query-digest

Result:   SUCCESS
RawScore: 5881.2
Fails:    0
Score:    5881.2

through image, js, css

https://github.com/matsuu/kataribe

Result:   SUCCESS
RawScore: 6048.3
Fails:    0
Score:    6048.3

improvement toppage cache

https://github.com/matsuu/kataribe

Result:   SUCCESS
RawScore: 6192.7
Fails:    0
Score:    6192.7

log off + workload = 4

Result:   SUCCESS
RawScore: 6437.5
Fails:    0
Score:    6437.5

benchmarkが走るときにIndexが消えるのを忘れてたので作るようにしたら

(ログを見ると静的ファイルの取得にも失敗していて、ulimit越えが疑われる。)

Result:   FAIL
RawScore: 9170.0
Fails:    47
Score:    0.0

fs.file-max = 65536, ulimit = 65536, worker_rlimit_nofile = 10240 に更新

(時計はawsなので日本時間とは違う)

$ sudo isucon3 benchmark -workload=4 -init="/home/isucon/webapp/init.sh"
2015/09/09 17:18:14 <<<DEBUG build>>>
2015/09/09 17:18:14 benchmark mode
2015/09/09 17:18:14 initialize data...
2015/09/09 17:18:34 run /home/isucon/webapp/init.sh timeout 60 sec...
2015/09/09 17:18:34 done
2015/09/09 17:18:34 sleeping 5 sec...
2015/09/09 17:18:39 run benchmark workload: 4
2015/09/09 17:18:41 [FAIL] total not changed
2015/09/09 17:18:41 [FAIL] total not changed
2015/09/09 17:18:42 [FAIL] total not changed
2015/09/09 17:18:42 [FAIL] total not changed
2015/09/09 17:19:40 done benchmark
Result:   SUCCESS
RawScore: 10908.8
Fails:    4
Score:    10799.7

mutexあたりにバグ抱えてそう。エラーが、毎度3〜4回出ていた。

CPUは使い切っていた。ただ、MySQLがボトルネックになっているのは最後まで解消できず。2万点越えはこの辺りの実装をガッツリ書き換えているらしい。

http://isucon.net/archives/32951235.html

夜遅くなったのでおしまい。所要時間: 3時間30分。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment