How to - Increase timeout value of a SharePoint workflow

I was recently working on an issue where customer had a workflow which used to fail and error out after the workflow would execute for some tasks. On deeper analysis I found that the workflow was creating 5000 tasks and it is then when the workflow errored out. On checking the Workflow and ULS traces I found the error message as (have to say least helpful):

<Error Message>

- Workflow Infrastructure 72fg High Error in persisting
workflow: System.Transactions.TransactionAbortedException: The transaction has
aborted. ---> System.TimeoutException: Transaction Timeout --- End of inner
exception stack trace --- at
System.Transactions.TransactionStateAborted.CreateAbortingClone(InternalTransaction
tx).
- System.Workflow.Runtime.Hosting Error: 0 : DefaultWorkflowCommitWorkBatchService
caught exception from commitWorkBatchCallback:
System.Transactions.TransactionAbortedException: The transaction has aborted. --->
System.TimeoutException: Transaction Timeout

</Error Message>

It somehow came in my mind that it has to be that the workflow was timing out. On googling I found a way to increase the time out value fo the workflow from the default value – 1 min to 30 mins. Do this, in the web.config file of the web application we need to set the default
value to something more ( in this case its set to 30 mins )
<configuration>
<system.transactions>
<defaultSettings timeout="00:30:00" />
</system.transactions>
</configuration>

 

And viola this worked.