File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -258,7 +258,16 @@ in {
258258 client = { nodes , resources , ...} : {
259259 environment . systemPackages = [
260260 pkgs . k6
261- pkgs . postgresql_12 # only used for getting pgbench, no postgresql is started here
261+ ( pkgs . writeShellScriptBin "pgbench-tuned"
262+ ''
263+ set -euo pipefail
264+
265+ ${ pkgs . postgresql_12 } /bin/pgbench postgres -U postgres \
266+ -h ${ if env . withSeparatePg then "pg" else "pgrst" } \
267+ -T 30 --no-vacuum \
268+ --jobs ${ builtins . toString ( builtins . getAttr nodes . pgrst . config . deployment . ec2 . instanceType ( import ./postgrest/tuning.nix ) ) } \
269+ $@
270+ '' )
262271 ] ;
263272 deployment = {
264273 targetEnv = "ec2" ;
Original file line number Diff line number Diff line change 5555 set -euo pipefail
5656
5757 echo -e "\nRunning pgbench with $1 clients"
58- host=$([ "$PGRSTBENCH_SEPARATE_PG" = "true" ] && echo "pg" || echo "pgrst")
5958 # uses the full cores of the instance and prepared statements
60- nixops ssh -d ${ prefix } client pgbench postgres -h "$host" -U postgres -j 16 -T 30 -c $1 --no-vacuum -f - < $2 || true
59+ # || true is added because the command might fail on lower instances with FATAL: sorry, too many clients already
60+ nixops ssh -d ${ prefix } client pgbench-tuned -c $1 -f - < $2 || true
6161 '' ;
6262 clientPgBenchVaried =
6363 pkgs . writeShellScriptBin ( prefix + "-pgbench-vary-clients" )
You can’t perform that action at this time.
0 commit comments