Skip to content

Instantly share code, notes, and snippets.

@hoto17296
Last active November 4, 2017 06:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hoto17296/91de0eaf283fc21178305dc45c1d465a to your computer and use it in GitHub Desktop.
Save hoto17296/91de0eaf283fc21178305dc45c1d465a to your computer and use it in GitHub Desktop.
ISUCON 7 予選問題 練習環境構築用 Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.provider "virtualbox" do |vb|
vb.cpus = 1
vb.memory = 1024
# https://github.com/joelhandwell/ubuntu_vagrant_boxes/issues/1
vb.customize ["modifyvm", :id, "--uartmode1", "disconnected"]
end
config.ssh.username = "isucon"
config.ssh.password = "isucon"
[1, 2, 3].each do |i|
config.vm.define "image#{i}" do |image|
image.vm.box = "isucon7q-image"
image.vm.box_url = "https://cdn.hotolab.net/vbox/isucon7q-image.box"
image.vm.network "private_network", ip: "192.168.33.1#{i}"
if i != 3 then
image.vm.provision "shell", inline: <<-SHELL
systemctl disable mysql
sed -ie 's/localhost/192.168.33.13/' /home/isucon/env.sh
SHELL
else
image.vm.provision "shell", inline: <<-SHELL
systemctl disable isubata.python
systemctl disable nginx
SHELL
end
end
end
config.vm.define "bench" do |bench|
bench.vm.box = "isucon7q-bench"
bench.vm.box_url = "https://cdn.hotolab.net/vbox/isucon7q-bench.box"
bench.vm.network "private_network", ip: "192.168.33.10"
end
end
@hoto17296
Copy link
Author

hoto17296 commented Nov 4, 2017

matuu さんの vagrant-isucon/isucon7-qualifier をビルドして、そのビルド済み vbox イメージを CDN に置いて誰でも利用できるようにしたやつ。

動作確認済み環境

  • macOS Sierra
  • VirtualBox 5.1.30
  • Vagrant 2.0.0

メモリを 8GB 積んでるマシンで動かしたが、メモリ 4GB のマシンだと厳しいかもしれない。

起動方法

Vagrantfile を置いたディレクトリで

$ vagrant up

初回起動 (プロビジョニング) 時のみ、起動後に $ vagrant reload で再起動する必要がある。

起動する VM

すべて ユーザ名 isucon パスワード isucon でログインできる。

VM 名 Box IP アドレス デフォルトで起動するサービス
bench isucon7q-bench 192.168.33.10
image1 isucon7q-image 192.168.33.11 nginx, isubata.python
image2 isucon7q-image 192.168.33.12 nginx, isubata.python
image3 isucon7q-image 192.168.33.13 mysql

ベンチマークを実行する

$ vagrant ssh bench でベンチマーカーにログインしてから

$ cd isubata/bench/
$ bin/bench -remotes 192.168.33.11,192.168.33.12 -output result.json

その他の使い方 / レギュレーションなど

isucon/isucon7-qualify: ISUCON7 予選問題の参照実装とベンチマーカー

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