BusyTimeout and high concurency question

Discussion of open issues, suggestions and bugs regarding LiteDAC (SQLite Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Max Terentiev
Posts: 17
Joined: Sun 05 Jun 2016 17:11

BusyTimeout and high concurency question

Post by Max Terentiev » Sun 15 Jan 2017 13:56


I have two kinds of threads in my application:

1. Threads for fast writes: insert/update/delete one record.

2. Threads for bulk operations: insert/delete millions records.

Bulk opterations are split by 5000 inserts/deletes per transaction.

My question is: how long I should sleep between bulk transactions to let other threads perform fast (one record) insert/update/delete transactions ?

For bulk operations I perform:

Code: Select all

while not done do
   Sleep(PauseTime); // How long I should sleep to let other threads perform quick writes ?
PauseTime should depends on how frequently LiteDac checks for active transactions during BusyTimeout ? If I set 100 milliseconds - it's will be enouch for other threads (who waits in BusyTimeout) to see what database no longer locked and it's possible to perfrom their fast transactions ?

Thanks for help !

Devart Team
Posts: 863
Joined: Mon 06 Jul 2015 11:34

Re: BusyTimeout and high concurency question

Post by MaximG » Mon 16 Jan 2017 12:37

Setting any specific timeout value in this case is not entirely correct, because the execution time of operations in the used threads will depend on many factors, i.e. it will be determined by the environment parameters. In this case it is better to use one of the threads synchronization methods.

Post Reply