Ok - could you elaborate on the first "this is what one would expect". What 
difference does it make whether I use two threads or 20 threads with one 
connection when all operations are serialized? Shouldn't both cases have the 
same throughput?


On Friday, 21. September 2012 at 03:52, Keith Medcalf wrote:

> > With two threads, using only one connection (87.8 s) is actually slower than
> > using two connections (66.7 s). The performance of using only one connection
> > drastically increased until a thread count somewhere between 10 and 20 where
> > it settles at about 11 seconds. Using one connection per thread reduces the
> > elapsed time only from 66 to 55 seconds.
> > 
> 
> 
> This is what one would expect.
> 
> > * The virtual machine has 2 CPU cores assigned. When using only one
> > connection, only one core seems to be used. When using one connection per
> > thread, both cores are used.
> > 
> 
> 
> This is also to be expected. 
> 
> Because thread access to the sqlite engine is serialized by a mutex, the OS 
> ought to set thread affinity for all operations running through the same 
> mutex to the same CPU. If you repeated the test using two connections only, 
> and spreading your threads amongst connections, you ought to be able to get 
> about 5 or 6 seconds with 10 to 20 threads per connection.
> 
> 
> 
> 
> 
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org (mailto:sqlite-users@sqlite.org)
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 


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

Reply via email to