home *** CD-ROM | disk | FTP | other *** search
/ Cuteskunk BBS / cuteskunk.zip / cuteskunk / Unix-Hacking-Documents / nfs_trace.txt < prev    next >
Text File  |  2003-06-29  |  36KB  |  698 lines

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