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?
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
For sites hosted on Kinsta, the PHP max_execution_time
and max_input_time
are set to 300 seconds by default. The maximum PHP timeout values available on our platform are based on your current hosting plan.
If you’re running into PHP timeouts, we recommend working with a developer to resolve the issue. For example, instead of running an import process via a long PHP request, it would be better to run the import directly on the container using WP-CLI or a local PHP or Bash script.
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.
Getting Help
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 – you can use DevKinsta – 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.
Save time, costs and maximize site performance with:
- Instant help from WordPress hosting experts, 24/7.
- Cloudflare Enterprise integration.
- Global audience reach with 34 data centers worldwide.
- Optimization with our built-in Application Performance Monitoring.
All of that and much more, in one plan with no long-term contracts, assisted migrations, and a 30-day-money-back-guarantee. Check out our plans or talk to sales to find the plan that’s right for you.