On 28 Apr 2019, at 6:22pm, Lullaby Dayal <lullaby.tec...@gmail.com> wrote:
> SQLite supports an unlimited number of simultaneous readers, but it will only > allow one writer at any instant in time. Please note that this is a statement about how one journal mode (WAL) works. Are you telling us that you're using that mode ? Also note that SQLite has no client/server element. It doesn't keep the database in memory. Unless your threads are sharing a connection, or you're using shared-cache mode, your threads don't communicate with each other. Every command that accesses the database accesses its storage medium. And since your storage medium can process only one command at a time, really only one thread has access to the database at a time. > I have written a test application running on Linux with sqlite3 library in > serialized mode. My test application has 200 parallel threads in which 100 > threads are executing SELECT * operation from a table and 100 are executing > update table (alternate fields in alternate run) command in auto-commit mode > (while(1)). Your post misses a detail which changes the answers to your questions: are these threads each using their own connection or do they share one connection ? If more than one connection is involved, are your connections sharing cache as described here: <https://www.sqlite.org/sharedcache.html> Once you've answered that, there are other considerations: Have you set any timeout on each connection your application uses ? Are you enforcing a mutex in your threads or are you depending on SQLite to do all locking necessary ? If your application uses many separate connections, with timeouts set, SQLite takes care of a lot of the locking involved. If your application tried to use one connection to do many things at once, you, as a programmer, have to pay more attention to problems which simultaneous access might involve. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users