⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1.t

📁 早期freebsd实现
💻 T
📖 第 1 页 / 共 2 页
字号:
that in turn increase server load and the possibility of damaged fileson the server. It is probably best to err on the safe side and use a large(>= 2sec) fixed timeout if the dynamic retransmit timeout estimationseems to be causing problems..ppAn alternative to all this fiddling is to run NFS over TCP transport insteadof UDP.Since the 4.4BSD TCP implementation provides reliabledelivery with congestion control, it avoids all of the above problems.It also permits the use of read and write data sizes greater than the 8Kbytelimit for UDP transport.\**.(f\**Read/write data sizes greater than 8Kbytes will not normally improveperformance unless the kernel constant MAXBSIZE is increased and thefile system on the server has a block size greater than 8Kbytes..)fNFS over TCP usually delivers comparable to significantly better performancethan NFS over UDPunless the client or server processor runs at less than 5-10MIPS. For aslow processor, the extra CPU overhead of using TCP transport will becomesignificant and TCP transport may only be useful when the clientto server interconnect traverses congested gateways.The main problem with using TCP transport is that it is only supportedbetween BSD clients and servers.\**.(f\**There are rumors of commercial NFS over TCP implementations on the horizonand these may well be worth exploring..)f.sh 1 "Other Tuning Tricks".ppAnother mount option that may improve performance overcertain network interconnects is \fB-a=\fInum\fRwhich sets the number of blocks that the system willattempt to read-ahead during sequential reading of a file. The default valueof 1 seems to be appropriate for most situations, but a larger value mightachieve better performance for some environments, such as a mount to a serveracross a ``high bandwidth * round trip delay'' interconnect..ppFor the adventurous, playing with the size of the buffer cachecan also improve performance for some environments that use NFS heavily.Under some workloads, a buffer cache of 4-6Mbytes can result in significantperformance improvements over 1-2Mbytes, both in client side system callresponse time and reduced server RPC load.The buffer cache size defaults to 10% of physical memory,but this can be overridden by specifying the BUFPAGES optionin the machine's config file.\**.(fBUFPAGES is the number of physical machine pages allocated to the buffer cache.ie. BUFPAGES * NBPG = buffer cache size in bytes.)fWhen increasing the size of BUFPAGES, it is also advisable to increase thenumber of buffers NBUF by a corresponding amount.Note that there is a tradeoff of memory allocated to the buffer cache versusavailable for paging, which implies that making the buffer cache largerwill increase paging rate, with possibly disastrous results..sh 1 "Security Issues".ppWhen a machine is running an NFS server it opens up a great big security hole.For ordinary NFS, the server receives client credentialsin the RPC request as a user idand a list of group ids and trusts them to be authentic!The only tool available to restrict remote access tofile systems with is the exports(5) file,so file systems should be exported with great care.The exports file is read by mountd upon startup and after a hangup signalis posted for it and then as much of the access specifications as possible arepushed down into the kernel for use by the nfsd(s).The trick here is that the kernel information is stored on a perlocal file system mount point and client host address basis and cannot refer toindividual directories within the local server file system.It is best to think of the exports file as referring to the various localfile systems and not just directory paths as mount points.A local file system may be exported to a specific host, all hosts thatmatch a subnet mask or all other hosts (the world). The latter is verydangerous and should only be used for public information. It is alsostrongly recommended that file systems exported to ``the world'' be exportedread-only.For each host or group of hosts, the file system can be exported read-only orread/write.You can also define one of three client user id to server credentialmappings to help control access.Root (user id == 0) can be mapped to some default credentials while all otheruser ids are accepted as given.If the default credentials for user id equal zeroare root, then there is essentially no remapping.Most NFS file systems are exported this way, most commonly mappinguser id == 0 to the credentials for the user nobody.Since the client user id and group id list is used unchanged on the server(except for root), this also implies thatthe user id and group id space must be common between the client and server.(ie. user id N on the client must refer to the same user on the server)All user ids can be mapped to a default set of credentials, typically that ofthe user nobody. This essentially gives world access to allusers on the corresponding hosts..ppThere is also a non-standard BSD\fB-kerb\fR export option that requires the client providea KerberosIV rcmd service ticket to authenticate the user on the server.If successful, the Kerberos principal is looked up in the server's passwordand group databases to get a set of credentials and a map of client userid tothese credentials is then cached.The use of TCP transport is strongly recommended,since the scheme depends on the TCP connection to avert replay attempts.Unfortunately, this option is only usablebetween BSD clients and servers since it isnot compatible with other known ``kerberized'' NFS systems.To enable use of this Kerberos option, both mount_nfs on the client andnfsd on the server must be rebuilt with the -DKERBEROS option andlinked to KerberosIV libraries.The file system is then exported to the client(s) with the \fB-kerb\fR optionin the exports file on the serverand the client mount specifies the\fB-K\fRand\fB-T\fRoptions.The\fB-m=\fIrealm\fRmount option may be used to specify a Kerberos Realm for the ticket(it must be the Kerberos Realm of the server) that is other thanthe client's local Realm.To access files in a \fB-kerb\fR mount point, the user must have a validTGT for the server's Realm, as provided by kinit or similar..ppAs well as the standard NFS Version 2 protocol (RFC1094) implementation, BSDsystems can use a variant of the protocol called Not Quite NFS (NQNFS) thatsupports a variety of protocol extensions.This protocol uses 64bit file offsetsand sizes, an \fIaccess rpc\fR, an \fIappend\fR option on the write rpcand extended file attributes to support 4.4BSD file system functionalitymore fully.It also makes use of a variant of short term\fIleases\fR [Gray89] with delayed write client caching,in an effort to provide full cache consistency and better performance.This protocol is available between 4.4BSD systems only and is used whenthe \fB-q\fR mount option is specified.It can be used with any of the aforementioned options for NFS, such as TCPtransport (\fB-T\fR) and KerberosIV authentication (\fB-K\fR).Although this protocol is experimental, it is recommended over NFS formounts between 4.4BSD systems.\**.(f\**I would appreciate email from anyone who can provideNFS vs. NQNFS performance measurements,particularly fast clients, many clients or over an internetworkconnection with a large ``bandwidth * RTT'' product..)f.sh 1 "Monitoring NFS Activity".ppThe basic command for monitoring NFS activity on clients and servers isnfsstat. It reports cumulative statistics of various NFS activities,such as counts of the various different RPCs and cache hit rates on the clientand server. Of particular interest on the server are the fields in the\fIServer Cache Stats:\fR section, which gives numbers for RPC retries receivedin the first three fields and total RPCs in the fourth. The first three fieldsshould remain a very small percentage of the total. If not, itwould indicate one or more clients doing retries too aggressively and the fixwould be to isolate these clients,disable the dynamic RTO estimation on them andmake their initial timeout interval a conservative (ie. large) value..ppOn the client side, the fields in the \fIRpc Info:\fR section are of particularinterest, as they give an overall picture of NFS activity.The \fITimedOut\fR field is the number of I/O system calls that returned -1for ``soft'' mounts and can be reducedby increasing the retry limit or changingthe mount type to ``intr'' or ``hard''.The \fIInvalid\fR field is a count of trashed RPC replies that are receivedand should remain zero.\**.(f\**Some NFS implementations run with UDP checksums disabled, so garbage RPCmessages can be received..)fThe \fIX Replies\fR field counts the number of repeated RPC replies receivedfrom the server and is a clear indication of a too aggressive RTO estimate.Unfortunately, a good NFS server implementation will use a ``recent requestcache'' [Juszczak89] that will suppress the extraneous replies.A large value for \fIRetries\fR indicates a problem, butit could be any of:.ip \(bua too aggressive RTO estimate.ip \(buan overloaded NFS server.ip \(buIP fragments being dropped (gateway, client or server).lpand requires further investigation.The \fIRequests\fR field is the total count of RPCs done on all servers..ppThe \fBnetstat -s\fR comes in useful during investigation of RPC transportproblems.The field \fIfragments dropped after timeout\fR inthe \fIip:\fR section indicates IP fragments arebeing lost and a significant number of these occurring indicates that theuse of TCP transport or a smaller read/write data size is in order.A significant number of \fIbad checksums\fR reported in the \fIudp:\fRsection would suggest network problems of a more generic sort.(cabling, transceiver or network hardware interface problems or similar).ppThere is a RPC activity logging facility for both the client andserver side in the kernel.When logging is enabled by setting the kernel variable nfsrtton toone, the logs in the kernel structures nfsrtt (for the client side)and nfsdrt (for the server side) are updated upon the completionof each RPC in a circular manner.The pos element of the structure is the index of the next elementof the log array to be updated.In other words, elements of the log array from \fIlog\fR[pos] to\fIlog\fR[pos - 1] are in chronological order.The include file <sys/nfsrtt.h> should be consulted for details on thefields in the two log structures.\**.(f\**Unfortunately, a monitoring tool that uses these logs is still in theplanning (dreaming) stage..)f.sh 1 "Diskless Client Support".ppThe NFS client does include kernel support for diskless/dataless operationwhere the root file system and optionally the swap area is remote NFS mounted.A diskless/dataless client is configured using a version of the``swapvmunix.c'' file as provided in the directory \fIcontrib/diskless.nfs\fR.If the swap device == NODEV, it specifies an NFS mounted swap area and shouldbe configured the same size as set up by diskless_setup when run on the server.This file must be put in the \fIsys/compile/<machine_name>\fR kernel builddirectory after the config command has been run, since config doesnot know about specifying NFS root and swap areas.The kernel variable mountroot must be set to nfs_mountroot instead offfs_mountroot and the kernel structure nfs_diskless must be filled inproperly.There are some primitive system administration tools in the \fIcontrib/diskless.nfs\fR directory to assist in filling inthe nfs_diskless structure and in setting up an NFS server fordiskless/dataless clients.The tools were designed to provide a bare bones capability, to allow maximumflexibility when setting up different servers..lpThe tools are as follows:.ip \(budiskless_offset.c - This little program reads a ``vmunix'' object file andwrites the file byte offset of the nfs_diskless structure in it tostandard out. It was kept separate because it sometimes has tobe compiled/linked in funny ways depending on the client architecture.(See the comment at the beginning of it.).ip \(budiskless_setup.c - This program is run on the server and sets up files for agiven client. It mostly just fills in an nfs_diskless structure andwrites it out to either the "vmunix" file or a separate file called/var/diskless/setup.<official-hostname>.ip \(budiskless_boot.c - There are two functions in here that may be usedby a bootstrap server such as tftpd to permit sharing of the ``vmunix''object file for similar clients. This saves disk space on the bootstrapserver and simplify organization, but are not critical for correct operation.They read the ``vmunix''file, but optionally fill in the nfs_diskless structure from aseparate "setup.<official-hostname>" file so that there is onlyone copy of "vmunix" for all similar (same arch etc.) clients.These functions use a text file called/var/diskless/boot.<official-hostname> to control the netboot..lpThe basic setup steps are:.ip \(bumake a "vmunix" for the client(s) with mountroot() == nfs_mountroot()and swdevt[0].sw_dev == NODEV if it is to do nfs swapping as well(See the same swapvmunix.c file).ip \(burun diskless_offset on the vmunix file to find out the byte offsetof the nfs_diskless structure.ip \(buRun diskless_setup on the server to set up the server and fill in thenfs_diskless structure for that client.The nfs_diskless structure can either be written into thevmunix file (the -x option) orsaved in /var/diskless/setup.<official-hostname>..ip \(buSet up the bootstrap server. If the nfs_diskless structure was written intothe ``vmunix'' file, any vanilla bootstrap protocol such as bootp/tftp canbe used. If the bootstrap server has been modified to use the functions indiskless_boot.c, then afile called /var/diskless/boot.<official-hostname>must be created.It is simply a two line text file, where the first line is the pathnameof the correct ``vmunix'' file and the second line has the pathname ofthe nfs_diskless structure file and its byte offset in it.For example:.br	/var/diskless/vmunix.pmax.br	/var/diskless/setup.rickers.cis.uoguelph.ca 642308.br.ip \(buCreate a /var subtree for each client in an appropriate place on the server,such as /var/diskless/var/<client-hostname>/...By using the <client-hostname> to differentiate /var for each host,/etc/rc can be modified to mount the correct /var from the server.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -