diff --git a/datafusion-partitioned/benchmark.sh b/datafusion-partitioned/benchmark.sh index 2ea923750..34b1130a1 100755 --- a/datafusion-partitioned/benchmark.sh +++ b/datafusion-partitioned/benchmark.sh @@ -6,6 +6,8 @@ bash rust-init.sh -y export HOME=${HOME:=~} source ~/.cargo/env +WITH_SWAP=false + if [ $(free -g | awk '/^Mem:/{print $2}') -lt 12 ]; then echo "LOW MEMORY MODE" # Enable swap if not already enabled. This is needed both for rustc and until we have a better @@ -17,6 +19,7 @@ if [ $(free -g | awk '/^Mem:/{print $2}') -lt 12 ]; then sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile + WITH_SWAP=true fi fi @@ -41,3 +44,9 @@ echo "Run benchmarks for single parquet and partitioned" echo "Load time: 0" echo "Data size: $(du -bcs partitioned | grep total)" + +if [ "$WITH_SWAP" = true ]; then + echo "Disable swap" + sudo swapoff /swapfile + sudo rm /swapfile +fi diff --git a/datafusion/benchmark.sh b/datafusion/benchmark.sh index 82659e7ec..f777b51aa 100755 --- a/datafusion/benchmark.sh +++ b/datafusion/benchmark.sh @@ -6,6 +6,8 @@ bash rust-init.sh -y export HOME=${HOME:=~} source ~/.cargo/env +WITH_SWAP=false + if [ $(free -g | awk '/^Mem:/{print $2}') -lt 12 ]; then echo "LOW MEMORY MODE" # Enable swap if not already enabled. This is needed both for rustc and until we have a better @@ -17,6 +19,7 @@ if [ $(free -g | awk '/^Mem:/{print $2}') -lt 12 ]; then sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile + WITH_SWAP=true fi fi @@ -41,3 +44,9 @@ echo "Run benchmarks" echo "Load time: 0" echo "Data size: $(du -bcs hits.parquet)" + +if [ "$WITH_SWAP" = true ]; then + echo "Disable swap" + sudo swapoff /swapfile + sudo rm /swapfile +fi