Writing at the end of file

Posted by user342534 on Stack Overflow See other posts from Stack Overflow or by user342534
Published on 2010-05-16T19:28:26Z Indexed on 2010/05/16 19:30 UTC
Read the original article Hit count: 151

Filed under:
|
|

Hi, I'm working on a system that requires high file I/O performance (with C#). Basically, I'm filling up large files (~100MB) from the start of the file until the end of the file. Every ~5 seconds I'm adding ~5MB to the file (sequentially from the start of the file), on every bulk I'm flushing the stream. Every few minutes I need to update a structure which I write at the end of the file (some kind of metadata).

When flushing each one of the bulks I have no performance issue. However, when updating the metadata at the end of the file I get really low performance. My guess is that when creating the file (which also should be done extra fast), the file doesn't really allocates the entire 100MB on the disk and when I flush the metadata it must allocates all space until the end of file.

Guys/Girls, any Idea how I can overcome this problem?

Thanks a lot!

© Stack Overflow or respective owner

Related posts about c#

Related posts about file-io