9.5.1. Replicated servers
Multiple location support in the automounter implements
a simple network load-balancing
scheme for replicated filesystems. At first glance, this seems to be
a bit of overkill; after all, you don't need or want
replication for read-write filesystems. However, serving large,
read-only filesystems such as the manpages may add to an NFS
server's request load. Having multiple servers share this load
improves performance by reducing the total load placed on the most
heavily used servers. Ideally, you want clients that are
"close" to each server to mount its filesystems, reducing
the amount of traffic that must go through bridges or routers.
For example, if you have four NFS servers that each export the
manpages, the best client mounting scheme is probably not to have
one-quarter of the clients mount /usr/man from
each server. Instead, clients should mount the manpages from the
server that is closest to them. Replicated filesystems are included
in automounter maps simply by listing all possible servers in the
map:
/usr/man -ro wahoo:/usr/man mahimahi:/usr/man \
thud:/usr/man onaga:/usr/man
The backslash at the end of the first line continues this indirect
map entry onto the next line. If more than one
server:directory pair is listed in an
automounter map, the automounter pings all servers by sending a
request to the null procedure of all NFS
servers. From the set that responds, the automounter picks one that
is "closest" by comparing the address of the servers with
that of the clients. Ties are broken by using the server that
responded to the ping first. The selected server is used by the
automounter to serve the mount point.
There is also an element of load balancing at work here: if one of
the /usr/man servers is so heavily loaded with
other NFS traffic that it cannot reply to the ping before another
server on the same net, then the client will choose the other server
to handle its mount request. Solaris 2.6 introduced the feature of
client-side failover, which was discussed in Section 6.5, "Replication". While it doesn't explicitly implement
load balancing, if, after the mount, one server becomes overloaded
enough, a client will find the server to be unresponsive and will
dynamically switch to another server. Keep in mind the following:
-
If the ro mount option is not present, or if the
soft option is present, client-side failover is
not enabled, and in that situation, once a client performs a mount
from a server, it continues to use that server until it unmounts the
filesystem.
-
If the list of servers providing the filesystem changes, once the
filesystem is mounted, with or without failover, the client cannot
choose a different server before unmounting its first choice.
You can use the first-answer feature of replicated map entries to
solve the multihomed host problem presented in
Section 16.5.7, "Multihomed servers". Let's say that you have an NFS server
on four networks, with hostnames
boris,
boris-bb2,
boris-bb3, and
boris-bb4 on those networks. Mounting all
filesystems from
boris makes the multihomed host
perform loopback packet routing, but using the "right"
hostname requires knowing which name is on your network. Building an
automounter map with replicated entries solves this problem by
letting the automounter find the fastest route to
boris:
natasha -rw,hard boris:/export/home/boris \
boris-bb2:/export/home/boris \
boris-bb3:/export/home/boris \
boris-bb4:/export/home/boris
This would be an entry in the
auto_home map.
Since the server pathnames are the same, you can use a shorter form
of the replicated map entry, putting all of the server names in a
comma-separated list:
natasha -rw,hard boris,boris-bb2,boris-bb3,boris-bb4:/home/boris
The network interface on
boris that is closest
to the client will respond first, and each NFS client of
boris will mount
/home/natasha from the best network interface.
Note that the replicated mount points don't refer to multiple
filesystems, but rather multiple names for the same filesystem. The
automounter just provides a neat way of managing all of them in a
single place. Because
/export/home/natasha is
mounted read-write, client-side failover is not enabled. This is
somewhat unfortunate since this is the one situation where
client-side failover of a writable filesystem is safe: the filesystem
is the same, because the physical host is the same. But the client
has no way of knowing that.
When the automounter pings
the
remote servers, it's
performing the equivalent of:
rpcinfo -u hostname nfs
for each listed server. If you see a larger number of
null procedure calls than usual in the output of
nfsstat on the NFS server, it might indicate
that your automounter mounts of replicated filesystems are being
performed repeatedly. The null calls do not
require any disk accesses to service, but they can consume network
bandwidth on the server; if the number of null
calls becomes excessive it may be due to client machines continually
mounting and unmounting replicated filesystems. Changing the value of
the -t option to automount
(as discussed previously in Section 9.2.4, "Tuning timeout values")
reduces the frequency of mounting and unmounting.
You can also examine the
/etc/rmtab file on the
server to see how frequently its clients are mounting and unmounting
automounted filesystems. When a filesystem is mounted, an entry is
added to the
/etc/rmtab file. When it gets
unmounted, the entry isn't deleted from the file -- it is
commented out by making the first character in the line a pound sign
(
#):
#epeche:/usr/share/man
#haos:/usr/share/man
#epeche:/usr/share/man
depeche:/usr/share/man
chaos:/usr/share/man
In this example, client
depeche has mounted
/usr/share/man three times, and client
chaos has mounted that filesystem twice. This
gives you client information to go along with the
null NFS RPC counts provided by
nfsstat -- you can tell which clients have
been repeatedly mounting and unmounting a filesystem. Watch the size
of the
/etc/rmtab file over time; if it grows
regularly and contains multiple entries for the same clients and
filesystems, then you may want to change the automounter timeout
value on
those
clients.