{"id":18650439,"url":"https://github.com/paoliniluis/metabase-load-test-k6","last_synced_at":"2025-04-04T17:45:19.386Z","repository":{"id":191638677,"uuid":"684085081","full_name":"paoliniluis/metabase-load-test-k6","owner":"paoliniluis","description":"A repo to start load testing Metabase","archived":false,"fork":false,"pushed_at":"2025-03-08T22:00:40.000Z","size":30942,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-08T23:17:21.096Z","etag":null,"topics":["k6","metabase"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paoliniluis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-28T12:28:24.000Z","updated_at":"2025-03-08T22:00:44.000Z","dependencies_parsed_at":"2023-08-30T22:11:59.236Z","dependency_job_id":"96390eb4-28b0-40ab-91d6-5e4fcc1316cd","html_url":"https://github.com/paoliniluis/metabase-load-test-k6","commit_stats":null,"previous_names":["paoliniluis/metabase-load-test-k6"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paoliniluis%2Fmetabase-load-test-k6","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paoliniluis%2Fmetabase-load-test-k6/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paoliniluis%2Fmetabase-load-test-k6/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paoliniluis%2Fmetabase-load-test-k6/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paoliniluis","download_url":"https://codeload.github.com/paoliniluis/metabase-load-test-k6/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247226196,"owners_count":20904464,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["k6","metabase"],"created_at":"2024-11-07T06:45:21.816Z","updated_at":"2025-04-04T17:45:19.381Z","avatar_url":"https://github.com/paoliniluis.png","language":"Python","funding_links":[],"categories":["Metabase Examples"],"sub_categories":["Unofficial and Third Party Examples"],"readme":"Metabase performance testing w/K6\n===============================\n\n## Components\n\n- Metabase is exposed through port 3000\n- A python container that initializes Metabase by adding a@b.com / metabot1 as the user/pass, adds the data db and deletes the H2 sample DB. It will also create a dashboard via an x-ray to use during the process.\n- K6 running on a container that will start when the previous container finishes and will perform the stress test in k6-script/script.js\n- HAProxy with 2 SSH bastion hosts behind. This was introduced to test how Metabase behaves when tunnels go down and even the introduced latency of the SSH tunnel if needed.\n\n## Performance considerations:\n\n1) Metabase App is resource constrained on CPU in order to see how many concurrent users can sustain on the load testing\n2) App DB should have more than enough resources to sustain the load, also Metabase has MB_DISABLE_SESSION_THROTTLE and MB_APPLICATION_DB_MAX_CONNECTION_POOL_SIZE defaults changed\n3) The endpoints called in this test hit the Metabase app db, and not the one with sample data, this is because we want to evaluate the performance of Metabase since running queries in the postgres database can heavily affect these results (the majority of the time is Metabase waiting for the queries from the DW to return)\n\n### K6 test:\n1) check the stages in script.js to know how the load is pushed towards the application\n2) code can be heavily optimized, this is a weekend's project to look for the cause of some performance regressions\n3) we don't evaluate how fast the queries return from the Data DB here, it's just for checking how fast Metabase is and to make recommendations about the size of the server\n4) sleep's are in the code to try to separate the calls and make the load tests as \"natural\" as possible, but this is just a dreamer's dream\n\nNote for Apple Mac users: ensure that you're using a native ARM base image here, since x86 images can heavily impact your performance\n\n## How to test\n\nJust change the Metabase container version and resources assigned to the Metabase container to see if it sustains the load. Set the tunnels true or false in line 226 (this will make Metabase to connect to the DW via an SSH tunnel or not)\n\n## Changelog\n\n- Jul 2024 - Added the new bun api endpoint and tweaked the logging config. Now Metabase will send the log lines to this endpoint and those will be persisted on an app DB table called metrics. This is used to analyze performance on every single api call\n- Mar 2025 - Made the script more realistic by testing more endpoints. Introduced the SSH tunnel component in the stack.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaoliniluis%2Fmetabase-load-test-k6","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaoliniluis%2Fmetabase-load-test-k6","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaoliniluis%2Fmetabase-load-test-k6/lists"}