home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / hacking / network / nfsmon.txt < prev    next >
Encoding:
Text File  |  2003-06-11  |  34.9 KB  |  709 lines

  1.  
  2.  
  3. NFS Tracing By Passive Network Monitoring
  4.  
  5. Matt Blaze
  6.  
  7. Department of Computer Science Princeton University mab@cs.princeton.edu
  8.  
  9. ABSTRACT
  10.  
  11. Traces of filesystem activity have proven to be useful for a wide variety of
  12. purposes, rang ing from quantitative analysis of system behavior to
  13. trace-driven simulation of filesystem algo rithms. Such traces can be
  14. difficult to obtain, however, usually entailing modification of the
  15. filesystems to be monitored and runtime overhead for the period of the
  16. trace. Largely because of these difficulties, a surprisingly small number of
  17. filesystem traces have been conducted, and few sample workloads are
  18. available to filesystem researchers.
  19.  
  20. This paper describes a portable toolkit for deriving approximate traces of
  21. NFS [1] activity by non-intrusively monitoring the Ethernet traffic to and
  22. from the file server. The toolkit uses a promiscuous Ethernet listener
  23. interface (such as the Packetfilter[2]) to read and reconstruct NFS-related
  24. RPC packets intended for the server. It produces traces of the NFS activity
  25. as well as a plausible set of corresponding client system calls. The tool is
  26. currently in use at Princeton and other sites, and is available via
  27. anonymous ftp.
  28.  
  29. 1. Motivation
  30.  
  31. Traces of real workloads form an important part of virtually all analysis of
  32. computer system behavior, whether it is program hot spots, memory access
  33. patterns, or filesystem activity that is being studied. In the case of
  34. filesystem activity, obtaining useful traces is particularly challenging.
  35. Filesystem behavior can span long time periods, often making it necessary to
  36. collect huge traces over weeks or even months. Modification of the
  37. filesystem to collect trace data is often difficult, and may result in
  38. unacceptable runtime overhead. Distributed filesystems exa cerbate these
  39. difficulties, especially when the network is composed of a large number of
  40. heterogeneous machines. As a result of these difficulties, only a relatively
  41. small number of traces of Unix filesystem workloads have been conducted,
  42. primarily in computing research environments. [3], [4] and [5] are examples
  43. of such traces.
  44.  
  45. Since distributed filesystems work by transmitting their activity over a
  46. network, it would seem reasonable to obtain traces of such systems by
  47. placing a "tap" on the network and collecting trace data based on the
  48. network traffic. Ethernet[6] based networks lend themselves to this approach
  49. particularly well, since traffic is broadcast to all machines connected to a
  50. given subnetwork. A number of general-purpose network monitoring tools are
  51. avail able that "promiscuously" listen to the Ethernet to which they are
  52. connected; Sun's etherfind[7] is an example of such a tool. While these
  53. tools are useful for observing (and collecting statistics on) specific types
  54. of packets, the information they provide is at too low a level to be useful
  55. for building filesystem traces. Filesystem operations may span several
  56. packets, and may be meaningful only in the context of other, previous
  57. operations.
  58.  
  59. Some work has been done on characterizing the impact of NFS traffic on
  60. network load. In [8], for example, the results of a study are reported in
  61. which Ethernet traffic was monitored and statistics gathered on NFS
  62. activity. While useful for understanding traffic patterns and developing a
  63. queueing model of NFS loads, these previous stu dies do not use the network
  64. traffic to analyze the file access traffic patterns of the system, focusing
  65. instead on developing a statistical model of the individual packet sources,
  66. destinations, and types.
  67.  
  68.  
  69. This paper describes a toolkit for collecting traces of NFS file access
  70. activity by monitoring Ethernet traffic. A "spy" machine with a promiscuous
  71. Ethernet interface is connected to the same network as the file server. Each
  72. NFS-related packet is analyzed and a trace is produced at an appropriate
  73. level of detail. The tool can record the low level NFS calls themselves or
  74. an approximation of the user-level system calls (open, close, etc.) that
  75. triggered the activity.
  76.  
  77. We partition the problem of deriving NFS activity from raw network traffic
  78. into two fairly distinct subprob lems: that of decoding the low-level NFS
  79. operations from the packets on the network, and that of translating these
  80. low-level commands back into user-level system calls. Hence, the toolkit
  81. consists of two basic parts, an "RPC decoder" (rpcspy) and the "NFS
  82. analyzer" (nfstrace). rpcspy communicates with a low-level network
  83. monitoring facility (such as Sun's NIT [9] or the Packetfilter [2]) to read
  84. and reconstruct the RPC transactions (call and reply) that make up each NFS
  85. command. nfstrace takes the output of rpcspy and reconstructs the sys tem
  86. calls that occurred as well as other interesting data it can derive about
  87. the structure of the filesystem, such as the mappings between NFS file
  88. handles and Unix file names. Since there is not a clean one-to-one mapping
  89. between system calls and lower-level NFS commands, nfstrace uses some simple
  90. heuristics to guess a reasonable approximation of what really occurred.
  91.  
  92. 1.1. A Spy's View of the NFS Protocols
  93.  
  94. It is well beyond the scope of this paper to describe the protocols used by
  95. NFS; for a detailed description of how NFS works, the reader is referred to
  96. [10], [11], and [12]. What follows is a very brief overview of how NFS
  97. activity translates into Ethernet packets.
  98.  
  99. An NFS network consists of servers, to which filesystems are physically
  100. connected, and clients, which per form operations on remote server
  101. filesystems as if the disks were locally connected. A particular machine can
  102. be a client or a server or both. Clients mount remote server filesystems in
  103. their local hierarchy just as they do local filesystems; from the user's
  104. perspective, files on NFS and local filesystems are (for the most part)
  105. indistinguishable, and can be manipulated with the usual filesystem calls.
  106.  
  107. The interface between client and server is defined in terms of 17 remote
  108. procedure call (RPC) operations. Remote files (and directories) are referred
  109. to by a file handle that uniquely identifies the file to the server. There
  110. are operations to read and write bytes of a file (read, write), obtain a
  111. file's attributes (getattr), obtain the contents of directories (lookup,
  112. readdir), create files (create), and so forth. While most of these
  113. operations are direct analogs of Unix system calls, notably absent are open
  114. and close operations; no client state information is maintained at the
  115. server, so there is no need to inform the server explicitly when a file is
  116. in use. Clients can maintain buffer cache entries for NFS files, but must
  117. verify that the blocks are still valid (by checking the last write time with
  118. the getattr operation) before using the cached data.
  119.  
  120. An RPC transaction consists of a call message (with arguments) from the
  121. client to the server and a reply mes sage (with return data) from the server
  122. to the client. NFS RPC calls are transmitted using the UDP/IP connection
  123. less unreliable datagram protocol[13]. The call message contains a unique
  124. transaction identifier which is included in the reply message to enable the
  125. client to match the reply with its call. The data in both messages is
  126. encoded in an "external data representation" (XDR), which provides a
  127. machine-independent standard for byte order, etc.
  128.  
  129. Note that the NFS server maintains no state information about its clients,
  130. and knows nothing about the context of each operation outside of the
  131. arguments to the operation itself.
  132.  
  133. 2. The rpcspy Program
  134.  
  135. rpcspy is the interface to the system-dependent Ethernet monitoring
  136. facility; it produces a trace of the RPC calls issued between a given set of
  137. clients and servers. At present, there are versions of rpcspy for a number
  138. of BSD-derived systems, including ULTRIX (with the Packetfilter[2]), SunOS
  139. (with NIT[9]), and the IBM RT running AOS (with the Stanford enet filter).
  140.  
  141. For each RPC transaction monitored, rpcspy produces an ASCII record
  142. containing a timestamp, the name of the server, the client, the length of
  143. time the command took to execute, the name of the RPC command executed, and
  144. the command- specific arguments and return data. Currently, rpcspy
  145. understands and can decode the 17 NFS RPC commands, and there are hooks to
  146. allow other RPC services (for example, NIS) to be added reasonably easily.
  147.  
  148.  
  149. The output may be read directly or piped into another program (such as
  150. nfstrace) for further analysis; the for mat is designed to be reasonably
  151. friendly to both the human reader and other programs (such as nfstrace or
  152. awk).
  153.  
  154. Since each RPC transaction consists of two messages, a call and a reply,
  155. rpcspy waits until it receives both these components and emits a single
  156. record for the entire transaction. The basic output format is 8 vertical-bar
  157. separated fields:
  158.  
  159. timestamp | execution-time | server | client | command-name | arguments |
  160. reply-data
  161.  
  162. where timestamp is the time the reply message was received, execution-time
  163. is the time (in microseconds) that elapsed between the call and reply,
  164. server is the name (or IP address) of the server, client is the name (or IP
  165. address) of the client followed by the userid that issued the command,
  166. command-name is the name of the particular program invoked (read, write,
  167. getattr, etc.), and arguments and reply-data are the command dependent
  168. arguments and return values passed to and from the RPC program,
  169. respectively.
  170.  
  171. The exact format of the argument and reply data is dependent on the specific
  172. command issued and the level of detail the user wants logged. For example, a
  173. typical NFS command is recorded as follows:
  174.  
  175. 690529992.167140 | 11717 | paramount | merckx.321 | read |
  176. {"7b1f00000000083c", 0, 8192} | ok, 1871
  177.  
  178. In this example, uid 321 at client "merckx" issued an NFS read command to
  179. server "paramount". The reply was issued at (Unix time) 690529992.167140
  180. seconds; the call command occurred 11717 microseconds earlier. Three
  181. arguments are logged for the read call: the file handle from which to read
  182. (represented as a hexadecimal string), the offset from the beginning of the
  183. file, and the number of bytes to read. In this example, 8192 bytes are
  184. requested starting at the beginning (byte 0) of the file whose handle is
  185. "7b1f00000000083c". The command completed successfully (status "ok"), and
  186. 1871 bytes were returned. Of course, the reply message also included the
  187. 1871 bytes of data from the file, but that field of the reply is not logged
  188. by rpcspy.
  189.  
  190. rpcspy has a number of configuration options to control which hosts and RPC
  191. commands are traced, which call and reply fields are printed, which Ethernet
  192. interfaces are tapped, how long to wait for reply messages, how long to run,
  193. etc. While its primary function is to provide input for the nfstrace program
  194. (see Section 3), judi cious use of these options (as well as such programs
  195. as grep, awk, etc.) permit its use as a simple NFS diag nostic and
  196. performance monitoring tool. A few screens of output give a surprisingly
  197. informative snapshot of current NFS activity; we have identified quickly
  198. using the program several problems that were otherwise difficult to
  199. pinpoint. Similarly, a short awk script can provide a breakdown of the most
  200. active clients, servers, and hosts over a sampled time period.
  201.  
  202. 2.1. Implementation Issues
  203.  
  204. The basic function of rpcspy is to monitor the network, extract those
  205. packets containing NFS data, and print the data in a useful format. Since
  206. each RPC transaction consists of a call and a reply, rpcspy maintains a
  207. table of pending call packets that are removed and emitted when the matching
  208. reply arrives. In normal operation on a reasonably fast workstation, this
  209. rarely requires more than about two megabytes of memory, even on a busy net
  210. work with unusually slow file servers. Should a server go down, however, the
  211. queue of pending call messages (which are never matched with a reply) can
  212. quickly become a memory hog; the user can specify a maximum size the table
  213. is allowed to reach before these "orphaned" calls are searched out and
  214. reclaimed.
  215.  
  216. File handles pose special problems. While all NFS file handles are a fixed
  217. size, the number of significant bits varies from implementation to
  218. implementation; even within a vendor, two different releases of the same
  219. operating system might use a completely different internal handle format. In
  220. most Unix implementations, the handle contains a filesystem identifier and
  221. the inode number of the file; this is sometimes augmented by additional
  222. information, such as a version number. Since programs using rpcspy output
  223. generally will use the handle as a unique file identifier, it is important
  224. that there not appear to be more than one handle for the same file.
  225. Unfortunately, it is not sufficient to simply consider the handle as a
  226. bitstring of the maximum handle size, since many operating systems do not
  227. zero out the unused extra bits before assigning the handle. Fortunately,
  228. most servers are at least consistent in the sizes of the handles they
  229. assign. rpcspy allows the user to specify (on the command line or in a
  230. startup file) the handle size for each host to be monitored. The handles
  231. from that server are emitted as hexadecimal strings truncated at that
  232. length. If no size is specified, a guess is made based on a few common
  233. formats of a reasonable size.
  234.  
  235.  
  236. It is usually desirable to emit IP addresses of clients and servers as their
  237. symbolic host names. An early ver sion of the software simply did a
  238. nameserver lookup each time this was necessary; this quickly flooded the
  239. network with a nameserver request for each NFS transaction. The current
  240. version maintains a cache of host names; this requires a only a modest
  241. amount of memory for typical networks of less than a few hundred hosts. For
  242. very large networks or those where NFS service is provided to a large number
  243. of remote hosts, this could still be a potential problem, but as a last
  244. resort remote name resolution could be disabled or rpcspy configured to not
  245. translate IP addresses.
  246.  
  247. UDP/IP datagrams may be fragmented among several packets if the datagram is
  248. larger than the maximum size of a single Ethernet frame. rpcspy looks only
  249. at the first fragment; in practice, fragmentation occurs only for the data
  250. fields of NFS read and write transactions, which are ignored anyway.
  251.  
  252. 3. nfstrace: The Filesystem Tracing Package
  253.  
  254. Although rpcspy provides a trace of the low-level NFS commands, it is not,
  255. in and of itself, sufficient for obtaining useful filesystem traces. The
  256. low-level commands do not by themselves reveal user-level activity. Furth
  257. ermore, the volume of data that would need to be recorded is potentially
  258. enormous, on the order of megabytes per hour. More useful would be an
  259. abstraction of the user-level system calls underlying the NFS activity.
  260.  
  261. nfstrace is a filter for rpcspy that produces a log of a plausible set of
  262. user level filesystem commands that could have triggered the monitored
  263. activity. A record is produced each time a file is opened, giving a summary
  264. of what occurred. This summary is detailed enough for analysis or for use as
  265. input to a filesystem simulator.
  266.  
  267. The output format of nfstrace consists of 7 fields:
  268.  
  269. timestamp | command-time | direction | file-id | client | transferred | size
  270.  
  271. where timestamp is the time the open occurred, command-time is the length of
  272. time between open and close, direc tion is either read or write (mkdir and
  273. readdir count as write and read, respectively). file-id identifies the
  274. server and the file handle, client is the client and user that performed the
  275. open, transferred is the number of bytes of the file actually read or
  276. written (cache hits have a 0 in this field), and size is the size of the
  277. file (in bytes).
  278.  
  279. An example record might be as follows:
  280.  
  281. 690691919.593442 | 17734 | read | basso:7b1f00000000400f | frejus.321 | 0 |
  282. 24576
  283.  
  284. Here, userid 321 at client frejus read file 7b1f00000000400f on server
  285. basso. The file is 24576 bytes long and was able to be read from the client
  286. cache. The command started at Unix time 690691919.593442 and took 17734
  287. microseconds at the server to execute.
  288.  
  289. Since it is sometimes useful to know the name corresponding to the handle
  290. and the mode information for each file, nfstrace optionally produces a map
  291. of file handles to file names and modes. When enough information (from
  292. lookup and readdir commands) is received, new names are added. Names can
  293. change over time (as files are deleted and renamed), so the times each
  294. mapping can be considered valid is recorded as well. The mapping infor
  295. mation may not always be complete, however, depending on how much activity
  296. has already been observed. Also, hard links can confuse the name mapping,
  297. and it is not always possible to determine which of several possible names a
  298. file was opened under.
  299.  
  300. What nfstrace produces is only an approximation of the underlying user
  301. activity. Since there are no NFS open or close commands, the program must
  302. guess when these system calls occur. It does this by taking advantage of the
  303. observation that NFS is fairly consistent in what it does when a file is
  304. opened. If the file is in the local buffer cache, a getattr call is made on
  305. the file to verify that it has not changed since the file was cached.
  306. Otherwise, the actual bytes of the file are fetched as they are read by the
  307. user. (It is possible that part of the file is in the cache and part is not,
  308. in which case the getattr is performed and only the missing pieces are
  309. fetched. This occurs most often when a demand-paged executable is loaded).
  310. nfstrace assumes that any sequence of NFS read calls on the same file issued
  311. by the same user at the same client is part of a single open for read. The
  312. close is assumed to have taken place when the last read in the sequence
  313. completes. The end of a read sequence is detected when the same client reads
  314. the beginning of the file again or when a timeout with no reading has
  315. elapsed. Writes are handled in a similar manner.
  316.  
  317.  
  318. Reads that are entirely from the client cache are a bit harder; not every
  319. getattr command is caused by a cache read, and a few cache reads take place
  320. without a getattr. A user level stat system call can sometimes trigger a
  321. getattr, as can an ls -l command. Fortunately, the attribute caching used by
  322. most implementations of NFS seems to eliminate many of these extraneous
  323. getattrs, and ls commands appear to trigger a lookup command most of the
  324. time. nfstrace assumes that a getattr on any file that the client has read
  325. within the past few hours represents a cache read, otherwise it is ignored.
  326. This simple heuristic seems to be fairly accurate in practice. Note also
  327. that a getattr might not be performed if a read occurs very soon after the
  328. last read, but the time threshold is generally short enough that this is
  329. rarely a problem. Still, the cached reads that nfstrace reports are, at
  330. best, an estimate (generally erring on the side of over-reporting). There is
  331. no way to determine the number of bytes actually read for cache hits.
  332.  
  333. The output of nfstrace is necessarily produced out of chronological order,
  334. but may be sorted easily by a post-processor.
  335.  
  336. nfstrace has a host of options to control the level of detail of the trace,
  337. the lengths of the timeouts, and so on. To facilitate the production of very
  338. long traces, the output can be flushed and checkpointed at a specified inter
  339. val, and can be automatically compressed.
  340.  
  341. 4. Using rpcspy and nfstrace for Filesystem Tracing
  342.  
  343. Clearly, nfstrace is not suitable for producing highly accurate traces;
  344. cache hits are only estimated, the timing information is imprecise, and data
  345. from lost (and duplicated) network packets are not accounted for. When such
  346. a highly accurate trace is required, other approaches, such as modification
  347. of the client and server kernels, must be employed.
  348.  
  349. The main virtue of the passive-monitoring approach lies in its simplicity.
  350. In [5], Baker, et al, describe a trace of a distributed filesystem which
  351. involved low-level modification of several different operating system
  352. kernels. In contrast, our entire filesystem trace package consists of less
  353. than 5000 lines of code written by a single programmer in a few weeks,
  354. involves no kernel modifications, and can be installed to monitor multiple
  355. heterogeneous servers and clients with no knowledge of even what operating
  356. systems they are running.
  357.  
  358. The most important parameter affecting the accuracy of the traces is the
  359. ability of the machine on which rpcspy is running to keep up with the
  360. network traffic. Although most modern RISC workstations with reasonable
  361. Ethernet interfaces are able to keep up with typical network loads, it is
  362. important to determine how much informa tion was lost due to packet buffer
  363. overruns before relying upon the trace data. It is also important that the
  364. trace be, indeed, non-intrusive. It quickly became obvious, for example,
  365. that logging the traffic to an NFS filesystem can be problematic.
  366.  
  367. Another parameter affecting the usefulness of the traces is the validity of
  368. the heuristics used to translate from RPC calls into user-level system
  369. calls. To test this, a shell script was written that performed ls -l, touch,
  370. cp and wc commands randomly in a small directory hierarchy, keeping a record
  371. of which files were touched and read and at what time. After several hours,
  372. nfstrace was able to detect 100% of the writes, 100% of the uncached reads,
  373. and 99.4% of the cached reads. Cached reads were over-reported by 11%, even
  374. though ls com mands (which cause the "phantom" reads) made up 50% of the
  375. test activity. While this test provides encouraging evidence of the accuracy
  376. of the traces, it is not by itself conclusive, since the particular workload
  377. being monitored may fool nfstrace in unanticipated ways.
  378.  
  379. As in any research where data are collected about the behavior of human
  380. subjects, the privacy of the individu als observed is a concern. Although
  381. the contents of files are not logged by the toolkit, it is still possible to
  382. learn something about individual users from examining what files they read
  383. and write. At a minimum, the users of a mon itored system should be informed
  384. of the nature of the trace and the uses to which it will be put. In some
  385. cases, it may be necessary to disable the name translation from nfstrace
  386. when the data are being provided to others. Commercial sites where filenames
  387. might reveal something about proprietary projects can be particularly
  388. sensitive to such concerns.
  389.  
  390.  
  391. 5. A Trace of Filesystem Activity in the Princeton C.S. Department
  392.  
  393. A previous paper[14] analyzed a five-day long trace of filesystem activity
  394. conducted on 112 research worksta tions at DEC-SRC. The paper identified a
  395. number of file access properties that affect filesystem caching perfor
  396. mance; it is difficult, however, to know whether these properties were
  397. unique artifacts of that particular environment or are more generally
  398. applicable. To help answer that question, it is necessary to look at similar
  399. traces from other computing environments.
  400.  
  401. It was relatively easy to use rpcspy and nfstrace to conduct a week long
  402. trace of filesystem activity in the Princeton University Computer Science
  403. Department. The departmental computing facility serves a community of
  404. approximately 250 users, of which about 65% are researchers (faculty,
  405. graduate students, undergraduate researchers, postdoctoral staff, etc), 5%
  406. office staff, 2% systems staff, and the rest guests and other "external"
  407. users. About 115 of the users work full-time in the building and use the
  408. system heavily for electronic mail, netnews, and other such communication
  409. services as well as other computer science research oriented tasks (editing,
  410. compiling, and executing programs, formatting documents, etc).
  411.  
  412. The computing facility consists of a central Auspex file server (fs) (to
  413. which users do not ordinarily log in directly), four DEC 5000/200s (elan,
  414. hart, atomic and dynamic) used as shared cycle servers, and an assortment of
  415. dedicated workstations (NeXT machines, Sun workstations, IBM-RTs, Iris
  416. workstations, etc.) in indi vidual offices and laboratories. Most users log
  417. in to one of the four cycle servers via X window terminals located in
  418. offices; the terminals are divided evenly among the four servers. There are
  419. a number of Ethernets throughout the building. The central file server is
  420. connected to a "machine room network" to which no user terminals are
  421. directly connected; traffic to the file server from outside the machine room
  422. is gatewayed via a Cisco router. Each of the four cycle servers has a local
  423. /, /bin and /tmp filesystem; other filesystems, including /usr, /usr/local,
  424. and users' home directories are NFS mounted from fs. Mail sent from local
  425. machines is delivered locally to the (shared) fs:/usr/spool/mail; mail from
  426. outside is delivered directly on fs.
  427.  
  428. The trace was conducted by connecting a dedicated DEC 5000/200 with a local
  429. disk to the machine room net work. This network carries NFS traffic for all
  430. home directory access and access to all non-local cycle-server files
  431. (including the most of the actively-used programs). On a typical weekday,
  432. about 8 million packets are transmitted over this network. nfstrace was
  433. configured to record opens for read and write (but not directory accesses or
  434. individual reads or writes). After one week (wednesday to wednesday),
  435. 342,530 opens for read and 125,542 opens for write were recorded, occupying
  436. 8 MB of (compressed) disk space. Most of this traffic was from the four
  437. cycle servers.
  438.  
  439. No attempt was made to "normalize" the workload during the trace period.
  440. Although users were notified that file accesses were being recorded, and
  441. provided an opportunity to ask to be excluded from the data collection, most
  442. users seemed to simply continue with their normal work. Similarly, no
  443. correction is made for any anomalous user activity that may have occurred
  444. during the trace.
  445.  
  446. 5.1. The Workload Over Time
  447.  
  448. Intuitively, the volume of traffic can be expected to vary with the time of
  449. day. Figure 1 shows the number of reads and writes per hour over the seven
  450. days of the trace; in particular, the volume of write traffic seems to
  451. mirror the general level of departmental activity fairly closely.
  452.  
  453. An important metric of NFS performance is the client buffer cache hit rate.
  454. Each of the four cycle servers allocates approximately 6MB of memory for the
  455. buffer cache. The (estimated) aggregate hit rate (percentage of reads served
  456. by client caches) as seen at the file server was surprisingly low: 22.2%
  457. over the entire week. In any given hour, the hit rate never exceeded 40%.
  458. Figure 2 plots (actual) server reads and (estimated) cache hits per hour
  459. over the trace week; observe that the hit rate is at its worst during
  460. periods of the heaviest read activity.
  461.  
  462. Past studies have predicted much higher hit rates than the aggregate
  463. observed here. It is probable that since most of the traffic is generated by
  464. the shared cycle servers, the low hit rate can be attributed to the large
  465. number of users competing for cache space. In fact, the hit rate was
  466. observed to be much higher on the single-user worksta tions monitored in the
  467. study, averaging above 52% overall. This suggests, somewhat
  468. counter-intuitively, that if more computers were added to the network (such
  469. that each user had a private workstation), the server load would decrease
  470. considerably. Figure 3 shows the actual cache misses and estimated cache
  471. hits for a typical private works tation in the study.
  472.  
  473.  
  474. Thu 00:00  Thu 06:00  Thu 12:00  Thu 18:00  Fri 00:00  Fri 06:00  Fri 12:00
  475. Fri 18:00 Sat 00:00 Sat 06:00 Sat 12:00 Sat 18:00 Sun 00:00 Sun 06:00 Sun
  476. 12:00 Sun 18:00 Mon 00:00 Mon 06:00 Mon 12:00 Mon 18:00 Tue 00:00 Tue 06:00
  477. Tue 12:00 Tue 18:00 Wed 00:00 Wed 06:00 Wed 12:00 Wed 18:00
  478.  
  479. 1000
  480.  
  481. 2000
  482.  
  483. 3000
  484.  
  485. 4000
  486.  
  487. 5000
  488.  
  489. 6000
  490.  
  491. Reads/Writes per hour
  492.  
  493. Writes
  494.  
  495. Reads (all)
  496.  
  497. Figure 1 - Read and Write Traffic Over Time
  498.  
  499. 5.2. File Sharing
  500.  
  501. One property observed in the DEC-SRC trace is the tendency of files that are
  502. used by multiple workstations to make up a significant proportion of read
  503. traffic but a very small proportion of write traffic. This has important
  504. implications for a caching strategy, since, when it is true, files that are
  505. cached at many places very rarely need to be invalidated. Although the
  506. Princeton computing facility does not have a single workstation per user, a
  507. similar metric is the degree to which files read by more than one user are
  508. read and written. In this respect, the Princeton trace is very similar to
  509. the DEC-SRC trace. Files read by more than one user make up more than 60% of
  510. read traffic, but less than 2% of write traffic. Files shared by more than
  511. ten users make up less than .2% of write traffic but still more than 30% of
  512. read traffic. Figure 3 plots the number of users who have previously read
  513. each file against the number of reads and writes.
  514.  
  515. 5.3. File "Entropy"
  516.  
  517. Files in the DEC-SRC trace demonstrated a strong tendency to "become"
  518. read-only as they were read more and more often. That is, the probability
  519. that the next operation on a given file will overwrite the file drops off
  520. shar ply in proportion to the number of times it has been read in the past.
  521. Like the sharing property, this has implications for a caching strategy,
  522. since the probability that cached data is valid influences the choice of a
  523. validation scheme. Again, we find this property to be very strong in the
  524. Princeton trace. For any file access in the trace, the probability that it
  525. is a write is about 27%. If the file has already been read at least once
  526. since it was last written to, the write probability drops to 10%. Once the
  527. file has been read at least five times, the write probability drops below
  528. 1%. Fig ure 4 plots the observed write probability against the number of
  529. reads since the last write.
  530.  
  531.  
  532. Thu 00:00  Thu 06:00  Thu 12:00  Thu 18:00  Fri 00:00  Fri 06:00  Fri 12:00
  533. Fri 18:00 Sat 00:00 Sat 06:00 Sat 12:00 Sat 18:00 Sun 00:00 Sun 06:00 Sun
  534. 12:00 Sun 18:00 Mon 00:00 Mon 06:00 Mon 12:00 Mon 18:00 Tue 00:00 Tue 06:00
  535. Tue 12:00 Tue 18:00 Wed 00:00 Wed 06:00 Wed 12:00 Wed 18:00
  536.  
  537. 1000
  538.  
  539. 2000
  540.  
  541. 3000
  542.  
  543. 4000
  544.  
  545. 5000
  546.  
  547. Total reads per hour
  548.  
  549. Cache Hits (estimated)
  550.  
  551. Cache Misses (actual)
  552.  
  553. Figure 2 - Cache Hits and Misses Over Time
  554.  
  555. 6. Conclusions
  556.  
  557. Although filesystem traces are a useful tool for the analysis of current and
  558. proposed systems, the difficulty of collecting meaningful trace data makes
  559. such traces difficult to obtain. The performance degradation introduced by
  560. the trace software and the volume of raw data generated makes traces over
  561. long time periods and outside of comput ing research facilities particularly
  562. hard to conduct.
  563.  
  564. Although not as accurate as direct, kernel-based tracing, a passive network
  565. monitor such as the one described in this paper can permit tracing of
  566. distributed systems relatively easily. The ability to limit the data
  567. collected to a high-level log of only the data required can make it
  568. practical to conduct traces over several months. Such a long term trace is
  569. presently being conducted at Princeton as part of the author's research on
  570. filesystem caching. The non-intrusive nature of the data collection makes
  571. traces possible at facilities where kernel modification is impracti cal or
  572. unacceptable.
  573.  
  574. It is the author's hope that other sites (particularly those not doing
  575. computing research) will make use of this toolkit and will make the traces
  576. available to filesystem researchers.
  577.  
  578. 7. Availability
  579.  
  580. The toolkit, consisting of rpcspy, nfstrace, and several support scripts,
  581. currently runs under several BSD-derived platforms, including ULTRIX 4.x,
  582. SunOS 4.x, and IBM-RT/AOS. It is available for anonymous ftp over the
  583. Internet from samadams.princeton.edu, in the compressed tar file
  584. nfstrace/nfstrace.tar.Z.
  585.  
  586.  
  587. Thu 00:00  Thu 06:00  Thu 12:00  Thu 18:00  Fri 00:00  Fri 06:00  Fri 12:00
  588. Fri 18:00 Sat 00:00 Sat 06:00 Sat 12:00 Sat 18:00 Sun 00:00 Sun 06:00 Sun
  589. 12:00 Sun 18:00 Mon 00:00 Mon 06:00 Mon 12:00 Mon 18:00 Tue 00:00 Tue 06:00
  590. Tue 12:00 Tue 18:00 Wed 00:00 Wed 06:00 Wed 12:00 Wed 18:00 0
  591.  
  592. 100
  593.  
  594. 200
  595.  
  596. 300
  597.  
  598. Reads per hour
  599.  
  600. Cache Hits (estimated)
  601.  
  602. Cache Misses (actual)
  603.  
  604. Figure 3 - Cache Hits and Misses Over Time - Private Workstation
  605.  
  606. 0 5 10 15 20
  607.  
  608. n (readers)
  609.  
  610. 0
  611.  
  612. 20
  613.  
  614. 40
  615.  
  616. 60
  617.  
  618. 80
  619.  
  620. 100
  621.  
  622. % of Reads and Writes used by > n users
  623.  
  624. Reads
  625.  
  626. Writes
  627.  
  628. Figure 4 - Degree of Sharing for Reads and Writes
  629.  
  630.  
  631. 0 5 10 15 20
  632.  
  633. Reads Since Last Write
  634.  
  635. 0.0
  636.  
  637. 0.1
  638.  
  639. 0.2
  640.  
  641. P(next operation is write)
  642.  
  643. Figure 5 - Probability of Write Given >= n Previous Reads
  644.  
  645. 8. Acknowledgments
  646.  
  647. The author would like to gratefully acknowledge Jim Roberts and Steve Beck
  648. for their help in getting the trace machine up and running, Rafael Alonso
  649. for his helpful comments and direction, and the members of the pro gram
  650. committee for their valuable suggestions. Jim Plank deserves special thanks
  651. for writing jgraph, the software which produced the figures in this paper.
  652.  
  653. 9. References
  654.  
  655. [1] Sandberg, R., Goldberg, D., Kleiman, S., Walsh, D., & Lyon, B. "Design
  656. and Implementation of the Sun Net work File System." Proc. USENIX, Summer,
  657. 1985.
  658.  
  659. [2] Mogul, J., Rashid, R., & Accetta, M. "The Packet Filter: An Efficient
  660. Mechanism for User-Level Network Code." Proc. 11th ACM Symp. on Operating
  661. Systems Principles, 1987.
  662.  
  663. [3] Ousterhout J., et al. "A Trace-Driven Analysis of the Unix 4.2 BSD File
  664. System." Proc. 10th ACM Symp. on Operating Systems Principles, 1985.
  665.  
  666. [4] Floyd, R. "Short-Term File Reference Patterns in a UNIX Environment,"
  667. TR-177 Dept. Comp. Sci, U. of Rochester, 1986.
  668.  
  669. [5] Baker, M. et al. "Measurements of a Distributed File System," Proc. 13th
  670. ACM Symp. on Operating Systems Principles, 1991.
  671.  
  672. [6] Metcalfe, R. & Boggs, D. "Ethernet: Distributed Packet Switching for
  673. Local Computer Networks," CACM July, 1976.
  674.  
  675. [7] "Etherfind(8) Manual Page," SunOS Reference Manual, Sun Microsystems,
  676. 1988.
  677.  
  678. [8] Gusella, R. "Analysis of Diskless Workstation Traffic on an Ethernet,"
  679. TR-UCB/CSD-87/379, University Of California, Berkeley, 1987.
  680.  
  681.  
  682. [9] "NIT(4) Manual Page," SunOS Reference Manual, Sun Microsystems, 1988.
  683.  
  684. [10] "XDR Protocol Specification," Networking on the Sun Workstation, Sun
  685. Microsystems, 1986.
  686.  
  687. [11] "RPC Protocol Specification," Networking on the Sun Workstation, Sun
  688. Microsystems, 1986.
  689.  
  690. [12] "NFS Protocol Specification," Networking on the Sun Workstation, Sun
  691. Microsystems, 1986.
  692.  
  693. [13] Postel, J. "User Datagram Protocol," RFC 768, Network Information
  694. Center, 1980.
  695.  
  696. [14] Blaze, M., and Alonso, R., "Long-Term Caching Strategies for Very Large
  697. Distributed File Systems," Proc. Summer 1991 USENIX, 1991.
  698.  
  699. Matt Blaze is a Ph.D. candidate in Computer Science at Princeton University,
  700. where he expects to receive his degree in the Spring of 1992. His research
  701. interests include distributed systems, operating systems, databases, and
  702. programming environments. His current research focuses on caching in very
  703. large distributed filesys tems. In 1988 he received an M.S. in Computer
  704. Science from Columbia University and in 1986 a B.S. from Hunter College. He
  705. can be reached via email at mab@cs.princeton.edu or via US mail at Dept. of
  706. Computer Science, Princeton University, 35 Olden Street, Princeton NJ
  707. 08544.
  708.  
  709.