On Wed, 2004-09-22 at 16:17, Paul Smith wrote:

> We have the AsyncAppender already, unless ConcurrentAppender does something
> different?

I suppose the main difference would be that you would be appending in
the same thread that you executed the log statement in.  Each thread
would be writing to the database at the same time and would not be
waiting.

Here are three different ways to log events to the database from two
threads:

--> means call

Single lock strategy: (current one)

Thread 1  -->    Appender  -->  Database.insert
Thread 2  -->    (wait)

This tends to create bottlenecks if two threads are logging at the same
time.


Concurrent strategy:

Thread 1  -->    Appender  -->  Database.insert
Thread 2  -->    Appender  -->  Database.insert

This has an advantage on multiprocessor machines or when the database
can handle inserts simultaneously.


Asynchronous strategy:

Thread 1  -->    Appender  -->  Enqueue Job
Thread 2  -->    Appender  -->  Enqueue Job
Thread 3  -->    dequeue Job --> Database.insert

This is good for when Thread 1 & 2 don't want to wait for the insert to
complete.  Probably the same performance as the concurrent strategy,
except on multiprocessor machines.  An additional thread (or threads)
are required.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to