Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ jobs:

loadtest:
runs-on: ubuntu-latest
strategy:
matrix:
params: [ {reqs: 10000, batch: 200}, {reqs: 20000, batch: 400}, {reqs: 40000, batch: 800} ]
steps:
- uses: actions/checkout@v4

Expand All @@ -72,7 +75,8 @@ jobs:

- name: Run load test
run: |
nix-shell --run "net-loadtest"
echo "${{ matrix.params.reqs }} requests with a batch size of ${{ matrix.params.batch }}" >> "$GITHUB_STEP_SUMMARY"
nix-shell --run "net-loadtest ${{ matrix.params.reqs }} ${{ matrix.params.batch }}"
cat psrecord.md >> "$GITHUB_STEP_SUMMARY"

coverage:
Expand Down
13 changes: 12 additions & 1 deletion nix/loadtest.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,18 @@ in
writeShellScriptBin "net-loadtest" ''
set -euo pipefail

net-with-nginx xpg psql -c "call wait_for_many_gets()" > /dev/null &
reqs=""
batch_size="200"

if [ -n "''${1:-}" ]; then
reqs="$1"
fi

if [ -n "''${2:-}" ]; then
batch_size="$2"
fi

net-with-nginx xpg --options "-c log_min_messages=WARNING -c pg_net.batch_size=$batch_size" psql -c "call wait_for_many_gets($reqs)" > /dev/null &

# wait for process to start so we can capture it with psrecord
sleep 2
Expand Down
4 changes: 2 additions & 2 deletions nix/xpg.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ let
dep = fetchFromGitHub {
owner = "steve-chavez";
repo = "xpg";
rev = "v1.4.1";
sha256 = "sha256-OI9g78KbguLh+ynOnRmnMM4lVOgNRAWkiI/YMmcMs+k=";
rev = "v1.6.0";
sha256 = "sha256-NsdAmsYIRH/DWIZp93AHGYdPiJOztUIUSYcPikeebvw=";
};
xpg = import dep;
in
Expand Down
2 changes: 1 addition & 1 deletion test/utils/loadtest.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ begin

commit;

raise notice 'Waiting until % requests complete', number_of_requests;
raise notice 'Waiting until % requests complete, using a pg_net.batch_size of %', number_of_requests, current_setting('pg_net.batch_size')::text;

perform net._await_response(last_id);

Expand Down