nix: increase jwt-hs loadtest TOTAL_TARGETS

This is so the process monitoring results are more meaningful.

* remove the amount of total targets from the loadtest kind name
  since the targets can change.

* clarifies the top comment on the generate_targets python script

* increase TOTAL_TARGETS on jwt-hs loadtest
This commit is contained in:
steve-chavez
2025-06-17 00:10:58 -05:00
committed by Steve Chavez
parent ba7aaa8ab1
commit 53604c9db2
3 changed files with 15 additions and 5 deletions
+1 -1
View File
@@ -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:
+11 -1
View File
@@ -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:
+3 -3
View File
@@ -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