Problem
K2 server consuming high memory usage (spiking to 99%) causing slowness and the K2 service crashes intermittently
Solution
A memory dump was captured when the K2 server was consuming over 10GB of memory. When analyzing the dump, Labs identified that a specific data field from one of the workflows was consuming a lot of memory.
The data field consumes just over 13GB of memory. Crucially it is not that a extremely large value is saved in the data field but the fact that Audit is turned on for the data field and it is changed 19500 times during the execution of the process.When the Audit setting is turned on for a data field the old value of the data field is kept every time the data field changes. This builds up significantly in memory in this case.To resolve the issue, turn off the 'Audit' setting for the data field in question and redeploy the workflow. Another option would be to try and understand why the data field is changed so many times and have it update less.Please refer to the following documentation on the Audit option: https://help.nintex.com/en-US/k2five/userguide/current/Content/K2-Workflow-Designer/Use/ContextBrowser/Fields/Fields.htm