Jump to content

How to avoid log fragmentation?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic

#1
riotw7

riotw7

    Newbie

  • Members
  • Pip
  • 4 posts
Hi,

We have a project with N+1 components, each creating a log file in parallel.
On each boot the partition(NTFS) where the logs are created is checked with chkdsk /R.
These logs generate a lot of fragmentation as you can imagine, thus the chkdsk gets really slow.

What's the best method to avoid this fragmentation in your opinion?

TIA,

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Assuming you mean something like you have a bunch of threads each creating log files, why not have a thread to handle logging to a single log file. The other threads could send messages to the logging thread.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
riotw7

riotw7

    Newbie

  • Members
  • Pip
  • 4 posts
Thanks... Thought of that... but this would generate two issues:

1) logs which come from otherwise rather autonomous entities would all be entangled and would require filtering before they would be readable (this is minor issue- we can make grepping a habit :))

2) we also have a Hypersonic database which writes it's data in a similar manner. And even though having just two files competing for clusters would statistically give a bit better fragmentation, the partition would still become rather fragmented over time...

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Can you have them log to different drives?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
riotw7

riotw7

    Newbie

  • Members
  • Pip
  • 4 posts
Unfortunately not.
I can also say that increasing cluster size of the partition from 4K to 64K helps too little...

#6
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
What you may need to do is periodically copy the logs to a different folder (creating unfragmented files) and then delete the originals. When you're laying down two files on the same drive at the same time, you're just begging for fragmentation.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#7
riotw7

riotw7

    Newbie

  • Members
  • Pip
  • 4 posts
Although this will limit the fragmentation significally in the long run, it will still allow there to be N+1 fragmented log files, which make chkdsk sessions to take 30 sec/minute...