The answer is that you typically don't lock files over NFS. Check out the Apache docs on NFS log files. They use a lock file on the local disk.
Some NFS implementations provide an okay locking capability, but I've never seen one that didn't fall down under heavy load. You might want to ask your vendor for info about your specific version.
You also could try using Samba instead. Joshua Chamas, author of Apache::ASP, reported getting better performance from Samba than NFS on his Linux system. | [reply] |
What I did with Linux is got my sysadmin to install a current enough version of NFS that it supported lockf properly, then I used File::lockf. That has worked fairly well for me.
But getting this properly set up for your environment is mainly a question of installation and system administration. NFS and locking (particularly when mixed with Linux, the *BSD line has historically done better with this) leaves a lot to be desired. | [reply] |
Linux distros do have a nfslock service that can be started. The local and remote computer communicate via rpc and you should be able to use flock like normal. How to set it up though is another matter (I have little idea -- only that on RedHat it is a default installed service).
As for File::NFSLock... it may be clunky and possibly has bugs in the stale lock time out, but we've hit it with over ten million hits a day on our web cluster (tied to our data cluster via nfs) and we have not had a single problem with inaccurate locking. So - the extras might not work in your situation, but the down and dirty functionality will work.
my @a=qw(random brilliant braindead); print $a[rand(@a)]; | [reply] |
While your evident frustration may be warranted, I downvoted you for two reasons:
- We strive here for a modicum of restraint and decorum, in the interest of keeping things civilized, and
- Yours is not, strictly speaking, a Perl question (despite your mention of File::NFSLock).
dmm
You can give a man a fish and feed him for a day ...
Or, you can teach him to fish and feed him for a lifetime
| [reply] |
| [reply] |
Andy,
Thank you. I'm not here to start a debate. It's my first post, and I was just looking for a little bit of assistance. I don't care how my post is "voted", I'm more concerned about the knowledge I was hoping to churn up. Many people would surely find it interesting, as it is a hard subject to find information on.
Honestly, I agree that it's ridiculous to think that was a "bad post". I think it addresses a common problem which I couldn't find information about elsewhere on this site. I think I was curteous, and I was shocked to see someone have such a rash reaction to my post. I thought I was nice as could be. If we can't look behind the "title" of my post, or the fact that I didn't include a line of Perl, then what's the point anyway? Just my two cents.
Regards,
Steve
| [reply] |