perf_buff_mgmt_write-2.sh
application/x-sh
Filename: perf_buff_mgmt_write-2.sh
Type: application/x-sh
Part: 1
#Pre condition:
#Create and initialize the database and set the export PGDATA
export PGDATA=/mnt/data-mag/mithun.cy/pgdata
export PGPORT=5432
export LD_LIBRARY_PATH=/mnt/data-mag/mithun.cy/new_bench/pgsql/lib:$LD_LIBRARY_PATH
#for i in "scale_factor shared_buffers time_for_readings no_of_readings orig_or_patch"
for i in "300 8GB 1800 3" "1000 8GB 1800 3"
do
scale_factor=`echo $i | cut -d" " -f1`
shared_bufs=`echo $i | cut -d" " -f2`
time_for_reading=`echo $i | cut -d" " -f3`
no_of_readings=`echo $i | cut -d" " -f4`
# -----------------------------------------------
echo "Start of script for $scale_factor $shared_bufs " >> test_results.txt
echo "============== $run_bin =============" >> test_results.txt
for threads in 1 8 16 24 32 40 48 56 64 72 80 88 96 104 112 120 128
#for threads in 8 16
do
#./pgbench -c $threads -j $threads -T $time_for_reading -S postgres >> test_results.txt
#Start taking reading
for ((readcnt = 1 ; readcnt <= $no_of_readings ; readcnt++))
do
echo "================================================" >> test_results.txt
echo $scale_factor, $shared_bufs, $threads, $threads, $time_for_reading Reading - ${readcnt} >> test_results.txt
#start server
./postgres -c shared_buffers=$shared_bufs -N 200 -c min_wal_size=15GB -c max_wal_size=20GB -c checkpoint_timeout=900 -c maintenance_work_mem=1GB -c checkpoint_completion_target=0.9 &
sleep 5
#drop and recreate database
./dropdb postgres
./createdb postgres
#initialize database
./pgbench -i -s $scale_factor postgres
./psql -d postgres -c "CREATE EXTENSION pg_prewarm"
./psql -d postgres -c "select pg_prewarm('pgbench_accounts')"
sleep 5
# Run pgbench
./pgbench -c $threads -j $threads -T $time_for_reading -M prepared postgres >> test_results.txt
sleep 10
./psql -d postgres -c "checkpoint" >> test_results.txt
./pg_ctl stop
done;
done;
#./psql -d postgres -c "checkpoint" >> test_results.txt
#./pg_ctl stop
sleep 1
mv test_results.txt test_results_list_${scale_factor}_${shared_bufs}_rw.txt
done;