Open tiwanari opened 4 years ago
https://github.com/tiwanari/isucon2017-qualifier/issues/1 からコピー
@tiwanari
2017は以下を準備できなかったのでやらなかった
1. https://github.com/tiwanari/isucon201-itamae/settings/keys デプロイキー登録
1. git clone git@github.com:tiwanari/isucon2017-itamae.git itamae してclone、itamaeディレクトリに入る
1. sh setup-chef.sh
1. sh run-chef.sh これでみんなのアカウントができるぞ
- azureの設定→セキュリティーグループ編集
- netdata: 受信ポート1999許可
[ ] 初期状態のmysqldumpとる
mysqldump -u root -p -x --all-databases > dump.sql
[ ] etcをgitで管理する
以下の etckeeper コマンド(/etc
のみを対象とする)、sudo がいるかも
$ sudo apt install etckeeper git
$ etckeeper vcs status # "fatal: Not a git repo~" と出るのを確認
$ etckeeper init
$ etckeeper commit -m "first commit"
$ etckeeper vcs remote add origin git@github.com:tiwanari/isucon2017-etc.git
$ etckeeper vcs push -u origin master
$ etckeeper vcs [command] # これで vcs (今回はgit) の command を叩いているのと同じ
e.g.,
$ etckeeper vcs diff HEAD # これで git の diff HEAD と同じ
$ cd /home/isucon/webapp
$ git init
$ git add .
$ git commit -m "first commit"
$ git remote add origin git@github.com:tiwanari/isucon2019-qualification.git
$ git push -u origin master
$ sudo service isuxi.perl stop
$ sudo service isuxi.go start
$ sudo systemctl disable isuxi.perl
$ sudo systemctl enable isuxi.go
ここまで1時間くらいで行きたい
$ sudo service apparmor stop
$ sudo systemctl disable apparmor
[ ] 各テーブルにインデックス追加
[ ] mysql のクエリを解析
[mysqld]
slow_query_log = 1
slow_query_log_file = /var/log/mysql/slow.log
long_query_time = 0 # すべてのクエリを出力
systemctl restart mysql
systemctl restart isuda.xxx # application
[ ] my.cnfのkazeburoチューニング(どこかから取ってきたもの。活用できるかはなぞ…)
key_buffer = 32M
table_open_cache = 256
max_connections = 1024
max_connect_errors = 10000
sort_buffer_size = 1M
read_buffer_size = 1M
myisam_sort_buffer_size = 1M
thread_cache = 256
query_cache_size = 0
query_cache_type = 0
tmp_table_size = 64M
max_heap_table_size = 64M
skip_name_resolve
character_set_server = utf8
default_storage_engine = InnoDB
explicit_defaults_for_timestamp
max_allowed_packet=16M
innodb_file_format=Barracuda
innodb_buffer_pool_size = 5G
innodb_buffer_pool_instances = 4 # 1 for small
innodb_write_io_threads = 8
innodb_read_io_threads = 8
innodb_io_capacity = 2000
※isucon5qはmax_allowed_packetが300Mになってた
bash <(curl -Ss https://my-netdata.io/kickstart-static64.sh)
wget https://github.com/tkuchiki/alp/releases/download/v0.3.1/alp_linux_amd64.zip
unzip alp_linux_amd64.zip
sudo install ./alp /user/local/bin
rm /var/log/nginx/access.log && systectl reload nginx
ブラウザで http://サーバのアドレス:19999/ にアクセス
plackup -s Gazelle -p 8080 --max-workers=16 --max-reqs-per-child=1000000 app.psgi
上記で必要なものはスクリプトにして以下においておくと楽そう https://github.com/tiwanari/isucon2019-util
ちなみに isucon-test サーバの情報
root@ISUCON-test001:~# lsb_release -a
LSB Version: core-9.20170808ubuntu1-noarch:security-9.20170808ubuntu1-noarch
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic
manual https://gist.github.com/sota1235/a7356a5909af264c1c1c840dd216c98f
AccountId: 5984863025015709
InstanceId: i-6we67slarfgfkxdbpldc
ok 1 - InstanceChargeType should be PostPaid
ok 2 - ZoneId should be ap-northeast-1a
ok 3 - InstanceType should be ecs.sn1ne.large
ok 4 - Cpu should be 2 vCPU
ok 5 - Memory should be 4096 MB
ok 6 - InternetChargeType should be PayByTraffic
ok 7 - InternetMaxBandwidthOut should be 100
ok 8 - number of Disks should be 1
ok 9 - Disk Type should be system
ok 10 - Disk Size should be 40 GiB
ok 11 - Disk Category should be cloud_efficiency(Ultra Disk)
1..11
https://github.com/tiwanari/isucon2019-util を更新した。以下で go の再コンパイルとアプリの再起動がかかり、アクセスログが /home/isucon/logs
以下にはかれる
sudo su isucon
cd /home/isucon/isucon2019-util/pre_bench.sh
alibaba cloud の security group というので 19999 を開けて netdata が見えるように https://ecs-ap-northeast-1.console.aliyun.com/?spm=5176.ecsbuyv3.0.0.4f621e13kKBS2c#/securityGroupDetail/region/ap-northeast-1/groupId/sg-6wec2vtjfuynk9gxazl1/rule/intranetIngress http://47.74.9.147:19999
.gitconfig (root)に以下を追加した(エイリアスなくて辛くて…)
[color]
ui = auto
[push]
default = current
[alias]
a = add
st = status
sh = show
d = diff
di = diff
dh = diff HEAD
f = fetch --prune
ls = ls-files -t
cm = commit
cmm = commit -am
co = checkout
l = log
lg = log --graph
lo = log --graph --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(green)- %an, %cr%Creset'
b = branch
ba = branch -a
la = log --oneline --decorate --graph --branches --tags --remotes
application サーバをもう一つとりあえず立てた
47.91.19.247(インターネット)
172.24.242.196(プライベート)
Host isucon9-02
User root
Hostname 47.91.19.247
IdentityFile ~/.ssh/isucon-nyan.pem
役割分担
とはいえ、みんな協力してやる