I recently created a complex workflow that loops through several other lists to verify the accuracy of the item submitted to a library. While debugging the workflow as I was building it, 80 versions were created and I must have run the workflow itself over 200 times. The more I modified the workflow and tested the slower the workflow history was loading and the larger the site collection database was getting.
Figure 1: Show Detailed Workflow Action History
At a certain point, I was unable to manually start the workflow and I was unable to view the workflow history without the server timing out. In SharePoint 2013, every Nintex Workflow action is saved to workflow action history by default. My workflow had several foreach loops that were effecting workflow performance. To combat this, I starting looking over the Nintex document "Workflow Performance improvement and load reduction.pdf." On page 14 of the document there is a section that mentions to modify logging for the following actions:
- Collection Operations Actions
- For Each Actions
- Loop Actions
To modify the action, do the following:
- Open a workflow with any of the three actions listed above
- Select the action itself and all actions nested inside?
- Select the common tab
- Select the "Hide from workflow status" checkbox
Figure 2: Hide from workflow status
After hiding the action from workflow status, you will no longer see the graphical representation of the workflow when viewing workflow history. When hiding the workflow status for the loop action, it will hide the status for all nested actions in the loop.
Figure 3: Hide action on Create item (left) No Hiding (middle) Hide action on loop (right)
After making the modification I noticed my workflows are starting much quicker and opening workflow history causes no issues. If you would like to see the data that is being stored in SQL, open the Nintex content database and view the dbo.workflowprogress table. Now that the workflows are performing as expected, I would like to cut down on the amount of storage required. Whenever you create a workflow in a site it is stored in a hidden list:
This hidden list limits you to having one workflow of the same name per site and is the location where all workflows are stored. When publishing your workflow over and over, Nintex automatically creates versions of that workflow and saves them in the hidden list. When creating more complex workflows you can have over 100 versions of the same workflow - easily. With this much information stored in a hidden list your database size can grow unexpectedly. To avoid this, once you have a workflow that is working as expected, export it and delete it. This will remove all versions of the workflow that are stored in SharePoint and will allow you to import the same workflow back into SharePoint. It will drastically cut down on the storage required for your new workflow depending on its complexity and number of versions.
- Navigate to the hidden workflow history list for your site
- Find the workflow that has several versions
- View the size of the folder
- Navigate to the site and export the workflow
- Delete the workflow from the site
- Delete the folder from the hidden list
- Import the workflow
Check the new size of the folder
Figure 3: Hidden Nintex Workflow List