Hello...
For quite some time now i have been trying to find ways to get maximum possible performance out of SQLite in my application. Here is the configuration of SQLite I am using, for benchmarking (Till now the road has been quite bumpy and it will be great if anyone has any idea about how to resolve it).
- Data source is set to memory.
- I have two command from the same connection, one command i use for inserting/updating and other for selecting.
- One thread is continuously inserting records and the other one is continuously selecting. Metrics for performance are number of inserts per second, number of selects at that time and how low is the difference between the two.
Now i know that this not the right way of multithreading (rather it will give unexpected sequence of instructions exception :-s) but i am forced to use only one SQLConnection as same in-memory databases can't be shared accross multiple connections. So i have been trying to syncronize it using all i know and this is where all the peoblem is. Sometimes one thread simply hangs, sometimes both, sometimes inserting speed is too low, etc, etc etc....
Just beforing writing this i came accross Async command interface of ADO.NET 2.0 for sqlserver 2005 and i think this is what may be the solution (for sqlite). Following is the code i am using now and this code seems to give this exception
"System.Data.SQLite.SQLiteException: SQLite error SQL logic error or missing database"
Code is pasted here
Please let me know what is the problem here.
PS: I have also tried using synclock instead of ReaderWriterLock but then problem of locking occurs.