-
Notifications
You must be signed in to change notification settings - Fork 18
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
Searching the catalog by reader is slow #155
Comments
Hello!
I'm not sure that's true, looking further down at the code I see the following: WHERE 1
' . $status . '
' . $project_type . '
' . $title . '
' . $author_clause . '
' . $reader_clause . '
' . $language_clause . ' '; at [1]. On the other hand, I'll happily review any PR that comes in :) |
Awesome, thanks. My description wasn't very clear sorry, I was trying to say that |
Fixes LibriVox#155. Calling `$this->_get_projects_by_section_author($params['author']);` without an author ID is really expensive, and we just throw the result away anyway. I also removed a few other unused variables while I was there, though the performance impact of those were negligible.
Fixes LibriVox#155. Calling `$this->_get_projects_by_section_author($params['author']);` without an author ID is really expensive, and we just throw the result away anyway. I also removed a few other unused variables while I was there, though the performance impact of those was negligible.
Fixes #155. Calling `$this->_get_projects_by_section_author($params['author']);` without an author ID is really expensive, and we just throw the result away anyway. I also removed a few other unused variables while I was there, though the performance impact of those was negligible.
Hi! I'm currently running the latest stuff from librivox-ansible locally, which is using librivox-catalog
2d270e76f8bfbb0e9f4e75a68c06d3e81ae2a799
from 30th December.When I run the catalog locally and do a reader-only search, it takes about 16s to respond. I noticed #127, which looks like it solves this problem, but it's still slow for me both locally and when I run the same queries against the production site.
Expectation
Searching the catalog by just reader returns results reasonably quickly.
Actual
Searching the catalog by just reader returns results after about 16 seconds.
What I've tried so far
It looks like it takes about 16s to respond locally - it takes about 8 seconds per call to
Librivox_search#advanced_title_search
, of which there are two (one for the first page of results, and one to decide how many pages there are in total).I noticed that the vast majority of the time is spent on fetching projects by section author when building
$reader_clause
:But that variable (and
$section_reader_clause
) is never used, so it's sucking up a lot of time doing not much. (It looks like it might've been copy/pasted from building the author clause.) When I remove that call, the query loads in ~320ms rather than 16s.Including an author in the search also gives good performance since
$params['author']
isn't empty then, so we don't try and do big joins and string operations on every single author in the database.I'm running all of this locally using Docker rather than VirtualBox, but the numbers seem comparable to what I get if I do the same queries against the production site. If you agree that the
$section_project_ids
variable isn't being used and is sucking up a lot of time, then I'm happy to raise a PR to remove it 🙂Thanks!
The text was updated successfully, but these errors were encountered: