Answers.Body: <p>Sprout SEO is running the Craft provided <code>ResaveElements</code> task when you save the field. The same <code>ResaveElements</code> 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.</p>
  
  <p>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 <code>craft_tasks</code> table and retrigger the events so they are not triggered multiple times and see if that helps.</p>
  
  <p>The best long-term solution will probably be to increase the resources on your server to ensure things go smoothly.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-09T12:03:14.530Z
Answers.Text: Interesting, what kind of server resources would you recommend? I can temporarily scale it up to just do this operation.
Answers.UserDisplayName: hisnameisjimmy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-09T12:39:38.270Z
Answers.Text: 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.
Answers.UserDisplayName: hisnameisjimmy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-09T14:34:00.017Z
Answers.Text: 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.
Answers.UserDisplayName: Ben Parizek
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-09T02:32:00.653Z
Answers.LastActivityDate: 2018-01-09T02:32:00.653Z
Answers.UserDisplayName: Ben Parizek
Body: <p>I added an element metadata field to my Sprout setup so that I could control things and automate a bit: <a href="https://sprout.barrelstrengthdesign.com/craft-plugins/seo/docs/core-concepts/element-metadata-field" rel="nofollow noreferrer">Element Metadata Field</a></p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p><a href="https://i.sstatic.net/E3BAN.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/E3BAN.png" alt="enter image description here"></a>
  <a href="https://i.sstatic.net/gt3po.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/gt3po.png" alt="Digital Ocean CPU/Memory Graphs"></a>
  <a href="https://i.sstatic.net/CGfyl.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/CGfyl.png" alt="Top running on CLI"></a></p>
  
Tags: <plugin-sproutseo>
Title: Sprout SEO Re-saving Entries and metadata CPU 100%
ThreadText: # Sprout SEO Re-saving Entries and metadata CPU 100%
  
  (Asked by: username_0 on 2018-01-08)
  
  I added an element metadata field to my Sprout setup so that I could control things and automate a bit: [Element Metadata Field](https://sprout.barrelstrengthdesign.com/craft-plugins/seo/docs/core-concepts/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](https://i.sstatic.net/E3BAN.png)](https://i.sstatic.net/E3BAN.png)
  [![Digital Ocean CPU/Memory Graphs](https://i.sstatic.net/gt3po.png)](https://i.sstatic.net/gt3po.png)
  [![Top running on CLI](https://i.sstatic.net/CGfyl.png)](https://i.sstatic.net/CGfyl.png)
  
  **Tags:** plugin-sproutseo
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-01-09. Score: 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.
  
  > **Comments:**
  > **username_0**: Interesting, what kind of server resources would you recommend? I can temporarily scale it up to just do this operation.  
  > **username_0**: 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.  
  > **username_1**: 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.  
  
  ---
  
  