Skip to content

Resolve "Optimize RBAC performance"

Jérémie Pardou requested to merge 1314-rbac-perf into develop

First batch of performance optimization. In this batch, check_permission and get_permission_object of RBAC permission manager have been improved.

  • The get_role_per_scope has been improved by doing more in the query (like the sorting) and by caching scope query results.
  • For the get permission object, all the queries are grouped to do only one by object scope type which drastically improve query count.

How to test

To test it you can checkout the commit with the comment "Add performances tests" in this branch. This version contains the performance tests but not yet the performance improvements. You can launch them with the following commands:

pytest -k "test_check_get_role_per_scope_performance" -s --run-disabled-in-ci
pytest -k "test_check_permission_performance" -s --run-disabled-in-ci
pytest -k "test_get_permission_object_performance" -s --run-disabled-in-ci

For each test a html profile file is generated in backend/.profile. You can open it to see the performances.

Save them and checkout the last commit of the branch and execute the same tests. Open the newly generated profiles to check the new performances.

Merge Request Checklist

  • changelog.md has been updated if required
  • New/updated Premium features are separated correctly in the premium folder
  • The latest Chrome and Firefox have been used to test any new frontend features
  • Documentation has been updated
  • Quality Standards are met
  • Performance: tables are still fast with 100k+ rows, 100+ field tables
  • The redoc API pages have been updated for any REST API changes
  • Our custom API docs are updated for changes to endpoints accessed via api tokens
  • The UI/UX has been updated following UI Style Guide

Related to #1314 (closed)

Edited by Jérémie Pardou

Merge request reports