Skip to content

Instantly share code, notes, and snippets.

View tabokie's full-sized avatar
🥶
Slow diving

Xinye Tao tabokie

🥶
Slow diving
View GitHub Profile
#!/bin/bash
## basic spec report
function _io_test()
{
local rw="${1}"
local bs="${2}"
local sec="${3}"
local jobs="${4}"
@tabokie
tabokie / db_bench.20220720.sh
Last active July 21, 2022 09:28
Benchmarks on multiple RocksDB instances with db_bench
export CACHE_SIZE=$((8*1024*1024*1024))
export FILE_SIZE=$((8*1024*1024))
export NUM_DBS=20
export NUM_KEYS=2000000 # ~2GB each DB
# export EXTRAS=--db_write_buffer_size=134217728 # 1/10 of write_buffer_size(64M)*num_dbs
export SUFFIX=vanilla
./db_bench --db=$(pwd)/dbbench --num=${NUM_KEYS} --num_multi_db=${NUM_DBS} --cache_size=${CACHE_SIZE} --key_size=20 --value_size=400 --max_background_jobs=8 --cache_index_and_filter_blocks=true --level_compaction_dynamic_level_bytes=true --target_file_size_base=${FILE_SIZE} --compression_type=lz4 --seed=777 --benchmarks=fillrandom --use_existing_db=0 --sync=0 --threads=${NUM_DBS} --allow_concurrent_memtable_write=false --disable_wal=1 ${EXTRAS} > load.${SUFFIX}.log
du -d1 -h $(pwd)/dbbench >> load.${SUFFIX}.log
#!/bin/sh
if test $# -ne 1; then
echo "Usage: `basename $0 .sh` <process-id>" 1>&2
exit 1
fi
if test ! -r /proc/$1; then
echo "Process $1 not found." 1>&2
exit 1
@tabokie
tabokie / leader
Created December 7, 2021 09:49
oncall-4167
[2021/12/03 10:58:15.059 +08:00] [Info] [raft.rs:1200] ["became leader at term 7"] [term=7] [raft_id=97957681] [region_id=97957472]
[2021/12/03 10:58:15.059 +08:00] [Info] [peer.rs:3771] ["require updating max ts"] [initial_status=30064791044] [region_id=97957472]
[2021/12/03 10:58:15.059 +08:00] [Info] [pd.rs:1271] ["succeed to update max timestamp"] [region_id=97957472]
[2021/12/03 10:58:15.059 +08:00] [Info] [pd.rs:1108] ["try to change peer"] [kind=EnterJoint] [changes="[peer { id: 97957752 store_id: 80511561 }, peer { id: 97957473 store_id: 80511562 role: Learner } change_type: AddLearnerNode]"] [region_id=97957472]
[2021/12/03 10:58:15.062 +08:00] [Info] [pd.rs:1108] ["try to change peer"] [kind=EnterJoint] [changes="[peer { id: 97957752 store_id: 80511561 }, peer { id: 97957473 store_id: 80511562 role: Learner } change_type: AddLearnerNode]"] [region_id=97957472]
[2021/12/03 10:58:15.062 +08:00] [Info] [pd.rs:1108] ["try to change peer"] [kind=EnterJoint] [changes="[peer { id: 97957752 store_id: 805115
@tabokie
tabokie / enfant.sh
Created November 25, 2021 13:21
nemesis.211125
#!/bin/bash
USER_NAME=root
CLUSTER_NAME="tidb-test"
NODES_ADDR=("172.16.6.211" "172.16.6.213" "172.16.6.159" "172.16.4.203" "172.16.5.213")
TIKV_PORT=20160
CLUSTER_STATE="r"
NODES_STATE=( "r" "r" "r" "r" "r" )
#!/bin/bash
# Usage: killer.sh 1s "./do_some_job --some_args"
INTERVAL=$1
COMMAND=$2
i=1
while : ; do
echo "$((i++)) run"
nohup $COMMAND > killee.log 2>&1 &
// nix = "0.18.0"
use nix::{
errno::Errno,
fcntl::{self, OFlag},
sys::{stat::Mode, uio::pwrite},
unistd::{close, fsync},
};
use std::{
alloc::{self, Layout},
mem,
#!/bin/bash
# Usage: analyze_database.sh <IP> <PORT> <DATABASE>
for table in $(mysql -u root -h ${1} -P ${2} -D ${3} -Bse "show tables"); do
echo "analyze table" $table;
mysql -u root -h ${1} -P ${2} -D ${3} -Bse "analyze table $table";
sleep 1;
done
#!/bin/bash
set -ueo pipefail
TEST_DIR=$1
echo "profiling disk mounted on" $TEST_DIR
# Different size, single thread.
max_chunk=4096
chunk=1
#!/bin/bash
set -ueo pipefail
TEST_DIR=$1
echo "benchmark disk mounted on" $TEST_DIR
echo "--> write throughput"
sudo fio --name=disk_benchmark --directory=$TEST_DIR --numjobs=8 \
--size=10G --time_based --runtime=60s --ramp_time=2s --ioengine=libaio \