On 5 Oct 2017, at 3:17am, Hegde, Deepakakumar (D.) <deep...@allgosystems.com> 
wrote:

> 2) Both the link are added the busy handler and busy handler function is 
> retries for 10000 times with 10ms second of delay.
> sqlite3_busy_handler(psRaceSqlite->sSqliteInfo.pSqlHandle,           
> dbm_sqlite_busy_handler,psRaceSqlite);

Instead of this, just set an timeout, which in your case would be 1000000ms.  
This may look big but is an appropriate value.

<https://sqlite.org/c3ref/busy_timeout.html>

SQLite’s own timeout routine knows more about how SQLite works than yours do.  
It implements exponential backoff and other clever things.  Do not try to use 
both at once: strip out your use of sqlite3_busy_handler() .

Remember that you need to set timeout for every connection separately, in other 
words not only for the connections doing IHSERT but for the other processes 
which are reading or doing individual INSERT commands.

> 3) In one thread there is a continuous record insertion with begin and commit 
> operation. This begin and commit will be done with for every 200 record 
> insertion. time for a single begin to the commit is about 1 second.

Use BEGIN EXCLUSIVE.

After each COMMIT, pause for at least 20ms.  If that doesn’t improve things you 
may need more — anything up to 1000ms could help.  You could set that number 
for testing then reduce it until it stops working.

Thank you for your detailed description and timings which help us make good 
suggestions.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to