echo '1' > '/proc/sys/vm/overcommit_memory'
echo '65535' > '/proc/sys/net/core/somaxconn'
echo 'never' > /sys/kernel/mm/transparent_hugepage/enabled
echo 'never' > /sys/kernel/mm/transparent_hugepage/defrag

for cpu_dir in /sys/devices/system/cpu/cpu[0-9]*
do
	online_file="$cpu_dir"/online
	[ -f "$online_file" ] && [ "$(cat "$online_file")" -eq 0 ] && continue

	file="$cpu_dir"/cpufreq/scaling_governor
	[ -f "$file" ] && echo "performance" > "$file"
done

numactl  --cpunodebind=1  -- /lkp/benchmarks/redis/bin/redis-server --port 6381 --save "" &
numactl  --cpunodebind=0  -- /lkp/benchmarks/redis/bin/redis-server --port 6382 --save "" &
numactl  --cpunodebind=1  -- /lkp/benchmarks/redis/bin/redis-server --port 6383 --save "" &
numactl  --cpunodebind=0  -- /lkp/benchmarks/redis/bin/redis-server --port 6384 --save "" &
/usr/bin/numactl  --all -- numactl --cpunodebind=1 -- redis-benchmark -r 17000000 -n 17000000 -t set,get -d 1024 -c 5 -P 3 -p 6381
/usr/bin/numactl  --all -- numactl --cpunodebind=0 -- redis-benchmark -r 17000000 -n 17000000 -t set,get -d 1024 -c 5 -P 3 -p 6382
/usr/bin/numactl  --all -- numactl --cpunodebind=1 -- redis-benchmark -r 17000000 -n 17000000 -t set,get -d 1024 -c 5 -P 3 -p 6383
/usr/bin/numactl  --all -- numactl --cpunodebind=0 -- redis-benchmark -r 17000000 -n 17000000 -t set,get -d 1024 -c 5 -P 3 -p 6384