Skip to content

ci: loadtest with different JWTs #4001

@steve-chavez

Description

@steve-chavez

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.http file, 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.http file

  • Put this on a nix script like the following and use it on CI

    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.

Metadata

Metadata

Assignees

Labels

authnRelated to authenticationciRelated to CI setupnixrelated to Nix tooling

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions