rDrama/files
TLSM 509332e9cc
Fix comment eager loading
Following #485, we began investigating post/comment rendering
bottlenecks. The most immediate issue is the eager comment loading
(merged in 23a8fb9663) did not seem fully operative: query logs
showed comments and associated FKs were being lazy loaded again
(linear query quantity in number of rendered comments). In fact,
CPU load seemed even worse than previous lazy loading.

Bisect revealed first bad commit: fb77cbcc2b
which fixed post view counters by committing the SQLAlchemy session
instead of flushing, following upstream's fix. However, committing
a session has the unfortunate side effect of dumping cached session
objects, such as the previously loaded comment objects and their
relationships, causing fallback to the old lazy behavior.

We fix this here by explicitly telling SQLAlchemy to not expire
the session on commit.

Hopefully this will simultaneously resolve the elevated DB CPU load
observed in production and speed up page rendering again.
2023-02-07 06:37:40 -05:00
..
assets Cleanup sidebar sizing style kludges 2023-02-04 04:13:18 -06:00
classes [themotte/rDrama#451] Add relation 2023-01-03 01:44:40 -08:00
commands Eager load comments for post rendering. 2022-11-28 17:47:54 -05:00
helpers Randomize sidebar recommendation order (#483) 2023-02-04 04:13:18 -06:00
mail Split SITE_NAME into computer-readable SITE_ID and human-readable SITE_TITLE. 2022-07-31 18:53:18 -05:00
routes Fix comment eager loading 2023-02-07 06:37:40 -05:00
templates Cleanup sidebar sizing style kludges 2023-02-04 04:13:18 -06:00
tests [themotte/rDrama#451] Passing in the db connection as an optional param makes things easier 2023-01-13 19:33:56 -08:00
__init__.py Initial e2e testing 2022-05-13 02:55:29 -05:00
__main__.py Merge remote-tracking branch 'origin/frost' into themotte-issue-451 2023-01-12 22:09:07 -08:00
cli.py [#72] Ensure seed_db command is actually imported when calling into flask 2022-06-09 01:34:46 -07:00