Important
The SingleStore 9.1 release candidate (RC) is available now. It will be promoted to general availability (GA) soon and at that time it will be renamed to SingleStore 10.
In the interim, SingleStore 9.1 RC can be used to preview, evaluate, and provide feedback on the new and upcoming features in SingleStore 10, while SingleStore 9.0 is recommended for production workloads.
Bash
Dependencies
-
singlestoreclient -
Bourne-Again Shell (
bash)
Code
#!/bin/bashMHOST="127.0.0.1"MPORT="3306"MUSER="root"MDB=""NUM_WORKERS=128BATCH_SIZE=256memsql_exec(){singlestore -h $MHOST -P $MPORT -u $MUSER $MDB -e "$1"}memsql_exec_multi(){singlestore -h $MHOST -P $MPORT -u $MUSER $MDB -e \"$(for ((b = 0; b < $BATCH_SIZE; b++)); doecho "$1;"done)"}echo "Creating database test"memsql_exec "CREATE DATABASE IF NOT EXISTS test"MDB="test"echo "Creating table tbl"memsql_exec "CREATE TABLE IF NOT EXISTS tbl (id INT AUTO_INCREMENT PRIMARY KEY)"echo "Launching $NUM_WORKERS workers"sleep 1declare -a WORKERSfor ((worker = 0; worker < $NUM_WORKERS; worker++)); do(while [ 1 ]; doecho "Worker $worker inserting"memsql_exec_multi "INSERT INTO tbl VALUES (NULL)"done) &WORKERS[$worker]=$!donesleep 10for ((worker = 0; worker < $NUM_WORKERS; worker++)); doecho "Killing worker $worker"kill ${WORKERS[$worker]}wait ${WORKERS[$worker]} 2>/dev/nulldoneecho "Cleaning up"sleep 1memsql_exec "DROP DATABASE test"
Last modified: