-
Notifications
You must be signed in to change notification settings - Fork 883
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
wpseo_init options data #21228
Comments
Thanks for using the Yoast SEO plugin and also for creating the issue. I've forwarded this information to our development team to take a closer look. We will keep you posted. |
Hi there @bmcpherson-malware and thank you for the report. Your caching proposal attempts to decrease the database queries with each page load, that are due to the get_all() function. But:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please give us a description of what happened
We've taken note that the wpseo plugin appears to exhibit heavy database interaction during its initialization routine. Specifically, the init function stands out as a high-utilization process, primarily due to the get_all function.
This function is used to retrieve a vast number of options, and in scenarios where the data is not cached, it can lead to significant performance bottlenecks due to the multiple database requests it generates.
Upon profiling the plugin, we discovered that the get_all function within the WPSEO_Options class methodically pulls a number of option entries from the WordPress database. The absence of a caching mechanism at this level means that each page load calls the database afresh to fetch these options. This is particularly problematic on high-traffic sites or those with limited server resources, as the cumulative effect can cause substantial resource strain and slow down response times. This excessive querying can not only decrease the site's performance but also impact overall server health, leading to decreased scalability and potential downtime.
Suggestion
To mitigate the load on the database and enhance the performance of the wpseo plugin, a caching mechanism should be introduced for the options retrieved by the get_all function. The recommended approach involves caching this data for a set duration—such as one hour—to reduce the frequency of database queries while ensuring that the options remain up-to-date.
We suggest using the following code to replace the get_all function
While the data will be cached, the clearing can be handled by manually deleting the cache using the key wpseo_getalloptions, or by wiping all related cache entries under the group WPSEO. Implementing such a caching system would improve the loading times and reduce the load on the database, resulting in better scalability and a more responsive site experience.
Technical info
Used versions
The text was updated successfully, but these errors were encountered: