1

I added an element metadata field to my Sprout setup so that I could control things and automate a bit: Element Metadata Field

However, upon saving these field layouts, Sprout wants to re-save all entries. Fair enough, I quickly went through and added the layouts to all my sections. However, I've got 8686 entries, and so far this has taken 5+ hours on a 2 CPU server on Digital Ocean where the CPU is absolutely pegged. This server has 2GB of memory, and 3/4 is reserved for php/craft.

It seems every time I saved, it created new tasks for saving all entries, new regenerating search terms (it created thousands of regen search term tasks), etc. With multi-locale support for 10+ languages, this seems like it unleashed destruction.

enter image description here Digital Ocean CPU/Memory Graphs Top running on CLI

2

Sprout SEO is running the Craft provided ResaveElements task when you save the field. The same ResaveElements task will run if you resave your Section as Craft needs to make sure that if you updated the URL of a section that it saves the right URLs to the database for all entries. (Sprout SEO is doing something similar making sure it has saved metadata needed for output). We have seen sites with a large number of locales experience load when resaving all elements and have seen similar with the resaving of Sections. In all cases where we've seen this, increasing server resources has solved the problem.

In the case this is just caused by a series of one-off changes where things were resaved several times in a row, you could delete the tasks from the craft_tasks table and retrigger the events so they are not triggered multiple times and see if that helps.

The best long-term solution will probably be to increase the resources on your server to ensure things go smoothly.

  • Interesting, what kind of server resources would you recommend? I can temporarily scale it up to just do this operation. – hisnameisjimmy Jan 9 '18 at 12:03
  • Another couple questions... Do you know if this kind of performance hit is improved in Craft 3 for multi-locale? In regards to CPU/Memory scaling, is there an easy way to temporarily scale up memory usage while you do a big load of tasks like this, then scale it back down automatically? Auto-scaling the php memory limit would be nice for stuff like this. I will say, I bumped the server to 8 cores, and it seems to be churning through this stuff much better. – hisnameisjimmy Jan 9 '18 at 12:39
  • We're in the process of upgrading things to Craft 3 and will be exploring ways to improve on this. I can't say for certain but Craft 3 does bring a lot of performance improvements and improvements in how to manage queued jobs, so hopefully that gives us some opportunities to improve things. As far as server resources, I don't know of a much better way that to just up the resources and test things out until you feel you are getting the performance you want. If the task is a truly one off task, sometimes you can just update your resources and run the task locally and re-import the db afterward. – Ben Parizek Jan 9 '18 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.