Nick,
I have tested my Async appender and your appenders on a multiproc box. First
off, my appenders were not opening the file in an async mode. I fixed that
and ran a hammer test. Your appenders are faster in all cases. I also noted
this statement in the MSDN for [BeginWrite] method "Note: On Windows, all
I/O operations smaller than 64 KB will complete synchronously for better
performance. Asynchronous I/O might hinder performance for buffer sizes
smaller than 64 KB." I have not been able to produce a test case where the
async appenders are needed over your appenders. Here is the hammer method I
use to output the debug tests. So, based on my testing I would stay with
what you have unless somebody sees a flaw in my thinking.
-matt
//when you run tests, make sure you are only logging to file and not console
or trace.
[SetUp]
public void RunBeforeEachTest()
{
rEvent = new ManualResetEvent(false);
}
[Test]
public void TestLogWithHammer()
{
log.Debug("Begin hammer test.");
//create 100 threads
Thread[] t = new Thread[100];
for (int i=0; i<100; i++)
{
t[i] = new Thread(new ThreadStart(Hammer));
t[i].Name = (i+1).ToString();
t[i].Start();
}
//make sure all threads have started
Thread.Sleep(100);
//fire event
rEvent.Set();
//join all threads so they can all finish
for (int i=0; i<100; i++)
{
t[i].Join();
}
}
private void Hammer()
{
if(rEvent.WaitOne())
{
for (int i=0; i<100; i++)
{
log.Debug("hammer iteration-"+i);
}
log.Info(">>Done");
}
}
-----Original Message-----
From: Nicko Cadell [mailto:[EMAIL PROTECTED]
Sent: Monday, March 01, 2004 8:41 AM
To: 'Log4NET Dev'
Subject: RE: async appenders
Matt,
Thanks for the upload. I'm not sure why the list does not accept ZIP files,
I will have to look into that.
>From having a quick look through the code it looks like you are using the
Stream.BeginWrite to achieve the asynchronous behaviour (after changing the
appenders to write to a stream rather than a text writer).
How does this perform when compared to synchronous file writing?
Nicko
> -----Original Message-----
> From: matt baldree [mailto:[EMAIL PROTECTED]
> Sent: 27 February 2004 02:35
> To: [email protected]
> Subject: async appenders
>
> I uploaded the zip file to the SF site. It is patch number [905560].
>
> -matt
>