Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACL creates heavy and slow database traffic #94

Open
mkrecek234 opened this issue Feb 25, 2022 · 5 comments
Open

ACL creates heavy and slow database traffic #94

mkrecek234 opened this issue Feb 25, 2022 · 5 comments

Comments

@mkrecek234
Copy link
Contributor

Steps to reproduce:

  • Have an application with more complex model structure (multiple hasOnes, hasManys)
  • Set-up just one rule and activate ACL by setACL();

Issue:

  • Database traffic is MASSIVE due to the login_access_rule queries
  • Even if you index the related Atk4/login tables properly, it makes a difference between 0.2 sec to 4 sec. in loading time for comparably simple scripts.
@mvorisek
Copy link
Member

please provide code example of steps to reproduce

the best way to verify it is to place it into a unit test and enable https://github.com/atk4/data/blob/3.1.0/src/Schema/TestCase.php#L23

then the queries should be dumped

@mvorisek
Copy link
Member

when ACL rule can include/exclude the whole table, I belive the generated SQL should be much more performant

@mvorisek
Copy link
Member

Database traffic is MASSIVE due to the login_access_rule queries

@mkrecek234 do you mean much more queries are generated or they are only slower?

@mkrecek234
Copy link
Contributor Author

mkrecek234 commented Jul 30, 2022

@mvorisek It results in a lot of additional queries being executed as ACK rules are checked for each field. I noticed if you have models which by default are adding a lot of hasOne fields and thus joining a lot of queries (in my case even over multiple join cascades), this reduces the database speed a lot. In my case ACL was resulting in 4-5sec queries, whereas without ACk it was far below 1sec.

@mvorisek
Copy link
Member

mvorisek commented Jul 30, 2022

in a lot of additional queries being executed

yes, larger queries are expected and as I have written, it would make sense to optimize the case when user has ACL for whole table only, thus ACL would not be needed to be checked per row

my question is, if the queries are only larger/slower, or if you meant more (much more) queries in total are executed

it would be helpful if you can attach minimalistic SQL log /w and /wo ACL enabled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants