Hard sync device in FileStream...

  • Thread starter Thread starter nulll
  • Start date Start date
N

nulll

Hello,

I'm developing a application where the content write in disk is
criticail, then I need ensure that the wirted data are really post in disk.
I don't sure tha Flush method is sufficient. The .NET don't has a equivalent
ao Sync method in Java?


Regards...
Nulll
 
Flush() call on a stream should be sufficient to flush any data in the
buffer. When you are done Close() and Dispose() the stream object and you
can be pretty sure its done the job.

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
 
Thank's.... But, Flush send data to SO, no? Send to SO don't ensure that it
was send to disk... In other languages, such as Java, work like it.. How
..NET Framework wok about it?

I don't send to my client code a notification that data was send to disk
(when I call Flush), if has chance of the date is lost if SO or hardware
crash after flush....


Regards,
Nulll....
 
That only says the data leaves the .Net world, it doesn't say it guarantees
the data isn't stored in Windows' File buffer.

Of course, you could disable write caching on the whole drive. But that is a
bit drastic.
 
That only says the data leaves the .Net world, it doesn't say it
guarantees
the data isn't stored in Windows' File buffer.

Of course, you could disable write caching on the whole drive. But that is a
bit drastic.

I know that e.g. Raid5 drives usually immediatley write to disk (unless
explicitly configured otherwise). I found that out wondering why those
supposedly top-notch drives whit high rpm were running with such a poor
performance. If you want to have the data on disk to satisfy ACID criteria
even in case of a sudden server crash you need to configure the OS /
hardware accordingly. Otherwise there are good chances your data will end up
in some cache.

CU Christoph
 
I agree with Chris. When you call flush its to the underlying device and
thats the end of .net's role. If you want to achieve something at the OS
level its always a good idea to fully configure it. You might want to browse
through good old win32 api's... you might find one that does the job of
writing the windows file buffer to the hard drive.

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
 
Of course, you could disable write caching on the whole drive. But that is a
bit drastic.

It is suficient ? The SO don't will make cache before send to disk (that
also would make cache)?


Regards...
 
If you want to have the data on disk to satisfy ACID criteria
even in case of a sudden server crash you need to configure the OS /
hardware accordingly. Otherwise there are good chances your data will end up
in some cache.

Of course... But, I think (don't ensure) that Java sync method send data
directally to device, it prevent SO make cache... The .NET Flush is like it
also?

(Also in java sync don't prevent cache in device)

Regards,
Nulll.........
 
Back
Top