SLG150 has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.
  • Comment on There HAS to be a way to lock files over NFS

Replies are listed 'Best First'.
Re: There HAS to be a way to do this
by perrin (Chancellor) on Jan 08, 2002 at 23:58 UTC
    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.

Re (tilly) 1: There HAS to be a way to do this
by tilly (Archbishop) on Jan 09, 2002 at 01:21 UTC
    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.

Re: There HAS to be a way to do this
by Rhandom (Curate) on Jan 09, 2002 at 00:58 UTC
    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)];

Re: There HAS to be a way to do this
by dmmiller2k (Chaplain) on Jan 08, 2002 at 23:34 UTC
    While your evident frustration may be warranted, I downvoted you for two reasons:
    1. We strive here for a modicum of restraint and decorum, in the interest of keeping things civilized, and
    2. 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
      I don't find '$%^&' remotely offensive, has it been changed from something else?

      If not, what's the problem (apart from the node being a bit off-topic and having a vague title)?

      andy.

        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