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

📄 nfs tracing.txt

📁 黑客培训教程
💻 TXT
📖 第 1 页 / 共 3 页
字号:
nameserver lookup each time this was necessary; this quickly flooded thenetwork with a nameserver request for each NFS transaction. The currentversion maintains a cache of host names; this requires a only a modestamount of memory for typical networks of less than a few hundred hosts. Forvery large networks or those where NFS service is provided to a large numberof remote hosts, this could still be a potential problem, but as a lastresort remote name resolution could be disabled or rpcspy configured to nottranslate IP addresses.UDP/IP datagrams may be fragmented among several packets if the datagram islarger than the maximum size of a single Ethernet frame. rpcspy looks onlyat the first fragment; in practice, fragmentation occurs only for the datafields of NFS read and write transactions, which are ignored anyway.3. nfstrace: The Filesystem Tracing PackageAlthough rpcspy provides a trace of the low-level NFS commands, it is not,in and of itself, sufficient for obtaining useful filesystem traces. Thelow-level commands do not by themselves reveal user-level activity. Furthermore, the volume of data that would need to be recorded is potentiallyenormous, on the order of megabytes per hour. More useful would be anabstraction of the user-level system calls underlying the NFS activity.nfstrace is a filter for rpcspy that produces a log of a plausible set ofuser level filesystem commands that could have triggered the monitoredactivity. A record is produced each time a file is opened, giving a summaryof what occurred. This summary is detailed enough for analysis or for use asinput to a filesystem simulator.The output format of nfstrace consists of 7 fields:timestamp | command-time | direction | file-id | client | transferred | sizewhere timestamp is the time the open occurred, command-time is the length oftime between open and close, direc tion is either read or write (mkdir andreaddir count as write and read, respectively). file-id identifies theserver and the file handle, client is the client and user that performed theopen, transferred is the number of bytes of the file actually read orwritten (cache hits have a 0 in this field), and size is the size of thefile (in bytes).An example record might be as follows:690691919.593442 | 17734 | read | basso:7b1f00000000400f | frejus.321 | 0 |24576Here, userid 321 at client frejus read file 7b1f00000000400f on serverbasso. The file is 24576 bytes long and was able to be read from the clientcache. The command started at Unix time 690691919.593442 and took 17734microseconds at the server to execute.Since it is sometimes useful to know the name corresponding to the handleand the mode information for each file, nfstrace optionally produces a mapof file handles to file names and modes. When enough information (fromlookup and readdir commands) is received, new names are added. Names canchange over time (as files are deleted and renamed), so the times eachmapping can be considered valid is recorded as well. The mapping information may not always be complete, however, depending on how much activityhas already been observed. Also, hard links can confuse the name mapping,and it is not always possible to determine which of several possible names afile was opened under.What nfstrace produces is only an approximation of the underlying useractivity. Since there are no NFS open or close commands, the program mustguess when these system calls occur. It does this by taking advantage of theobservation that NFS is fairly consistent in what it does when a file isopened. If the file is in the local buffer cache, a getattr call is made onthe file to verify that it has not changed since the file was cached.Otherwise, the actual bytes of the file are fetched as they are read by theuser. (It is possible that part of the file is in the cache and part is not,in which case the getattr is performed and only the missing pieces arefetched. This occurs most often when a demand-paged executable is loaded).nfstrace assumes that any sequence of NFS read calls on the same file issuedby the same user at the same client is part of a single open for read. Theclose is assumed to have taken place when the last read in the sequencecompletes. The end of a read sequence is detected when the same client readsthe beginning of the file again or when a timeout with no reading haselapsed. Writes are handled in a similar manner.Reads that are entirely from the client cache are a bit harder; not everygetattr command is caused by a cache read, and a few cache reads take placewithout a getattr. A user level stat system call can sometimes trigger agetattr, as can an ls -l command. Fortunately, the attribute caching used bymost implementations of NFS seems to eliminate many of these extraneousgetattrs, and ls commands appear to trigger a lookup command most of thetime. nfstrace assumes that a getattr on any file that the client has readwithin the past few hours represents a cache read, otherwise it is ignored.This simple heuristic seems to be fairly accurate in practice. Note alsothat a getattr might not be performed if a read occurs very soon after thelast read, but the time threshold is generally short enough that this israrely a problem. Still, the cached reads that nfstrace reports are, atbest, an estimate (generally erring on the side of over-reporting). There isno way to determine the number of bytes actually read for cache hits.The output of nfstrace is necessarily produced out of chronological order,but may be sorted easily by a post-processor.nfstrace has a host of options to control the level of detail of the trace,the lengths of the timeouts, and so on. To facilitate the production of verylong traces, the output can be flushed and checkpointed at a specified interval, and can be automatically compressed.4. Using rpcspy and nfstrace for Filesystem TracingClearly, nfstrace is not suitable for producing highly accurate traces;cache hits are only estimated, the timing information is imprecise, and datafrom lost (and duplicated) network packets are not accounted for. When sucha highly accurate trace is required, other approaches, such as modificationof the client and server kernels, must be employed.The main virtue of the passive-monitoring approach lies in its simplicity.In [5], Baker, et al, describe a trace of a distributed filesystem whichinvolved low-level modification of several different operating systemkernels. In contrast, our entire filesystem trace package consists of lessthan 5000 lines of code written by a single programmer in a few weeks,involves no kernel modifications, and can be installed to monitor multipleheterogeneous servers and clients with no knowledge of even what operatingsystems they are running.The most important parameter affecting the accuracy of the traces is theability of the machine on which rpcspy is running to keep up with thenetwork traffic. Although most modern RISC workstations with reasonableEthernet interfaces are able to keep up with typical network loads, it isimportant to determine how much informa tion was lost due to packet bufferoverruns before relying upon the trace data. It is also important that thetrace be, indeed, non-intrusive. It quickly became obvious, for example,that logging the traffic to an NFS filesystem can be problematic.Another parameter affecting the usefulness of the traces is the validity ofthe heuristics used to translate from RPC calls into user-level systemcalls. To test this, a shell script was written that performed ls -l, touch,cp and wc commands randomly in a small directory hierarchy, keeping a recordof which files were touched and read and at what time. After several hours,nfstrace was able to detect 100% of the writes, 100% of the uncached reads,and 99.4% of the cached reads. Cached reads were over-reported by 11%, eventhough ls com mands (which cause the "phantom" reads) made up 50% of thetest activity. While this test provides encouraging evidence of the accuracyof the traces, it is not by itself conclusive, since the particular workloadbeing monitored may fool nfstrace in unanticipated ways.As in any research where data are collected about the behavior of humansubjects, the privacy of the individu als observed is a concern. Althoughthe contents of files are not logged by the toolkit, it is still possible tolearn something about individual users from examining what files they readand write. At a minimum, the users of a mon itored system should be informedof the nature of the trace and the uses to which it will be put. In somecases, it may be necessary to disable the name translation from nfstracewhen the data are being provided to others. Commercial sites where filenamesmight reveal something about proprietary projects can be particularlysensitive to such concerns.5. A Trace of Filesystem Activity in the Princeton C.S. DepartmentA previous paper[14] analyzed a five-day long trace of filesystem activityconducted on 112 research worksta tions at DEC-SRC. The paper identified anumber of file access properties that affect filesystem caching performance; it is difficult, however, to know whether these properties wereunique artifacts of that particular environment or are more generallyapplicable. To help answer that question, it is necessary to look at similartraces from other computing environments.It was relatively easy to use rpcspy and nfstrace to conduct a week longtrace of filesystem activity in the Princeton University Computer ScienceDepartment. The departmental computing facility serves a community ofapproximately 250 users, of which about 65% are researchers (faculty,graduate students, undergraduate researchers, postdoctoral staff, etc), 5%office staff, 2% systems staff, and the rest guests and other "external"users. About 115 of the users work full-time in the building and use thesystem heavily for electronic mail, netnews, and other such communicationservices as well as other computer science research oriented tasks (editing,compiling, and executing programs, formatting documents, etc).The computing facility consists of a central Auspex file server (fs) (towhich users do not ordinarily log in directly), four DEC 5000/200s (elan,hart, atomic and dynamic) used as shared cycle servers, and an assortment ofdedicated workstations (NeXT machines, Sun workstations, IBM-RTs, Irisworkstations, etc.) in indi vidual offices and laboratories. Most users login to one of the four cycle servers via X window terminals located inoffices; the terminals are divided evenly among the four servers. There area number of Ethernets throughout the building. The central file server isconnected to a "machine room network" to which no user terminals aredirectly connected; traffic to the file server from outside the machine roomis gatewayed via a Cisco router. Each of the four cycle servers has a local/, /bin and /tmp filesystem; other filesystems, including /usr, /usr/local,and users' home directories are NFS mounted from fs. Mail sent from localmachines is delivered locally to the (shared) fs:/usr/spool/mail; mail fromoutside is delivered directly on fs.The trace was conducted by connecting a dedicated DEC 5000/200 with a localdisk to the machine room net work. This network carries NFS traffic for allhome directory access and access to all non-local cycle-server files(including the most of the actively-used programs). On a typical weekday,about 8 million packets are transmitted over this network. nfstrace wasconfigured to record opens for read and write (but not directory accesses orindividual reads or writes). After one week (wednesday to wednesday),342,530 opens for read and 125,542 opens for write were recorded, occupying8 MB of (compressed) disk space. Most of this traffic was from the fourcycle servers.No attempt was made to "normalize" the workload during the trace period.Although users were notified that file accesses were being recorded, andprovided an opportunity to ask to be excluded from the data collection, mostusers seemed to simply continue with their normal work. Similarly, nocorrection is made for any anomalous user activity that may have occurredduring the trace.5.1. The Workload Over TimeIntuitively, the volume of traffic can be expected to vary with the time ofday. Figure 1 shows the number of reads and writes per hour over the sevendays of the trace; in particular, the volume of write traffic seems tomirror the general level of departmental activity fairly closely.An important metric of NFS performance is the client buffer cache hit rate.Each of the four cycle servers allocates approximately 6MB of memory for thebuffer cache. The (estimated) aggregate hit rate (percentage of reads servedby client caches) as seen at the file server was surprisingly low: 22.2%over the entire week. In any given hour, the hit rate never exceeded 40%.Figure 2 plots (actual) server reads and (estimated) cache hits per hourover the trace week; observe that the hit rate is at its worst duringperiods of the heaviest read activity.Past studies have predicted much higher hit rates than the aggregateobserved here. It is probable that since most of the traffic is generated bythe shared cycle servers, the low hit rate can be attributed to the largenumber of users competing for cache space. In fact, the hit rate wasobserved to be much higher on the single-user worksta tions monitored in thestudy, averaging above 52% overall. This suggests, somewhatcounter-intuitively, that if more computers were added to the network (suchthat each user had a private workstation), the server load would decreaseconsiderably. Figure 3 shows the actual cache misses and estimated cachehits for a typical private works tation in the study.Thu 00:00  Thu 06:00  Thu 12:00  Thu 18:00  Fri 00:00  Fri 06:00  Fri 12:00

⌨️ 快捷键说明

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