Skip to content

Instantly share code, notes, and snippets.

@matsuu
matsuu / README.md
Last active May 4, 2022 12:24
Apple Silicon搭載macでISUCON11予選環境を構築する

Apple Silicon搭載macでISUCON11予選環境を構築する

aarch64に対応しているのでApple Silicon上のLinux環境でも構築できるはずです。

Arm版Ubuntu 20.04環境を用意する

Apple Silicon環境のmacOSでは2022年5月時点で次のような選択肢があります。

@matsuu
matsuu / settings.json
Last active May 11, 2022 15:16
PaperColor Theme for Windows Terminal based on https://github.com/marhs/material-terminator
{
"name": "PaperColor Light",
"cursorColor": "#25C3DC",
"foreground": "#3c3c3b",
"background": "#eeeeee",
"black": "#2c2c2c",
"red": "#d7005f",
"green": "#718c00",
"yellow":"#ff8f01",
"blue": "#005f87",
@matsuu
matsuu / remove-ansi-escape-sequence
Last active April 20, 2022 22:42 — forked from hiono/remove-ansi-escape-sequence
ANSIエスケープシーケンスを除去する
alias rmescseq='sed -r "s:\x1B\[[0-9;]*[lmsK]::g"'
@matsuu
matsuu / .gitmessage
Last active January 15, 2022 11:51 — forked from lisawolderiksen/git-commit-template.md
git config --global commit.template ~/.gitmessage
# 件名: 概要、命令形、大文字で始めるがピリオドは使わない
# 半角幅50文字以内におさめる。50文字はここまで-->#
# 件名と本文の間に空白行を入れる
# 本文: howではなくwhatとwhyを書くこと。issue IDなども記載する。
# 1行あたり半角幅72文字で折り返す。72文字はここまで------------------->#
# 最後に空白行を入れてからこのコミットの共作者を Co-authored-by として列挙する。
# Co-authored-by: Taro Git <taro@example.com>
package main
import (
"fmt"
"log"
"time"
"github.com/zserge/hid"
)
Total DISK READ: 0.00 B/s | Total DISK WRITE: 705.46 K/s
Current DISK READ: 0.00 B/s | Current DISK WRITE: 0.00 B/s
PID PRIO USER DISK READ DISK WRITE SWAPIN IO COMMAND
98 be/4 vcache 0.00 B/s 313.54 K/s 0.00 % 0.00 % varnishd -j unix,user=vcache -F -a /dev/shm/varnish.sock,user=www-data,group=www-data,mode=660 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
12721 be/4 www-data 0.00 B/s 78.38 K/s 0.00 % 0.00 % nginx: worker process
12722 be/4 www-data 0.00 B/s 156.77 K/s 0.00 % 0.00 % nginx: worker process
12723 be/4 www-data 0.00 B/s 156.77 K/s 0.00 % 0.00 % nginx: worker process
1 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % systemd --system-unit=basic.target
2 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % su - isucon
3 be/4 isucon 0.00 B/s 0.00 B/s 0.00 % 0.00 % -bash
----system---- ---load-avg--- --total-cpu-usage-- -dsk/total- -net/total- ---paging-- ---system-- ------memory-usage----- ---procs---
time | 1m 5m 15m |usr sys idl wai stl| read writ| recv send| in out | int csw | used free buff cach|run blk new
31-08 23:11:44|0.25 0.53 1.32| 2 0 98 0 0| 35k 409k| 0 0 | 0 0 | 353 1265 |2720M 7430M 461M 2302M|2.0 1.0 0.3
31-08 23:11:45|0.23 0.52 1.31| 1 1 97 1 0|8192B 5048k| 0 0 | 0 0 |1107 2927 |2715M 7435M 462M 2301M| 0 0 0
31-08 23:11:46|0.23 0.52 1.31| 0 0 100 0 0| 0 1884k| 0 0 | 0 0 | 128 452 |2714M 7435M 462M 2301M| 0 0 0
31-08 23:11:47|0.23 0.52 1.31| 0 0 100 0 0| 0 0 | 0 0 | 0 0 | 80 403 |2714M 7435M 462M 2301M| 0 0 0
31-08 23:11:48|0.23 0.52 1.31| 0 1 99 0 0| 0 20k| 0 0 | 0 0 | 101 533 |2716M 7434M 462M 2301M| 0 0 0
31-08 23:11:49|0.23 0.52 1.31| 4 1 96 0 0| 0 1996k| 0 0 | 0 0 |
----system---- ---load-avg--- --total-cpu-usage-- -dsk/total- -net/total- ---paging-- ---system-- ------memory-usage----- ---procs---
 time | 1m   5m  15m |usr sys idl wai stl| read  writ| recv  send| in   out | int   csw | used  free  buff  cach|run blk new
31-08 22:59:13|0.59 1.34 1.77| 2  0  98  0  0
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 10 columns, instead of 9. in line 5.
cnt sum min avg max sumLock sumRows avgRows db digest
2652 49.9726991 0.0002634 0.0188434 0.5659351 9.04831 0 0.0000 isucondition INSERT INTO `isu_condition` ( `jia_isu_uuid` , `timestamp` , `is_sitting` , `condition` , `message` ) VALUES (...) /* , ... */
38616 23.6343877 0.0001812 0.000612036 0.0238742 3.517377 770877 19.9626 isucondition SELECT * FROM `isu_condition` WHERE `jia_isu_uuid` = ? AND `timestamp` < ? ORDER BY `timestamp` DESC LIMIT ?
22043 7.8235772 0.0001151 0.000354923 0.0676955 1.608543 21699 0.9844 isucondition SELECT `jia_isu_uuid` , `timestamp` , `is_sitting` , `condition` , `condition_level` , `message` FROM `isu_condition` WHERE `jia_isu_uuid` = ? ORDER BY `timestamp` DESC LIMIT ?
4277 5.5938873 0.0001583 0.001307899 0.0202111 0.402669 1463878 342.2675 isucondition SELECT `timestamp` , `condition` , `is_sitting` FROM `isu_condition` WHERE `jia_isu_uuid` = ? AND `timestamp` BETWEEN ? AND ? ORDER BY `timestamp` ASC
13317 4.8538362 0.0001058 0.000364484 0.0196072 0.914678 13141 0.9868 i
@matsuu
matsuu / Vagrantfile
Created August 22, 2021 13:17
ISUCON11予選の試作Vagrantfile(bench周りがまだ動かない)
# -*- mode: ruby -*-
# vi: set ft=ruby :
box = "ubuntu/focal64"
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|