Slowness/timeout on loading bookbags in OPAC
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Evergreen |
Invalid
|
Medium
|
Unassigned |
Bug Description
After upgrading to Evergreen 2.8 and Postgres 9.4, we were seeing very slow load times (20-30 seconds or longer, sometimes timing out with a 504 error) when viewing bookbags in the OPAC.
Eventually we tracked the issue down to a bad query plan when retrieving holdings information:
query: http://
explain output: http://
I think not everyone will see this problem. For one thing, I'm not sure the JSON output is consistently ordered when it's being converted to SQL, so the query construction may vary. You also need to have a lot of holdings/circs for the query to be slow. But obviously it's an issue in at least some cases.
By modifying the query slightly (specifically, putting the INNER JOIN between acp and acn in parentheses), we can vastly reduce the number of rows at the core of the query. In our environment, that change drops the SQL execution time from 20-30 seconds to 0.1 seconds:
query: http://
explain output: http://
So, we want to force this query to be constructed in a more sensible way. I'll share a fix momentarily.
tags: | added: opac performance |
tags: | added: pullrequest |
Changed in evergreen: | |
assignee: | Dan Wells (dbw2) → nobody |
Changed in evergreen: | |
milestone: | 3.next → none |
Proposed fix, closely based on a suggestion from Mike Rylander, is in branch user/jeffdavis/ lp1499086- bookbag- slowness in the working repo:
http:// git.evergreen- ils.org/ ?p=working/ Evergreen. git;a=commitdif f;h=97b7fae
Not sure if/how to write a test for this.