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

Performance issue when loading topic #49

Open
BartVB opened this issue Mar 7, 2024 · 0 comments
Open

Performance issue when loading topic #49

BartVB opened this issue Mar 7, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@BartVB
Copy link

BartVB commented Mar 7, 2024

Bug Report

Current Behavior
FoF Terms seems to load policy data when loading post data with a rather inefficient query.

Steps to Reproduce
ab -n 10 'https://flarum.site/api/posts?filter[id]=5323291,5323293,5323296,5323302,5323307,5323320,5323327,5323539,5323541,5324486,5324508,5324904,5325088,5325459,5325900,5325942,5325993,5326020,5326283,5326289'

With FoF Terms enabled:

Time taken for tests:   24.228 seconds
Complete requests:      10
Failed requests:        0
Total transferred:      379372 bytes
HTML transferred:       369900 bytes
Requests per second:    0.41 [#/sec] (mean)
Time per request:       2422.847 [ms] (mean)
Time per request:       2422.847 [ms] (mean, across all concurrent requests)

With FoF Terms disabled:

Time taken for tests:   3.840 seconds
Complete requests:      10
Failed requests:        0
Total transferred:      379370 bytes
HTML transferred:       369900 bytes
Requests per second:    2.60 [#/sec] (mean)
Time per request:       383.995 [ms] (mean)
Time per request:       383.995 [ms] (mean, across all concurrent requests)

The offending query is:

select `fof_terms_policies`.*, `fof_terms_policy_user`.`user_id` as `pivot_user_id`, `fof_terms_policy_user`.`policy_id` as `pivot_policy_id`, `fof_terms_policy_user`.`accepted_at` as `pivot_accepted_at` from `fof_terms_policies` inner join `fof_terms_policy_user` on `fof_terms_policies`.`id` = `fof_terms_policy_user`.`policy_id` where `fof_terms_policy_user`.`user_id` = 21996645

This takes approximately 300ms (on a not very beefy DB server).

Expected Behavior
No involvement of FoF Terms in viewing topics = no performance impact ;)

Environment

  • Flarum version: 1.8.5
  • Extension version: 1.3.0
  • Website URL: Not public yet.
  • Webserver: Apache
  • Hosting environment: K8s
  • PHP version: 8.2.x
  • Browser: n/a
@BartVB BartVB added the bug Something isn't working label Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant