WordPress Security How To
Posted By Gregory

Optimizing export performance

If you come across an issue with exporting a large number of activity events or the traffic log entries and so you’re unable to download the CSV file, you can tweak the plugin export mechanism.

When WP Cerber creates an export file, it does it in several iterations, meaning it splits all the rows retrieved from the database into chunks. By default, the size of the chunks is set to 1000 rows. You can change this size to any value by specifying a PHP constant in the wp-config.php file. To do this, add the following line to the beginning of the wp-config.php on the next line after <?php.

define( 'CERBER_EXPORT_CHUNK', 2000 );

You can try to increase or decrease the value. The optimal value depends on the server configuration. The bigger the number, the more server memory will be consumed, and less time (typically) it takes to complete the export. So the optimal value is dictated by a compromise between the size of data that can be processed by the server per a single database request and the configured limit on PHP execution time. You can raise it to any reasonable value if your web server is capable to handle it.

PHP settings you might need to increase

When WP Cerber creates an export file, it tries to allocate additional resources by changing default PHP settings, which you normally don’t need to change manually. However, on some hostings, this is blocked by server policies and the only option you have is to set them manually in the php.ini file.

  1. You can control the amount of time PHP allows a script to execute by changing the max_execution_time directive in your php.ini file. The standard value is 30 seconds. Try to set it to 60 seconds.
  2. By changing the memory_limit directive, you can control the amount of memory a PHP script can consume. The normal value is 256 MB. The good one is 512 MB.

Have any questions?

If you have a question regarding WordPress security or WP Cerber, leave them in the comments section below or get them answered on the community forum.

Spotted a bug or glitch?

We’d love to fix it! Share your bug discoveries with us here: Bug Report.

I'm a software engineer and team lead at Cerber Tech. I started coding in 1993 on IBM System/370 and today software engineering at Cerber Tech is how I make my living.

View Comments
There are currently no comments.