Everything appears to be running fine, but...  I was reading the thread late
last week about SQLITE_BUSY and it got me wondering if I am doing things
correctly.

For starters, my usage of SQLite is in an Windows Apache Module and within
some Axis2/C web services loaded via the Apache Modules.  What this means is
this:

   1. Only one process is accessing the DB right now.
   2. Lots of threads, up to 53, could be accessing the DB at one time.
   3. When the Apache module loads, it calls sqlite3_initialize, as does
   each of the Axis2/C web services, fore each one is it's own entity.
   Everyone calls sqlite3_shutdown() as well.
   4. There are two independent phases:  The Apache modules's usage of the
   DB, the Axis2/C usage.  The request might or might not go through the
   Axis2/C.
   5. The majority of the traffic is read only.

What I have done, to make development easier, is to encapsulate each general
DB call with it's own  sqlite3_open_v2() and sqlite3_close().  Example:

   1. Request comes in and DB is opened for read-only to get configuration.
   2. The authentication/authorization code opens DB for read-only to check
   state
   3. If update is needed, the authentication/authorization code opens for
   read/write to update the user info.
   4. If the request goes to the web service, it will open in read-only most
   of the time and read/write when needed.

My main concern is #2 and #3, that is all in the same function right now,
but has two totally different open/closes.  I opted for this approach
because there will be a ton of reads at one time and hopefully the writes
will be a lot less often.  So I figured it was better to make #2's open be
read only and take the hit on a second open/close iff an update needs to
happen.  Is this assumption correct?

I don't seem to have a performance issue with the general approach of doing
multiple open/closes for each request, are there pitfalls out there that I
am missing?  Might it be worth the time and effort to keep the same
connection through each request?

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

Reply via email to