Negative NFS caching

Matt Dillon has added negative caching for NFS, meaning that NFS will now cache failed lookups, not just successful ones. He details the benefits like so:

“This makes a HUGE difference for programs which search nfs directories, such as compilers (the header file search path), make, and a few other utilities. NFS packet traffic can be reduced upwards of 90%. For example, with /usr/src mounted via NFS, building libc a second time without negative caching generates 66000 packets of NFS traffic in each direction, building libc a second time with negative caching enabled generates 9500 packets worth of NFS traffic, in EACH DIRECTION. While it is true that negative lookups are cached on the NFS server, the huge reduction in network traffic and equivalent reduction in synchronous read latencies result in radically reduced overheads across the board for operations which generate a lot of negative hits. A buildworld test with the default 3 second negative caching timeout went from 2265 seconds to 1900 seconds.”