G
Guest
Here is another question we have been meaning to post for a long time. My
colleague is literally pulling chunks of hair out of his head right now.
We have a logging class. This class is mutlithreaded (as required by our
boss). So when we tell the class to log something, it puts the data into a
queue, and logs it to the disk when it has time later (low priority thread).
Its simple. As stated above, I throw data into the queue. The low priority
thread comes along, senses the queue has elements in it, pops them, and logs
them to disk.
For the most part it works fine. But sometimes entries will be radically
out of order. Some are even out of order by a placement of 100+ lines or
more!
I can reproduce this behavior in sample programs. I have a log file
integrity analyzer built as well that will tell you what lines are out of
order. And the results are bad.
We have played around with the creation of the queue object quite a bit.
And the results vary a little, but we cannot find that magical number
combination that works.
Ex: this.LoggingQueue = new Queue(2048, 10);
Before we just had this.LoggingQueue = new Queue();
Both are still yeilding terrible results.
Any suggestions? We can post more code if needed.
Thanks!
Rob K
colleague is literally pulling chunks of hair out of his head right now.
We have a logging class. This class is mutlithreaded (as required by our
boss). So when we tell the class to log something, it puts the data into a
queue, and logs it to the disk when it has time later (low priority thread).
Its simple. As stated above, I throw data into the queue. The low priority
thread comes along, senses the queue has elements in it, pops them, and logs
them to disk.
For the most part it works fine. But sometimes entries will be radically
out of order. Some are even out of order by a placement of 100+ lines or
more!
I can reproduce this behavior in sample programs. I have a log file
integrity analyzer built as well that will tell you what lines are out of
order. And the results are bad.
We have played around with the creation of the queue object quite a bit.
And the results vary a little, but we cannot find that magical number
combination that works.
Ex: this.LoggingQueue = new Queue(2048, 10);
Before we just had this.LoggingQueue = new Queue();
Both are still yeilding terrible results.
Any suggestions? We can post more code if needed.
Thanks!
Rob K