Hi,

I've read mails in this discussion list, and the documentation on the
sqlite website, but I'm not smart enough to grasp how to solve the
problems of different threads reading and writing from/to the same
database, whitin the same application.

So basically I will have an application which will serve clients, one
thread per client.
Mostly the clients will read from the database, but occasionally write as well.
There will be one operation that will be writing a lot to the
database, a sort of synchronization task, and it will be manually
started.


Plan A.
Each thread/client will have one db connection each and will perform
reading and writing independently.

Plan B.
The application will have only one db connection which will be shared
amongst all other threads. All requests are serialized thru a mutex,
both reading and writing.

Plan C.
Each thread in the application will have one db connection for reading
from the database, but when writing to the db the thread must acquire
a lock on a mutex, so all writing to the database will be serialized,
but reading from the db can be done simultaneous.

Plan D.
Same as plan C but with the modification of not allowing any other
threads to read from the db connection when writing is in progress.

The application is not serving many clients at once, but the amount
of data is fairly large (well at least to reside on an embedded
plattform, i think, that is a couple of MB)

Plan A might be resource consuming since the target platform only has
16MB of ram (don't know if it's a problem really)

With Plan B, the synchronization task will lock up all other clients,
which of course is not the best thing. The other writes will be very
small so other clients will not notice.

Plan C and D, I dont know if this is supported in sqlite?

Could some one point me towards the correct plan, it could of course be plan X.
So basically, the question is: how would you solved this?

I know this has been discussed in other threads, so I'm very sorry if
I'm asking a question similar to others, but I can not sleep before I
figure out how to solve this.

//John

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to