diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 537579cbc..26fb7c849 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -113,7 +113,7 @@ jobs: loadtest: strategy: matrix: - kind: ['mixed', 'jwt-hs-50k', 'jwt-rsa-1k'] + kind: ['mixed', 'jwt-hs', 'jwt-rsa'] name: Loadtest runs-on: ubuntu-24.04 steps: diff --git a/nix/tools/generate_targets.py b/nix/tools/generate_targets.py index 609ba029a..8ae72a77f 100644 --- a/nix/tools/generate_targets.py +++ b/nix/tools/generate_targets.py @@ -1,4 +1,14 @@ # generates a file to be used by the vegeta load testing tool +# it generates TOTAL_TARGETS amount of requests that will be run + +# This is a worst case scenario for the JWT cache: +# - all requests will have a unique JWT so no cache hits +# - all jwts have an expiration that will be long enough to be +# valid at time of request but short enough that already +# validated jwts will expire later during the loadtest run +# - the above guarantees JWT cache purging will happen +# +# We want this to track resource consumption in the worst case import time import hmac import hashlib @@ -10,7 +20,7 @@ import random SECRET = b"reallyreallyreallyreallyverysafe" URL = "http://postgrest" -TOTAL_TARGETS = 50000 # tuned by hand to reduce result variance +TOTAL_TARGETS = 200000 # tuned by hand to reduce result variance def base64url_encode(data: bytes) -> str: diff --git a/nix/tools/loadtest.nix b/nix/tools/loadtest.nix index e46301796..17516bfa6 100644 --- a/nix/tools/loadtest.nix +++ b/nix/tools/loadtest.nix @@ -43,7 +43,7 @@ let "ARG_OPTIONAL_SINGLE([testdir], [t], [Directory to load tests and fixtures from], [./test/load])" "ARG_OPTIONAL_SINGLE([kind], [k], [Kind of loadtest], [mixed])" "ARG_OPTIONAL_SINGLE([jwtcache], [], [JWT Cache on/off], [on])" - "ARG_TYPE_GROUP_SET([KIND], [KIND], [kind], [mixed,jwt-hs-50k,jwt-rsa-1k])" + "ARG_TYPE_GROUP_SET([KIND], [KIND], [kind], [mixed,jwt-hs,jwt-rsa])" "ARG_TYPE_GROUP_SET([JWTCACHE], [JWTCACHE], [jwtcache], [on,off])" "ARG_LEFTOVERS([additional vegeta arguments])" ]; @@ -66,7 +66,7 @@ let abs_output="$(realpath "$_arg_output")" case "$_arg_kind" in - jwt-hs-50k) + jwt-hs) ${genTargets ./generate_targets.py} "$_arg_testdir"/gen_targets.http @@ -81,7 +81,7 @@ let ${runner} -lazy -targets gen_targets.http -output \"$abs_output\" \"''${_arg_leftovers[@]}\"" ;; - jwt-rsa-1k) + jwt-rsa) ${genTargets ./generate_targets_rsa.py} "$_arg_testdir"/gen_targets.http "$_arg_testdir"/gen_jwk.http