diff --git a/packages/@n8n/benchmark/scripts/bootstrap.sh b/packages/@n8n/benchmark/scripts/bootstrap.sh index 87f2c8d6ac..c5a8b57db5 100644 --- a/packages/@n8n/benchmark/scripts/bootstrap.sh +++ b/packages/@n8n/benchmark/scripts/bootstrap.sh @@ -37,6 +37,18 @@ else sudo chown -R "$CURRENT_USER":"$CURRENT_USER" /n8n fi +### Remove unneeded dependencies +# TTY +sudo systemctl disable getty@tty1.service +sudo systemctl disable serial-getty@ttyS0.service +# Snap +sudo systemctl disable snapd.service +sudo apt remove snapd +# Unattended upgrades +sudo systemctl disable unattended-upgrades.service +# Cron +sudo systemctl disable cron.service + # Include nodejs v20 repository curl -fsSL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh sudo -E bash nodesource_setup.sh diff --git a/packages/@n8n/benchmark/scripts/run-in-cloud.mjs b/packages/@n8n/benchmark/scripts/run-in-cloud.mjs index 35e90bdee5..c61c0901d4 100755 --- a/packages/@n8n/benchmark/scripts/run-in-cloud.mjs +++ b/packages/@n8n/benchmark/scripts/run-in-cloud.mjs @@ -78,6 +78,12 @@ async function runBenchmarksOnVm(config, benchmarkEnv) { const bootstrapScriptPath = path.join(scriptsDir, 'bootstrap.sh'); await sshClient.ssh(`chmod a+x ${bootstrapScriptPath} && ${bootstrapScriptPath}`); + // Benchmarking the VM + const vmBenchmarkScriptPath = path.join(scriptsDir, 'vm-benchmark.sh'); + await sshClient.ssh(`chmod a+x ${vmBenchmarkScriptPath} && ${vmBenchmarkScriptPath}`, { + verbose: true, + }); + // Give some time for the VM to be ready await sleep(1000); diff --git a/packages/@n8n/benchmark/scripts/vm-benchmark.sh b/packages/@n8n/benchmark/scripts/vm-benchmark.sh new file mode 100644 index 0000000000..6bf215cd67 --- /dev/null +++ b/packages/@n8n/benchmark/scripts/vm-benchmark.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Install fio +sudo apt-get -y install fio > /dev/null + +# Run the disk benchmark +fio --name=rand_rw --ioengine=libaio --rw=randrw --rwmixread=70 --bs=4k --numjobs=4 --size=1G --runtime=30 --directory=/n8n --group_reporting + +# Remove files +sudo rm /n8n/rand_rw.* + +# Uninstall fio +sudo apt-get -y remove fio