discourse/app/controllers/admin
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
..
admin_controller.rb Refactor admin base controller (#18453) 2022-10-31 12:02:26 +00:00
api_controller.rb FEATURE: Add pagination to API keys page (#14777) 2021-11-09 12:18:23 +02:00
backups_controller.rb FEATURE: Local chunked uppy backup uploads with a new uploader plugin (#14894) 2021-11-23 08:45:42 +10:00
badges_controller.rb FEATURE: Add option to grant badge multiple times to users using Bulk Award (#13571) 2021-07-15 05:53:26 +03:00
color_schemes_controller.rb FEATURE: User selectable color schemes (#10544) 2020-08-28 10:36:52 -04:00
dashboard_controller.rb Refactor admin base controller (#18453) 2022-10-31 12:02:26 +00:00
email_controller.rb FEATURE: Show SMTP response on admin email sent list and rearrange columns (#17143) 2022-08-03 08:11:54 +10:00
email_styles_controller.rb
email_templates_controller.rb Add bad_destination_address template to email_templates_controller (#12102) 2021-02-17 09:57:38 +01:00
embeddable_hosts_controller.rb FIX: use allowlist and blocklist terminology (#10209) 2020-07-27 10:23:54 +10:00
embedding_controller.rb
emojis_controller.rb FIX: Clean up emoji name which is file name (#14980) 2021-11-17 09:20:44 +10:00
groups_controller.rb PERF: Update Group#user_count counter cache outside DB transaction (#19256) 2022-11-30 11:52:08 -03:00
impersonate_controller.rb
permalinks_controller.rb FEATURE: Permalinks for tags 2020-05-25 14:51:01 +02:00
plugins_controller.rb Refactor admin base controller (#18453) 2022-10-31 12:02:26 +00:00
reports_controller.rb Refactor admin base controller (#18453) 2022-10-31 12:02:26 +00:00
robots_txt_controller.rb
screened_emails_controller.rb Refactor admin base controller (#18453) 2022-10-31 12:02:26 +00:00
screened_ip_addresses_controller.rb Refactor admin base controller (#18453) 2022-10-31 12:02:26 +00:00
screened_urls_controller.rb Refactor admin base controller (#18453) 2022-10-31 12:02:26 +00:00
search_logs_controller.rb Refactor admin base controller (#18453) 2022-10-31 12:02:26 +00:00
site_settings_controller.rb FEATURE: new site setting to hide user profiles by default. (#18864) 2022-11-06 16:44:17 +05:30
site_texts_controller.rb FIX: Translation overrides from fallback locale didn't work on client 2021-12-17 14:03:35 +01:00
staff_action_logs_controller.rb Refactor admin base controller (#18453) 2022-10-31 12:02:26 +00:00
staff_controller.rb Refactor admin base controller (#18453) 2022-10-31 12:02:26 +00:00
themes_controller.rb FIX: Theme import error handling needs to happen inside the hijack block (#18866) 2022-11-03 14:02:26 -05:00
user_fields_controller.rb FEATURE: Add user custom fields to user directory (#13238) 2021-06-07 12:34:01 -05:00
users_controller.rb FIX: Ensure moderators_manage_categories_and_groups is respected (#18884) 2022-11-11 11:06:05 +00:00
versions_controller.rb Refactor admin base controller (#18453) 2022-10-31 12:02:26 +00:00
watched_words_controller.rb Refactor admin base controller (#18453) 2022-10-31 12:02:26 +00:00
web_hooks_controller.rb SECURITY: Expand and improve SSRF Protections (#18815) 2022-11-01 16:33:17 +00:00