Hyperfoil / Horreum

Benchmark results repository service
https://horreum.hyperfoil.io/
Apache License 2.0
34 stars 30 forks source link

`RoleManager.setRoles()` called multiple times during a transaction #1726

Open johnaohara opened 1 month ago

johnaohara commented 1 month ago

Describe the bug

RoleManager.setRoles() is a very expensive operation, which requires a full round trip to the DB every time it is called to define the roles for the curren connection. @WithRoles is used liberally within the codebase, and is often called multiple times within the same transaction.

This unnecessary frequent calling adds an overhead to processing new datapoints

For this following upload, setRoles() utilized 35.62% of cpu time

Screenshot from 2024-05-22 06-20-21

barreiro commented 1 month ago

1257 and a relaxed security policy would improve this massively.

Sort term, the reset of roles could happen only when closing the connection and not after each intercepted call.