You are viewing limited content. For full access, please sign in.

Question

Question

Multiple requests from Workflow to the SQL database

asked on September 1, 2016 Show version history

It appears the following statement is being run more than once a minute against the WF databases

delete from workflow_task_queue where status = 8

That statement sometimes completes instantly and sometimes takes more than a minute to complete.

When it goes long, you end up with multiple requests of the same statement overlapping each other and locking log files.

There were over 160 requests overlapping each other within 20 minutes.

Can the frequency of that statement execution be legitimately reduced or prevented if it is already running on another thread?

0 0

Replies

replied on September 14, 2016

The frequency is set on the Tasks tab in Advanced Server Options in the Workflow Admin Console. You can increase it.

Unchecking the box changes task deletion at the end of each task which may result in more queries being sent to SQL (though they should be fast to run).

0 0
replied on May 10, 2022

When the "Delete completed tasks based on a timer instead of automatically" is selected, how often does it run and how old does the data need to be to be deleted?

replied on May 10, 2022

How old does the data need to be in order for it to be deleted with the "Delete completed tasks based on a timer instead of automatically" selected? Is it running a stored procedure or a hard coded statement to do the cleanup?

0 0
replied on May 10, 2022

The age does not matter, it will run a delete command for completed tasks every <frequency> minutes.

If the checkbox is cleared, as tasks complete, they'll be cleared from the table immediately. If the checkbox is checked, then WF will only issue one delete command with the specified frequency.

0 0
replied on May 10, 2022 Show version history

If the checkbox is selected and there are entries from 5 days ago, what would be the correct action to take?

Also, what would cause them to not be deleted correctly?

0 0
replied on May 17, 2022 Show version history

For now I am running the following query against the Workflow database each night to keep it cleaned up until we figure out what is causing Workflow to not cleanup the tables correctly. Within a 24 hour period we are seeing over 400,000 rows in the table.

GO
DECLARE @counter AS INT = 1, @message AS VARCHAR(100)

WHILE EXISTS (
	SELECT 1
	FROM LF_Workflow.dbo.workflow_task_queue
	WHERE Status = 8
	)
BEGIN
	SET @message = 'Start of loop number ' + CAST(@counter AS VARCHAR) + ' - ' + CONVERT(VARCHAR(24), GETDATE(), 113)
	RAISERROR(@message, 10,1) WITH NOWAIT
	DELETE TOP (5000)
	FROM LF_Workflow.dbo.workflow_task_queue
	WHERE Status = 8
	SET @message = 'Completed loop number ' + CAST(@counter AS VARCHAR) + ' - ' + CONVERT(VARCHAR(24), GETDATE(), 113)
	RAISERROR(@message, 10,1) WITH NOWAIT
	SET @counter = @counter + 1
	WAITFOR DELAY '00:00:05'
END

 

1 0
replied on September 15, 2022 Show version history

We are experiencing the exact same thing.  One of our workflow servers suddenly decided that it wasn't going to clear the completed items in the workflow_task_queue table.  There were over 22 million entries.  The database kept growing and we didn't initially know why.

Also, if I uncheck "delete completed tasks based on a timer..." they are immediately deleted.  I do like the idea of only having one delete run every X minutes rather than a delete command every time an activity completes.  Did you ever figure out how to get this working again?  We even tried disabling/re-enabling, changing the values and then resetting them.  Nothing seems to matter.  No matter what we do, if we leave it set to delete on a schedule, it never runs.

Also, I couldn't find a SQL job or scheduled task that is triggered by this setting.  Do you know where the actual job lives?

0 0
replied on September 15, 2022 Show version history

We ended up unchecking the 'Delete completed tasks based on a timer instead of automatically' and that has resolved our issues.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.