Speeding up WordPress imports with Datafeedr or WP All Import

Some of you may be aware of my External WordPress Images plugin – it basically lets you avoid storing images in WordPress and instead the images are fetched from a remote location. This speeds up imports massively.

But what if you are importing images and still want faster imports?

Debugging WordPress Import Performance

Firstly, I had to analyse what was wrong with the import. So I activated the slow query log (see my slow query log setup guide) and unfortunately found no slow queries to optimise. So what next?

Next, I installed Xdebug (see my guide to activating and using xdebug to analyse PHP performance here), visited the WP All Import import page where the import was ready to run and then restarted PHP to activate the new xdebug settings I had just configured. This is because with the import, I can’t add the URL trigger to force xdebug into action for imports, so I have to run it for everything. I highly advise you don’t do this on a live server, or if so, do it at a quiet time.

Then I looked at the cache grind files to identify which file was still growing in size – WP All Import uses one PHP process for each batch of items it’s importing, so as long as you’re still on the first batch and the file is still growing, you know which cache grind to look at.

Once I had that, I downloaded the cache grind file, opened it with QCacheGrind and saw this:

What the picture above tells me (generated with QCachegrind from the output of Xdebug) is that image resizing is consuming 82% of the import time.

The solution

One thing you need to be aware of with WordPress is that various plugins, themes, and custom code can register ‘image sizes’. These image sizes are then used in code to grab a thumbnail. The theory is to speed up your site – rather than sending a large file to a user, you send a small file. It’s also used to create cropped images.

Anyway, I installed this awesome like plugin – https://wordpress.org/plugins/image-sizes/ – you can learn more about the author of this plugin here: http://nazmulahsan.me/stop-wordpress-generating-multiple-image-sizes/

It’s clearly an unsung little plugin with only 700 downloads, but it’s truly awesome.

With it installed, I visit the Image Sizes menu and see this:

Now – we KNOW that the items being imported aren’t being used in the portfolio section, in this case they’re being used in a WooCommerce shop, so really there’s only 2 sizes needed.

In any case, it’s a simple matter of ticking the boxes for the images you don’t want to keep – for guaranteed compatibility, make sure you choose to keep the largest of each group of image sizes – e.g. I kept the 1200 no-crop above, but not the others, and I chose to keep portfolio-full, but not the others.

Summary

Down to 5 registered image sizes the import which was previously taking days to complete, now completed in one hour.

If you have WP All Import or Datafeedr import performance problems, you can also use the slow query log, xdebug and qcachegrind to identify where your bottleneck exists. Once you know, it’s often trivial to solve the problem.

Follow me

Dave Hilditch

Founder at WP Intense
I founded WP Intense to solve WordPress performance and scalability issues. There is no performance issue that cannot be solved.

Follow on Facebook or our YouTube channel, or leave a comment below.
Follow me