Possible patch to cure CGI's not finding data for objects in status.dat

Andreas Ericsson ae at op5.se
Mon Aug 10 11:40:52 CEST 2009


Hiren Patel wrote:
> Andreas Ericsson wrote:
>>>>
>>>>  
>>>
>>> I tried a program which I meant to attach to this mail that I deleted 
>>> by mistake as I was composing this mail, that fopen'd a file, wrote a 
>>> character at a time and either fclosed at the end, or fsync'd after 
>>> each character, or sync'd after each character. it wrote 1MB worth of 
>>> characters to the file.
>>>
>>
>> Ahmm... That's not really such a great test, tbh. Try the write 
>> throughput
>> with a testing tool for it and then divide the size of the file to be
>> synced with the actual write speed of the disk and you'll get something
>> rather close to the cost of a single fsync call for a particular file.
>>
> 
> ah okay, thanks for the reply, I enjoy reading replies from experienced 
> folk, I learn from them.
> 
>>>
>>> not sure how useful this really is to get an idea, but sync is 
>>> clearly to be avoided as you mentioned. what do you guys make of the 
>>> difference between fsync and no fsync in relation to nagios?
>>>
>>
>> fsync() isn't needed when using a sane file system. When using an insane
>> one, there are no guarantees that fsync() works anyway, so why use it?
>>
> 
> it's not needed on a sane filesystem because another process trying to 
> read a file not completely sync'd will still see the latest content?

Yes. The filesystem driver will cache it and deliver all of it before
it's actually committed to disk.

> agree about the NFS issue, read a little about it's problems, and if 
> fsync isn't going to solve its problems, I see your point about not 
> using it.
> 

It may or may not solve the problems. However, the NFS server is free
to cache the data itself, even after an fsync() call. NFS is racy. It
always has been and will probably remain racy for quite a long time.

It could also be the fact that the NFS server doesn't support rename()
properly, so the file has to be written twice in the NFS case. In
those cases though, the fsync() call shouldn't really help all that
much, but Cary reported that it does.

> if I'm not mistaken this patch was committed already? was there a reason 
> it was so easily accepted?

Because the cost is relatively small, I suppose. That doesn't change the
fact that NFS is being used in a pretty poor way though.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july




More information about the Developers mailing list