You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We ran several load tests to understand how the authorization system behaves when the number of concurrent users increases. These tests were executed from my local machine in Spain, and the sandbox is hosted in Virginia (USA), so there is some network distance. We cannot fully measure how much of the latency comes from that distance, but we can observe clear behaviour patterns as concurrency grows.
The goal of these tests was not to find a performance bottleneck or to diagnose a specific issue. The goal was simply to document how the system behaves under different loads and confirm that the authorization checks continue to work correctly.
2. Infrastructure Setup
Below is the pod configuration used during the tests:
I'm not familiar with k6, so apologies if I'm not reading this correctly. It looks to me like each user is logging in as admin and then making a single request to get permissions? Then there is a 1 second sleep before another user takes its place?
If so, the time here is split between the two requests. I'd be curious to see the same test run with just the login for comparison. I suspect that most of the time is spent in the request queue once you get over whatever the threshold is between 10-30 that saturates the req's per second that 4 processes can handle.
Another possibility is that it's using the sleep variable between requests, so there's a full second between the auth and the permission check?
@bmtcril: I ran with your suggestion of testing with only authentication (getting the access token) and for 100 concurrent users we got the following results:
I'm still battling about how much to trust these results. I've discussed internally with our infrastructure team, which usually conducts these tests on our installations, and they strongly recommend using a remote client instead of a local one for better stability. I'll try to get my hands on an EC2 instance to try this :)
I think what we've found is that there are excessive queries to MySQL happening because get_user_by_username_or_email is being called once per policy and is taking up something like 75% of call time. We've discussed caching to handle this, which would be a big improvement, but even 31 cache hits is a fair amount of time. I'm not sure if we have any mechanism to force this evaluation further up the stack, or to limit the number of policies being checked before making the call, but we should look into that as a longer term fix. I think after Ulmo is fine if we can get a reasonable caching strategy.
Activity
mariajgrimaldi commentedon Nov 20, 2025
Authorization Framework: Load Testing Summary (Teak Release)
Environment: Sandbox on Teak release
Tests executed with: K6
K6 setup: https://github.com/eduNEXT/openedx-k6-loadtesting/tree/MJG/rbac-testcases/authz
1. Context
We ran several load tests to understand how the authorization system behaves when the number of concurrent users increases. These tests were executed from my local machine in Spain, and the sandbox is hosted in Virginia (USA), so there is some network distance. We cannot fully measure how much of the latency comes from that distance, but we can observe clear behaviour patterns as concurrency grows.
The goal of these tests was not to find a performance bottleneck or to diagnose a specific issue. The goal was simply to document how the system behaves under different loads and confirm that the authorization checks continue to work correctly.
2. Infrastructure Setup
Below is the pod configuration used during the tests:
Configured through: https://github.com/eduNEXT/tutor-contrib-pod-autoscaling
Notes:
3. Test Profiles
We executed four profiles:
Each profile performs:
4. Functional Results
Across all tests:
5. Performance Results
Small Profile (10 VUs)
Grafana Dashboard
Medium Profile (30 VUs)
Grafana Dashboard
Medium Plus Profile (50 VUs)
Grafana Dashboard
Large Profile (100 VUs)
Grafana Dashboard
6. Summary of Behaviour
7. Possible Reasons for Latency Increase
8. Final Notes
bmtcril commentedon Nov 20, 2025
I'm not familiar with k6, so apologies if I'm not reading this correctly. It looks to me like each user is logging in as admin and then making a single request to get permissions? Then there is a 1 second sleep before another user takes its place?
If so, the time here is split between the two requests. I'd be curious to see the same test run with just the login for comparison. I suspect that most of the time is spent in the request queue once you get over whatever the threshold is between 10-30 that saturates the req's per second that 4 processes can handle.
Another possibility is that it's using the
sleepvariable between requests, so there's a full second between the auth and the permission check?mariajgrimaldi commentedon Nov 21, 2025
@bmtcril: thanks Ty! I'm sorry I didn't explain how the test worked, my mistake. Here is what the test does:
Test Algorithm (test_authz.js)
https://github.com/eduNEXT/openedx-k6-loadtesting/blob/MJG/rbac-testcases/authz/test_authz.js
Setup Phase (runs once at the beginning):
Main Test Phase (all VUs run simultaneously in parallel):
Each VU executes independently in its own goroutine:
The test gradually increases concurrent users following the profile configuration (e.g., 10 → 25 → 50 → 75 → 100 users over time).
Teardown Phase (runs once at the end):
mariajgrimaldi commentedon Nov 24, 2025
@bmtcril: I ran with your suggestion of testing with only authentication (getting the access token) and for 100 concurrent users we got the following results:
Overhead = With Permission - Without Permission
p(95): 18,233ms - 818ms = 17,415ms (17.4 seconds)
p(99): 18,867ms - 861ms = 18,006ms (18.0 seconds)
Average: 8,707ms - 694ms = 8,013ms (8.0 seconds)
Median: 8,310ms - 712ms = 7,598ms (7.6 seconds)
I'm still battling about how much to trust these results. I've discussed internally with our infrastructure team, which usually conducts these tests on our installations, and they strongly recommend using a remote client instead of a local one for better stability. I'll try to get my hands on an EC2 instance to try this :)
mariajgrimaldi commentedon Nov 24, 2025
I ran the large profile with 100 VUs to check the metrics in the Scout dashboard:
bmtcril commentedon Nov 24, 2025
I think what we've found is that there are excessive queries to MySQL happening because
get_user_by_username_or_emailis being called once per policy and is taking up something like 75% of call time. We've discussed caching to handle this, which would be a big improvement, but even 31 cache hits is a fair amount of time. I'm not sure if we have any mechanism to force this evaluation further up the stack, or to limit the number of policies being checked before making the call, but we should look into that as a longer term fix. I think after Ulmo is fine if we can get a reasonable caching strategy.mariajgrimaldi commentedon Dec 5, 2025
Here's the discussion we had about the performance issues identified: https://openedx.slack.com/archives/C07PRCN6G0N/p1763983154101359?thread_ts=1763672523.867889&cid=C07PRCN6G0N
And after these changes #146: https://openedx.slack.com/archives/C07PRCN6G0N/p1764181886960179?thread_ts=1763672523.867889&cid=C07PRCN6G0N
I'll close this as done. Thank you all for the help!