[Qt-interest] Qsqlite performance with multiple processes ?
Bill KING
bill.king at trolltech.com
Wed Apr 1 00:47:19 CEST 2009
This only kicks in after the internal sqlite default locking period of 5
seconds, if I remember correctly.
For changing that value, see
http://www.sqlite.org/c3ref/busy_timeout.html and
http://www.sqlite.org/c3ref/busy_handler.html
also (and this one is the proper way to use it in qt)
http://doc.trolltech.com/4.5/qsqldatabase.html#setConnectOptions
Hope this helps,
Bill.
Stephen Collyer wrote:
> I've taken a look at the Sqlite driver code in
> sql/drivers/sqlite2/qsql_sqlite2.cpp
> and I see the following code:
>
> 195 // keep trying while busy, wish I could implement this better.
> 196 while ((res = sqlite_step(currentMachine, &colNum, &fvals,
> &cnames)) == SQLITE_BUSY) {
> 197 // sleep instead requesting result again immidiately.
> 198 #if defined Q_WS_WIN32
> 199 Sleep(1000);
> 200 #else
> 201 sleep(1);
> 202 #endif
>
> This seems to imply that if a sqlite DB is locked for write by another
> process,
> then this code would block the calling process for 1 second before a
> retry.
> This would seem to make the sqlite driver unusable for any real
> multiprocess
> applications.
>
> So:
>
> 1) is my conclusion correct, or am I confused ?
> 2) why has such a huge retry interval been chosen ?
> 3) does anyone have real experience with qslite in a multiprocess app ?
>
> --
>
> Stephen Collyer
> ------------------------------------------------------------------------
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
--
Bill King, Software Engineer
Qt Software, Nokia Pty Ltd
Brisbane Office
More information about the Qt-interest-old
mailing list