Rock U - Workflows - Workflow Performance Tips
Transcribed Video Content
As workflow volume climbs, workflows can be slow if they're made sloppily. They can even leave instances behind. But we've got some tips that will keep your workflows fast and easy to maintain. So to keep our workflows performant, here are some great habits. I'll step through them quickly, but complete every activity in the workflow itself.
So you want to always make sure that at the end of the workflow process, everything is actually completed, which sounds simple, but it's something you're gonna wanna make sure your workflow does to make sure that it's easy to track later on what workflows have been completed. Then let the last action mark its activity complete so that a workflow is easy to read and understand. Then turn off persistence for a single pass workflow. So persistence is important to understand. It essentially lets where a workflow is at in the process and see what happened.
It's hitting save on a workflow when things change. And you won't need this if you're doing something a trigger where the workflow is just gonna run. You don't need to see what it looks at each stage of the workflow and save it in each position. There's gonna be a lot of times where you don't need persistence. And if you don't need it, it's nice to switch it off, especially because that first save, the first time you persist a workflow will be it'll have the biggest performance impact.
Then keep your logging modest so your database stays lean. You don't need logging all the time as well. You will want logging if you're debugging a workflow as you're working through it at first, as it tells you the values such as attributes in a workflow and helps you see where things break. But generally, when you're done with making sure that a workflow works properly, you don't need logging most of the time. Then it's nice to break a workflow into smaller helpers so that it's easier to understand each part of the process and know what's going on, and it's much easier to maintain this way as well.
Then action filters, which are these things you can add where you say, don't move on till the next action until this condition is met. Be careful with when you add those because you might end up with activities or workflows that don't complete and you don't know why. It could be because you added an action filter. Then clear out old instances on a schedule. This is just a really nice way to maintain and keep your database clean and everything performant.
If there's old instances of a workflow that you don't need anymore and the purpose has been met, then you can actually go clear those out and save yourself some space. A little discipline upfront keeps your workflows performant and your database clean. Setting these up will pay off every time a new instance runs.