This repository contains code for load testing the Open Targets Platform API. It uses the goose framework to simulate user behavior and measure the performance of the API under load.
To get started with load testing the Open Targets Platform API, follow these steps:
- Clone this repository to your local machine.
- To run the tests against an instance:
cargo run --release -- --host <INSTANCE> --report-file=report.html --no-reset-metrics -t 60 -u 3 -E error.log- Play with the parameters to find the best configuration for your needs. For example, you can adjust the duration of the test (
-t), the number of users (-u), and the report file name (--report-file).
- Play with the parameters to find the best configuration for your needs. For example, you can adjust the duration of the test (
- Open the report file (e.g.,
report.html) in a web browser to view the results of the load test.
To add new tests to the load testing suite, follow these steps:
- In the queries directory, create a new directory for your test (e.g.,
my_test). - Inside the new directory, create a
q.gqlfile containing the GraphQL query you want to test, av.gqlfile containing the variables for the query with$IDas a placeholder (e.g. here), and anids.txtfile containing a newline seperated list of IDs to be used in the variables file. - Add the test to the
main.rsfile by adding a new fn that returns aTransactionResultwhere the string passed to thequeryfunction matches the name of the directory you created in step 1. For example, if you created a directory namedmy_test, your function would look like this:
async fn my_test(user: &mut GooseUser) -> TransactionResult {
query(user, "my_test").await
}- Finally, add the new test function to the
mainfunction inmain.rs, for example:
.register_transaction(transaction!(my_test).set_name("My Test query"))