Large memory consumptions for redirections feature

#929053
  • Herb He
    Rank Math free

    We have more than 2400 redirection records. And we noticed the redirections feature is trying to do a fuzzy match first to get the data from DB which will get lots of matches. And eventually cause the memory consumption increased a lot. Please suggest what’s the right way to solve this problem.

    Here is one of the profile that shows it used 2.73GB memory:
    Table::column_uri (class-table.php:L#109)
    Table::column_actions (class-table.php:L#152)
    Table::add_redirection_actions (class-table.php:L#180)
    DB::match_redirections (class-db.php:L#151)
    DB::match_redirections (class-db.php:L#153)

    Plugin version is 1.0.233

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention.

    Handling a large number of redirections can indeed lead to high memory usage, especially when performing regex matches. Here are some suggestions to optimize this:

    1. Review your redirections and ensure there are no unnecessary and chained redirections.

    2. If regex matching is not critical for your use case, consider using exact matching instead. This significantly reduces the load on the database and improves performance.

    3. If the issue persists, consider increasing the memory limit temporarily or offloading redirections to the server level (e.g., .htaccess or nginx).

    4. Also ensure your database is indexed properly for the redirection table. Adding an index on the URI column, for instance, could speed up queries and reduce memory consumption.

    You may also try the following plugin to create indexes on the database to speed up the MySQL calls: https://wordpress.org/plugins/index-wp-mysql-for-speed/

    If you decide to try that plugin, please take a complete backup before trying it as it will modify the database.

    We hope this helps. Please let us know if you have further questions or concerns.

    Thank you.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this ticket.