bin/: Misc scriptsbenchmarker/: Benchmarkerdocs/: Rules and Task descriptionspacker/: Packer & itamae manifests for machine imageproto/: protobuf source fileswebapp/: Task web application (XSUCON Portal)go get google.golang.org/protobuf/cmd/protoc-gen-go)go get google.golang.org/grpc/cmd/protoc-gen-go-grpc)You need a wildcard TLS certificate or a TLS certificate for at least 2 subjects, for the following purposes:
Obtain and place it at secrets/cert.pem and secrets/key.pem.
cd webapp/frontend
yarn
yarn build
cd benchmarker
make
./bin/benchmarker \
-exit-status \
-target app.t.isucon.dev:3000 \
-host-advertise local.t.isucon.dev \
-tls-cert ../secrets/tls-cert.pem \
-tls-key ../secrets/tls-key.pem
-target as you want.-tls if the target is serving HTTPS.*.t.isucon.dev always points localhost.Edit packer/files/itamae/cookbooks/isucon-user/default.rb to embed ssh public keys in advance. You don't need this when building a EC2 AMI.
cd packer/
# Build Amazon EC2 AMI
make build-full-ec2
# Build QEMU qcow2
make build-full-qemu
Boot built image on QEMU(Virtualbox) or EC2.
ubuntu userisucon userYou need to add names to /etc/hosts for connecting app from benchmarker & connecting app to benchmarker WebPush service. Assume you have a *.t.isucon.dev TLS certificate, you can add the followings:
app.t.isucon.dev 127.0.0.1
bench.t.isucon.dev 127.0.0.1
sudo vim /etc/systemd/system/contestant.slice
sudo vim /etc/systemd/system/benchmarker.slice
sudo systemctl daemon-reload
sudo systemctl restart contestant.slice benchmarker.slice
CPUWeight= and add AllowedCPUs= if you want to dedicate specific CPU cores to services. See systemd.resource-control(5) for details.Follow the task description. By default, all implementations are disabled, so you need to enable them and start:
sudo systemctl enable --now xsuportal-api-ruby.service xsuportal-web-ruby.service
As a isucon user, run:
sudo systemd-run \
--working-directory=/home/isucon/benchmarker \
--pipe \
--wait \
--collect \
--uid=$(id -u)\
--gid=$(id -g) \
--slice=benchmarker.slice \
--service-type=oneshot \
-p AmbientCapabilities=CAP_NET_BIND_SERVICE \
-p CapabilityBoundingSet=CAP_NET_BIND_SERVICE \
-p LimitNOFILE=2000000 \
-p TimeoutStartSec=110s \
~isucon/benchmarker/bin/benchmarker \
-exit-status \
-tls \
-target app.t.isucon.dev:443 \
-host-advertise bench.t.isucon.dev \
-push-service-port 1001 \
-tls-cert /etc/ssl/private/tls-cert.pem \
-tls-key /etc/ssl/private/tls-key.pem \
(Adjust -target and -host-advertise as your domain names)
MIT License unless otherwise specified