I'm working on SharePoint 2013 workflow, when I'm trying to looping all items, the workflow is terminating and getting error of
The workflow instance was too large to persist (over 5120 kilobytes).
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.Sign up to join this community
It's the default value (5MB) set to the property "WorkflowServiceMaxInstanceSizeKB" by Microsoft, for best performance you need to keep the workflow instance size less than 600KB. Where in your case your workflow instance has exceeded the default value. To keep up the performance, you can use a series of small workflows to achieve your demand or if you want to increase the value, then use the below powershell command to increase value,
Set-WFServiceConfiguration -ServiceUri http://workflowmanagerurl:12291/ -Name “WorkflowServiceMaxInstanceSizeKB” -Value 30720
I'm setting the Value to 30720(which is 30.2 MB)
To get the workflow manager URL (ServiceUri), use the below powershell commands,
Add-PSSnapin Microsoft.SharePoint.PowerShell $wfProxy = Get-SPWorkflowServiceApplicationProxy $wfProxy.GetWorkflowServiceAddress((Get-SPSite -Limit 1 -WarningAction SilentlyContinue)) Remove-PSSnapin Microsoft.SharePoint.PowerShell
After doing the above mentioned steps, then you have to restart the ‘Workflow Manager Backend’ windows service in order for settings changes to be picked up.
For more information about SharePoint Workflow Architecture, you can refer to the article: