Eric, The idea of using a Queue to log the entries looks better. Let me discuss the same internally with the team and senior, then decide its feasibility (certainly depending upon development cost and criticality of logging performance)
Thanks for the suggestion Regards, Girish Jain
From: Eric Means <[EMAIL PROTECTED]> Reply-To: "Discussion of advanced .NET topics." <[email protected]> To: [email protected] Subject: Re: [ADVANCED-DOTNET] Writing data to the beginning of a file Date: Sat, 19 Nov 2005 08:18:12 -0600 On 11/19/05, Girish Jain <[EMAIL PROTECTED]> wrote: > > Thanks Ian, > > You got it correct, it's the IO cost and time constraint that I am worried > about. The log file is generated on a daily basis, still the amount of > data > that is written to the log file is moderately large. > > I want the logging process to complete as fast as possible because when > multiple transactions are submitted simultaneously, one transaction should > not take a longer period to make other transactions slow. The amount of > data > that is written to the log file is moderately large per transaction. > Your best bet for satisfying these requirements is to put the logging on its own thread and have each transaction add a log message to a queue (a many-writer one-reader queue). Adding the messages to the queue should be fast, and the transactions won't need to care about how long it takes to write the file. The writer thread can batch log messages until it has a certain size and rearrange them in memory to be most-recent-first, which will help a bit with I/O costs. You could use MSMQ to make the message delivery absolutely reliable, assuming that's important. -- Eric Means [EMAIL PROTECTED] http://www.randomtree.org/eric/ =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
=================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
