Use of WP All Import, the WordPress Importer, and similar plugins to import XML files, CSV files, WXR files, and images is a common task for developers and sites with content that changes frequently. However, it is also common for timeouts and website performance issues to occur while these imports are being processed.
In this article, we’ll discuss steps you can take to work your way through a challenging import process.
Please note that we cannot guarantee that every import process will run successfully on our platform. If the import cannot be run successfully at Kinsta we recommend performing the import in a local development environment and then importing the updated database or table to your website database.
- Why Do Imports Cause Timeouts and Performance Issues?
- Dealing with PHP Timeouts
- Dealing with HTTP Timeouts
- Dealing with Website Performance Issues
- Getting Help
- Next Steps – Local Development Workflow
Why Do Imports Cause Timeouts and Performance Issues?
There are two types of timeouts that large import processes typically run into:
- PHP timeouts occur if a single PHP process runs for longer than the max_execution_time or max_input_time set in the PHP configuration. When this happens a 502 server error is usually displayed.
- HTTP timeouts occur when the connection between your browser and the web server is held open for too long. When this happens a 504 gateway timeout error is usually displayed.
It is common for website performance to also be slower when a large import is running. This is because PHP and MySQL are busy handling the import process. This causes regular traffic to the site to have to wait until PHP and MySQL are available to generate the page requested.
Dealing with PHP Timeouts
If you run into a PHP timeout the max_execution_time and max_input_time may need to be elevated. On our platform, these values are set to 300 seconds (5 minutes) by default. The maximum PHP timeout values available on our platform are based on your current hosting plan.
- Starter and Pro plans: 300 seconds is the highest value we can support.
- Business plans: We can temporarily elevate the timeout to 600 seconds (10 minutes).
- Enterprise plans: We can elevate the value to 600 seconds (10 minutes) permanently or temporarily to 1800 seconds (30 minutes).
A temporary increase in the timeout duration would be appropriate if you need the timeout duration elevated for less than 4 hours in order to complete a one-time import process. If you expect to need the elevated timeout value for a longer period of time or on a recurring basis you will need to upgrade to an Enterprise plan.
We do not allow timeouts to be set to longer than 600 seconds on any plan on a permanent basis. Our experience has been that sites that require longer timeout durations on a permanent basis will experience significant stability issues during these long-running processes. Rather than sacrificing website stability, if you have recurring processes that require longer timeouts the best solution is to work with a developer to adjust the long-running process rather than to keep increasing the timeout duration.
If you’d like to request a temporary or permanent increase in the PHP timeout settings please open a support ticket.
Dealing with HTTP Timeouts
HTTP timeouts typically occur after 60 seconds for sites hosted at Kinsta. Due to the design of our infrastructure, we are unable to increase the HTTP timeout duration.
If you experience an HTTP timeout there are two steps you should attempt to resolve the issue:
- If the process is timing out while the import file is being uploaded switch to a faster internet connection and retry the process.
- If you are using a tool with support for WP-CLI, such as the WordPress Importer plugin, you can run the import directly on the server and bypass the HTTP connection entirely.
Please note that running an import over SSH is a change to the content of your website is not within the scope of what our support team is here to assist you with. In addition, if you are not familiar with SSH you will either need to learn how to use this powerful tool or work with a developer to process the import over SSH.
Dealing with Website Performance Issues
If the import process is running successfully but your site is performing poorly during the process you have two options:
- Schedule the import activity for a time of low traffic to minimize the impact on your site’s visitors.
- Upgrade to a plan with more PHP workers on your live site. If the performance issues are due to PHP being unavailable to handle more requests upgrading temporarily to a plan with more PHP workers will mean PHP has more capacity to handle both traffic to the site and the import.
- Upgrading a plan will not help if you’re trying to run an import on a staging site. Our staging environment has a constant set of PHP workers and will not be affected by plan upgrades.
Upgrading plans to gain access to more PHP workers will not help in all cases. If your site is running slowly because the database (MySQL) is busy inserting content into the database then adding additional PHP workers is unlikely to speed up the performance of your site.
If you’ve worked through the prior suggestions in this article, are still running into issues, and would like assistance, the next step would be to reach out to our support team. However, before opening a conversation with our support team please gather as much information as possible.
- Start the import and time how long it takes for the process to fail. If the process fails after 1 minute you are likely running into an HTTP timeout. If it fails after 5 minutes you are likely running into a PHP timeout. If it fails at some other point you are likely running into some other limit or error and not actually seeing a timeout.
- Check the error logs at the time that the import failed and see if an error was recorded at the time of the failure.
- Take a screenshot of the error message or error page you are observing.
- Write a concise description of the type of file you are trying to import, how the file was created, what it contains, the tools used to create the file and run the import, and the error you are experiencing.
Once you have gathered this information open a ticket with Kinsta’s support team. However, please note that we cannot guarantee that we will be able to assist you in getting every import to run successfully.
Next Steps – Local Development Workflow
If running the import in Kinsta’s environment is not possible the next step would be to develop a new workflow for the import process where the import is run in a local development environment. Please note that a developer will need to be involved in this process to ensure no data is lost and that your site database is not damaged.
In general, the process would be to set up a copy of your site in a local development environment where you can control all of the timeout limits. Then complete the import in that local environment. Once the import is complete, export a copy of the WordPress database or the updated database tables from your local environment. Then create a backup of your live website, drop the database (or affected tables) from your live website, and import the database or tables exported from your local environment.
If you enjoyed this tutorial, then you’ll love our support. All Kinsta’s hosting plans include 24/7 support from our veteran WordPress developers and engineers. Chat with the same team that backs our Fortune 500 clients. Check out our plans