View conntrack.go
package main
import (
"bufio"
"fmt"
"log"
"net"
"os"
"strings"
)
View on_remote.sh
#!/bin/bash
set -e -o pipefail
DEPLOY_TO='operationserver'
CMD="$@"
if [ -z "${CMD}" ]; then
echo "CMD required" 1>&2
exit 1
View gist:aef3b7c91f23d1f02aaa266ebe858383
# 310ms user time, 10ms system time, 30.65M rss, 98.40M vsz
# Current date: Sun Sep 27 15:37:00 2015
# Hostname: isucon01
# Files: /var/lib/mysql/mysqld-slow.log
# Overall: 334 total, 17 unique, 0.48 QPS, 0.16x concurrency _____________
# Time range: 2015-09-27 15:23:56 to 15:35:33
# Attribute total min max avg 95% stddev median
# ============ ======= ======= ======= ======= ======= ======= =======
# Exec time 114s 55ms 4s 343ms 945ms 354ms 253ms
# Lock time 295ms 30us 98ms 883us 159us 7ms 49us
View prebench.sh
#!/bin/bash
set -ex
if [ -f /var/lib/mysql/mysqld-slow.log ]; then
sudo mv /var/lib/mysql/mysqld-slow.log /var/lib/mysql/mysqld-slow.log.$(date "+%Y%m%d_%H%M%S")
fi
if [ -f /var/log/nginx/isucon5.access_log.tsv ]; then
sudo mv /var/log/nginx/isucon5.access_log.tsv /var/log/nginx/isucon5.access_log.tsv.$(date "+%Y%m%d_%H%M%S")
fi
sudo systemctl restart mysql
View deploy.sh
#!/bin/bash
set -ex
IPADDR=$1
USERNAME=$USER
ssh isucon@$IPADDR "/home/isucon/notify.sh $USERNAME 'deploying...' && cd /home/isucon/deploy && git pull && ~/.local/perl/bin/carton install && sudo systemctl restart mysql && sudo service memcached restart && sudo systemctl restart isuxi.perl && sudo systemctl restart nginx && sudo sysctl -p && /home/isucon/notify.sh $USERNAME 'deploy done'"
View eachfork-ab
yuukit@syscall01:~/perl$ ab -n 100000 -c 5 http://10.240.0.7:10020/
This is ApacheBench, Version 2.3 <$Revision: 1604373 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 10.240.0.7 (be patient)
Completed 10000 requests
Completed 20000 requests
Completed 30000 requests
Completed 40000 requests
View each-fork-perl
[y_uuki@ ~]$ ab -n 5000 -c 20 http://localhost:10020/
This is ApacheBench, Version 2.3 <$Revision: 1604373 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Completed 500 requests
Completed 1000 requests
Completed 1500 requests
Completed 2000 requests
View client
$ telnet yuuki.hhh 10020
Trying x.x.x.x...
Connected to yuuki.h.h.
Escape character is '^]'.
hoge
hoge
^]
View uninstall_rbenv_rubies.sh
#!/bin/bash
for v in $(rbenv versions --bare); do
rbenv uninstall -f $v
rbenv install $v
rbenv global $v
rbenv exec gem install capistrano --no-ri --no-rdoc --version "=2.15.5"
rbenv exec gem install git-browse-remote --no-ri --no-rdoc
done