Understanding and Resolving Performance Issues with Large Redirection Lists
Content
If you manage a WordPress site with a significant number of URL redirects, you might eventually encounter questions about performance and database load. This is a common concern for sites that have accumulated thousands of redirects over many years. This guide will explain how the Redirection plugin handles large datasets and provide practical steps to optimize its performance.
Does the Number of Redirects Affect Performance?
Based on community discussions and developer input, the Redirection plugin is designed to handle a large volume of redirects efficiently. The plugin's performance is generally constant, meaning the time it takes to process a redirect should not significantly increase as you add more entries. There is no hard-coded limit, and sites have been reported to function with tens of thousands, or even millions, of redirects. However, the overall health of your server and database is a crucial factor.
Why Large Log Tables Can Be a Problem
While the redirects themselves are optimized, the accompanying log and 404 tables can become very large over time. This is often the real source of performance issues. For example, one user reported their redirection_logs table was 103 MB and their redirection_404 table was 162 MB. These large tables can slow down database queries and increase server load.
Common Solutions and Optimization Tips
1. Manage Your Logging Settings
The most effective way to control database size is to limit how long data is stored. It is not recommended to keep 404 and log data "forever."
- Navigate to Tools → Redirection → Options in your WordPress admin.
- Under the 'Database' section, set a reasonable retention period for logs and 404s (e.g., 1 or 2 months). This will automatically prune old entries and prevent your database from growing indefinitely.
2. Consider Using NGINX Directives (For Advanced Users)
For sites with extremely high traffic or massive redirect lists (e.g., 6,000+), serving redirects at the server level can offer a performance benefit.
- The Redirection plugin can generate NGINX configuration code for your redirects.
- Go to Tools → Redirection → Groups.
- Select the 'NGINX' redirect type for your group and copy the provided configuration code.
- You must manually add this code to your server's NGINX configuration file. This task typically requires server administrator access.
- Note: This method moves the processing load from WordPress/PHP to the web server itself, which is more efficient. However, any changes to these redirects would require updating the server configuration file.
3. Clean Up Unnecessary Data
- Regularly review your 404 logs and use the 'Group by' dropdown to identify the most frequent errors. Consider creating redirects for legitimate broken links or ignoring spammy requests.
- Delete any self-referencing redirects (where the source and target URL are the same), as these serve no purpose and can create loops.
- Export your redirects to a CSV file and look for duplicates or outdated entries that can be removed.
4. For Developers: Cache Plugin Options
One advanced performance issue noted in the community is that the plugin's red_get_options function could call the database excessively on sites with a very high number of redirects. A code snippet was proposed to cache these options and reduce database queries. Implementing such a fix requires custom coding and is only recommended for developers comfortable with modifying plugin code.
Conclusion
Having a large number of redirects is unlikely to be the direct cause of a website crash. Performance problems are more commonly linked to oversized log tables. By proactively managing your data retention settings and considering server-level solutions for large-scale implementations, you can ensure the Redirection plugin continues to operate smoothly and efficiently, no matter how many redirects you have.
Related Support Threads Support
-
Is there a way to see redirect on posts or page list?https://wordpress.org/support/topic/is-there-a-way-to-see-redirect-on-posts-or-page-list/
-
Maximum limits on the number of URLs for redirectshttps://wordpress.org/support/topic/maximum-limits-on-the-number-of-urls-for-redirects/
-
Feature Request: Include “Referer” in 404 Log and Add Grouping Optionshttps://wordpress.org/support/topic/feature-request-include-referer-in-404-log-and-add-grouping-options/
-
Bulk Check Redirectionhttps://wordpress.org/support/topic/bulk-check-redirection/
-
Adding/removing redirectshttps://wordpress.org/support/topic/adding-removing-redirects/
-
get_option fires 2000+ times per page loadhttps://wordpress.org/support/topic/get_option-fires-2000-times-per-page-load/
-
Automatic creation of redirects (non-existent urls)https://wordpress.org/support/topic/automatic-creation-of-redirects-non-existent-urls/
-
7000+ 404s in a weekhttps://wordpress.org/support/topic/7000-404s-in-a-week/
-
Difference in number of redirects?https://wordpress.org/support/topic/difference-in-number-of-redirects/
-
Change RED_MAX_PER_PAGE and RED_DEFAULT_PER_PAGE in optionshttps://wordpress.org/support/topic/change-red_max_per_page-and-red_default_per_page-in-options/
-
Self-referencing redirect?https://wordpress.org/support/topic/self-referencing-redirect/
-
Temporarily disable or pause creation of redirects when testing, building, etchttps://wordpress.org/support/topic/temporarily-disable-or-pause-creation-of-redirects-when-testing-building-etc/
-
Conditional Redirectshttps://wordpress.org/support/topic/conditional-redirects-2/
-
Suggestion: Detect and warn if potential redirect loop: “Too many redirects”https://wordpress.org/support/topic/suggestion-detect-too-many-redirects-potential-issues/
-
Trace infinite internal redirectshttps://wordpress.org/support/topic/trace-infinite-internal-redirects/
-
Add a notification bar for redirected pages, and more…https://wordpress.org/support/topic/add-a-notification-bar-for-redirected-pages-and-more/
-
Destination URL Status code checkerhttps://wordpress.org/support/topic/destination-url-status-code-checker/
-
Is there a way to see when a redirect was added?https://wordpress.org/support/topic/is-there-a-way-to-see-when-a-redirect-was-added/
-
Using Redirection with Graphqlhttps://wordpress.org/support/topic/using-redirection-with-graphql/
-
Suggestion to add 2 featureshttps://wordpress.org/support/topic/suggestion-to-add-2-features/
-
Wish Listhttps://wordpress.org/support/topic/wish-list-16/
-
Why is there no redirect of the entire sat temporarily ???https://wordpress.org/support/topic/why-is-there-no-redirect-of-the-entire-sat-temporarily/
-
If we create 10 Million redirection in your plugin will it work properly/crashhttps://wordpress.org/support/topic/if-we-create-10-million-redirection-in-your-plugin-will-it-work-properly-crash/
-
Redirect Update/Creation Trigger Cache Clean (which function to use)https://wordpress.org/support/topic/redirect-update-creation-trigger-cache-clean-which-function-to-use/
-
Would 1000+ redirects cause a problem? + Is there an import facility?https://wordpress.org/support/topic/would-1000-redirects-cause-a-problem-is-there-an-import-facility/
-
Internal 404 vs Externalhttps://wordpress.org/support/topic/internal-404-vs-external/
-
[Feature Request] Store creation datehttps://wordpress.org/support/topic/feature-request-store-creation-date/
-
403 error extensibilityhttps://wordpress.org/support/topic/403-error-extensibility/
-
plugin allows multiple identical new redirectshttps://wordpress.org/support/topic/plugin-allows-multiple-identical-new-redirects/
-
Search and Replacehttps://wordpress.org/support/topic/search-and-replace-13/
-
Is there a way to find broken links?https://wordpress.org/support/topic/is-there-a-way-to-find-broken-links/
-
Many broken linkshttps://wordpress.org/support/topic/many-broken-links/
-
Optimal set up of Redirection Plugin (NGINX)https://wordpress.org/support/topic/optimal-set-up-of-redirection-plugin-nginx/
-
SUGGESTION: Indication of redirection in the list of posts and pageshttps://wordpress.org/support/topic/suggestion-indication-of-redirection-in-the-list-of-posts-and-pages/
-
Add admin columnshttps://wordpress.org/support/topic/add-admin-columns/
-
Feature request: counter for 404https://wordpress.org/support/topic/feature-request-counter-for-404/
-
Suggestions for HTTP-Header UIhttps://wordpress.org/support/topic/suggestions-for-http-header-ui/
-
Import redirects: replace existing titles instead of creating new oneshttps://wordpress.org/support/topic/import-redirects-replace-existing-titles-instead-of-creating-new-ones/
-
Performancehttps://wordpress.org/support/topic/performance-79/
-
Eliminating Redirect Chainshttps://wordpress.org/support/topic/eliminating-redirect-chains/
-
automatic database upgradehttps://wordpress.org/support/topic/automatic-database-upgrade/
-
Query Parameters bulk edithttps://wordpress.org/support/topic/query-parameters-bulk-edit/
-
bulk edit codeshttps://wordpress.org/support/topic/bulk-edit-codes/
-
Redirect Entire website URL’s Except Added listhttps://wordpress.org/support/topic/redirect-entire-website-urls-except-added-list/
-
Finding duplicate redirectshttps://wordpress.org/support/topic/finding-duplicate-redirects/
-
Confirm-validate a 404 direction has been donehttps://wordpress.org/support/topic/confirm-validate-a-404-direction-has-been-done/
-
[Feature request] Add hooks for Disable/Enable redirecthttps://wordpress.org/support/topic/feature-request-add-hooks-for-disable-enable-redirect/
-
Resources efficiency using redirectshttps://wordpress.org/support/topic/resources-efficiency-using-redirects/
-
List of redirections in Frontendhttps://wordpress.org/support/topic/list-of-redirections-in-frontend/
-
dynamichttps://wordpress.org/support/topic/dynamic-4/
-
Bulk delete redirects via CSV?https://wordpress.org/support/topic/bulk-delete-redirects-via-csv/