This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app
Alan Guo Xiang Tan 7c321d3aad
PERF: Update Group#user_count counter cache outside DB transaction (#19256)
While load testing our user creation code path in production, we
identified that executing the DB statement to update the `Group#user_count` column within a
transaction is creating a bottleneck for us. This is because the
creation of a user and addition of the user to the relevant groups are
done in a transaction. When we execute the DB statement to update
`Group#user_count` for the relevant group, a row level lock is held
until the transaction completes. This row level lock acts like a global
lock when the server is creating users that will be added to the same
group in quick succession.

Instead of updating the counter cache within a transaction which the
default ActiveRecord `counter_cache` option does, we simply update the
counter cache outside of the committing transaction.

Co-authored-by: Rafael dos Santos Silva <xfalcox@gmail.com>

Co-authored-by: Rafael dos Santos Silva <xfalcox@gmail.com>
2022-11-30 11:52:08 -03:00
..
assets DEV: Support theme/plugin overrides of colocated component templates (#19237) 2022-11-30 14:14:38 +00:00
controllers PERF: Update Group#user_count counter cache outside DB transaction (#19256) 2022-11-30 11:52:08 -03:00
helpers Meta topic: https://meta.discourse.org/t/meta-theme-color-is-not-respecting-current-color-scheme/239815 (#18832) 2022-11-07 10:06:26 +03:00
jobs PERF: Update Group#user_count counter cache outside DB transaction (#19256) 2022-11-30 11:52:08 -03:00
mailers SECURITY: Filter tags in user notifications for visibility (#19239) 2022-11-29 10:35:41 -06:00
models PERF: Update Group#user_count counter cache outside DB transaction (#19256) 2022-11-30 11:52:08 -03:00
serializers FEATURE: Generic hashtag autocomplete lookup and markdown cooking (#18937) 2022-11-21 08:37:06 +10:00
services FEATURE: Deleting a user with their posts also deletes chat messages. (#19194) 2022-11-28 13:32:57 -03:00
views DEV: Add dark theme support to QUnit (#19014) 2022-11-17 18:44:44 +01:00