Hi there,

I've been using sqlite for a few years now and it worked fine in my experience.

Now that I have some time, I'm stress testing it to see how much I can get from 
it; what I want to check is its performance in a multithreading environment.

To my surprise, it seems that serialized access to the database (which is the 
default in the source code for Windows) is ~20% faster than multithreading (no 
matter how the shared cache option is set). 



My test program creates 4 threads that do some work on a single table of a 
~200MB WAL-based database. 

First two threads do only SELECTs; third thread does UPDATEs; fourth thread 
does INSERTs; the SQL commands are not wrapped into explicit transactions.


Serialized test (SQLITE_THREADSAFE=1):

The main thread opens the database, sets the cache and busy timeout to huge 
values and passes the db descriptor to the threads.


Multithreaded test (SQLITE_THREADSAFE=2):
The main thread creates the other threads and wait; each thread opens its own 
database connection and sets the cache and timeout (using a shared cache 
required some changes to handle the LOCKED return codes, but didn't give better 
results).



Is this the expected behavior or am I missing something?
Thanks in advance.

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

Reply via email to