Discussion of open issues, suggestions and bugs regarding LiteDAC (SQLite Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
- Posts: 19
- Joined: Sun 05 Jun 2016 17:11
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: 1025
- Joined: Mon 06 Jul 2015 11:34
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.