tiwanari / isucon2019-qualification

わいわい
0 stars 0 forks source link

当日やること #2

Open tiwanari opened 4 years ago

tiwanari commented 4 years ago

役割分担

とはいえ、みんな協力してやる

tiwanari commented 4 years ago

https://github.com/tiwanari/isucon2017-qualifier/issues/1 からコピー

作業

@tiwanari

  1. rootになって ssh-keygen してrootの鍵を作る

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許可

確実に最初に戻れるようにしておく

$ etckeeper vcs [command] # これで vcs (今回はgit) の command を叩いているのと同じ

e.g.,

$ etckeeper vcs diff HEAD # これで git の diff HEAD と同じ

競技開始!

$ 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

App

DB

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になってた

Server

bash <(curl -Ss https://my-netdata.io/kickstart-static64.sh)

ブラウザで http://サーバのアドレス:19999/ にアクセス

Midleware

plackup -s Gazelle -p 8080 --max-workers=16 --max-reqs-per-child=1000000 app.psgi

General

tiwanari commented 4 years ago

上記で必要なものはスクリプトにして以下においておくと楽そう https://github.com/tiwanari/isucon2019-util

tiwanari commented 4 years ago

ちなみに 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
tiwanari commented 4 years ago

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
tiwanari commented 4 years ago

https://github.com/tiwanari/isucon2019-util を更新した。以下で go の再コンパイルとアプリの再起動がかかり、アクセスログが /home/isucon/logs 以下にはかれる

sudo su isucon
cd /home/isucon/isucon2019-util/pre_bench.sh
tiwanari commented 4 years ago

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

tiwanari commented 4 years ago

.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
tiwanari commented 4 years ago

application サーバをもう一つとりあえず立てた

47.91.19.247(インターネット)
172.24.242.196(プライベート)
Host isucon9-02
 User root
 Hostname 47.91.19.247
 IdentityFile ~/.ssh/isucon-nyan.pem