I have a few ideas you could try with a file db. 1. Use VFS with no locks - named "win32-none" or "unix-none" depending on your system (4th argument to sqlite_open_v2).
2. Run "pragma locking_mode=exclusive;" on each connection or compile SQLite with -DSQLITE_DEFAULT_LOCKING_MODE=1 3. Compile SQLite with -DSQLITE_MAX_MMAP_SIZE=<equal or greater than your database file> and -DSQLITE_DEFAULT_MMAP_SIZE=<same value as before> 2018-05-13 12:50 GMT+02:00, Techno Magos : > Hello > > I do not have clear examples to post on this but would like to report > findings around multi threaded read access (single process) in a large > system that uses sqlite. > > This may be a known issue/restriction of memory sqlite behaviour, but > wanted to check with the list first: > > 1. Running 2, 3, ... 6 multi threaded readers of a single *memory *sqlite > database (via shared cache mode) on an 8 core cpu shows no throughput gain > at all compared to single threaded throughput. In fact, it shows a > throughput drop: i.e. if a single thread can do N simple queries/sec, 2 > threads .. up to 6 threads do a little less (10% drop) in total. This > suggests that access to memory sqlite can only be serialized? > > 2. Running the same example on sqlite *file *(multi threaded mode; WAL > journal) scales almost linearly; so 6 threads provide nearly 6xN > throughput. Single threaded throughput is a bit slower (around 15-20%) > than single threaded in-memory access (expected). > > So, memory sqlite is not really usable with multiple threads (readers). > While one might expect that multiple readers of *memory *content could > scale even better than with file content. > > Can this restriction be lifted? > Is there some special mode possible to achieve scaling up throughput with > multiple threads for memory sqlite content? > > > Thanks > _______________________________________________ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users