-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Labels
authnRelated to authenticationRelated to authenticationciRelated to CI setupRelated to CI setupnixrelated to Nix toolingrelated to Nix tooling
Description
Problem
We need to run a loadtest similar to https://github.com/PostgREST/postgrest-benchmark/blob/master/k6/GETSingleDifferentJWT.js in our CI, to test the performance of JWT decoding coupled with the JWT cache.
Currently I run the above manually on every PR (example), and this takes a while and it gets repetitive.
Solution
-
Generate a
jwt-targets.httpfile, contents should be like:GET http://localhost:3000/authors_only Authorization: Bearer <JWT> GET http://localhost:3000/authors_only Authorization: Bearer <anotherJWT>
- This can be done with Haskell or another language. A bash script might be too slow.
-
Run vegeta with this
jwt-targets.httpfile -
Put this on a nix script like the following and use it on CI
postgrest/nix/tools/loadtest.nix
Lines 36 to 48 in d89e7a2
loadtest = checkedShellScript { name = "postgrest-loadtest"; docs = "Run the vegeta loadtests with PostgREST."; args = [ "ARG_OPTIONAL_SINGLE([output], [o], [Filename to dump json output to], [./loadtest/result.bin])" "ARG_OPTIONAL_SINGLE([testdir], [t], [Directory to load tests and fixtures from], [./test/load])" "ARG_LEFTOVERS([additional vegeta arguments])" ]; workingDir = "/"; } '' -
This result show show on the "Summary" part of CI actions.
taimoorzaeem
Metadata
Metadata
Assignees
Labels
authnRelated to authenticationRelated to authenticationciRelated to CI setupRelated to CI setupnixrelated to Nix toolingrelated to Nix tooling