Skip to content
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

Do not update_option for DB version on every request #914

Open
wants to merge 1 commit into
base: 4.x
Choose a base branch
from

Conversation

kadamwhite
Copy link

@kadamwhite kadamwhite commented Aug 22, 2024

By submitting a PR to this repository, you agree to the terms within the Auth0 Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.

(👍)

Description

The install_db function is hooked into the plugins loaded action, but includes an update_option call which is fired even when the stored option DOES match.

This is inefficient, and can cause unnecessary DB write load. It is especially problematic on some enterprise hosting where an UPDATE call causes all subsequent reads in a request to go through a Writer database instead of a read replica, overwhelming production DB servers.

References

Example query monitor output demonstrating UPDATE call on average pageview

image

Testing

Using Query Monitor, inspect the DB requests triggered by frontend traffic on a site. There should not be an identical UPDATE call on every request.

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation for new/changed functionality in this PR or in auth0.com/docs
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not the default branch

The install_db function is hooked into the plugins loaded action, but includes an `update_option` call which is fired even when the stored option DOES match.

This is inefficient, and can cause unnecessary DB write load. It is especially problematic on some enterprise hosting where an UPDATE call causes all subsequent reads in a request to go through a Writer database instead of a read replica, overwhelming production DB servers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant