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

DB queries >2K per view #471

Open
2 tasks
Tracked by #560 ...
jon-nfc opened this issue Jan 14, 2025 · 3 comments
Open
2 tasks
Tracked by #560 ...

DB queries >2K per view #471

jon-nfc opened this issue Jan 14, 2025 · 3 comments

Comments

@jon-nfc
Copy link
Member

jon-nfc commented Jan 14, 2025

As each view is run, authorization is conducted.

Details

Authorization is required, however when concurrent requests come in, the request time increases to beyond expectaations (>2s).

Screenshot from 2025-01-15 00-21-04

currently there are in excess of >2k database queries per view.

Tasks

  • Refactor DB queries to use prefetch_related as appropriate.

  • test amount of DB queries per view
    investigate if this can be tested

@jon-nfc jon-nfc added this to the Next Release milestone Jan 14, 2025
@jon-nfc jon-nfc moved this to Planning in Centurion ERP Jan 14, 2025
@jon-nfc jon-nfc self-assigned this Jan 16, 2025
@jon-nfc jon-nfc moved this from Planning to In progress in Centurion ERP Jan 16, 2025
jon-nfc added a commit that referenced this issue Jan 16, 2025
jon-nfc added a commit that referenced this issue Jan 16, 2025
@jon-nfc
Copy link
Member Author

jon-nfc commented Jan 16, 2025

Post changes:

Image

  • left graph: pre changes
  • Right graph: post changes

Test ran was 1vu, 100x requests per url for each URL in alphabetical order.

jon-nfc added a commit that referenced this issue Jan 16, 2025
jon-nfc added a commit that referenced this issue Jan 16, 2025
jon-nfc added a commit that referenced this issue Feb 1, 2025
jon-nfc added a commit that referenced this issue Feb 1, 2025
jon-nfc added a commit that referenced this issue Feb 1, 2025
jon-nfc added a commit that referenced this issue Feb 1, 2025
jon-nfc added a commit that referenced this issue Feb 1, 2025
jon-nfc added a commit that referenced this issue Feb 1, 2025
jon-nfc added a commit that referenced this issue Feb 1, 2025
jon-nfc added a commit that referenced this issue Feb 1, 2025
jon-nfc added a commit that referenced this issue Feb 1, 2025
@jon-nfc
Copy link
Member Author

jon-nfc commented Feb 1, 2025

Image

graph of changes thus far.

peak at the start is the following views:

Name Last * Min Mean Max
v2:_api_v2_knowledge_base-list 248 ms 248 ms 248 ms 248 ms
v2:_api_v2_device-list 244 ms 244 ms 244 ms 245 ms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

1 participant