It "smells" like that you're running into general timing issues, especially
if you're consistent with how long it takes to put info into the database.

If we were to take your scenario of 100 threads of writing to memory,
bashing the hell out of the database for writes, the first thread is going
to lock the database, the other 99 threads are going to get put on hold for
a period of time.  The first thread is going to release, then *when* the
waiting threads start making write requests, one is going to get the lock,
the others are going to get put on hold again.  Since hardware is fast
enough, you may find yourself in a situation where all 100 threads are
actually counting down and waiting to write to the database.

If we start writing to the platter/ssd, you might actually see a shorter
time out since the delays between the waiting periods become spread out.

I'm not sure if there is anything that broadcasts to other threads that
writing can resume.  Transactions may also cause problems as well for
timing since it can take a long time to write data out.  The other thing I
just thought about is that if the database is locked while trying to open a
new connection, you may run into a 1-2 second delay before you can start
doing ANYTHING with the database since it is technically in a read-only
state.  Are you opening/closing connections to the database at every
iteration in every thread?  (Meaning you start the testing process, threads
are launched to open a connection, you do your work, you close the
connection, destroy the thread, then repeat as needed)


On Thu, Aug 7, 2014 at 2:53 PM, Jensen, Vern <vern.jen...@cshs.org> wrote:

> Real hardware. 27” iMac (native BootCamp running Win 7) with 3.4 GHz Intel
> Core i7 quad-core processor. And my mistake: 24 GB of RAM, not 20. Anytime
> I’ve looked at the app while it’s running, it’ll take 5 to 15 MB at most,
> depending on how many threads I give it.
>
> -Vern
>
> ----------------------------------------------------------------
> Vern Jensen
> Software Engineer
> Artificial Intelligence in Medicine (AIM) Program
> jens...@cshs.org<mailto:jens...@cshs.org>
> Office: 310-423-8148 :: Fax: 310-423-0173
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to