RE: doubt about 99% of the cases if the first byte of the file is cached.
Liang Yang <[email protected]>
| Newsgroups | gmane.network.tux |
|---|---|
| Message-ID | <[email protected]> |
Hi, Ingo Yes, Hard disk LED flashes for sometime even the server received the request of the same 10MB file for the 3rd, 4th,5th time. Maybe there are two possible reasons: first Linux read those not cached part of this 10MB file, second Linux swap some cached pages of other files to disk. I know how to read the first byte of a specific file(set req->desc.count=1 before I invoke do_generic_file_read ), but I don't know how to read just the last byte of file. Can u tell me? Thanks. Liang YANG -----Original Message----- From: [email protected] [mailto:[email protected]]On Behalf Of Ingo Molnar Sent: Tuesday, April 23, 2002 4:18 AM To: [email protected] Subject: Re: doubt about 99% of the cases if the first byte of the file is cached. On Tue, 23 Apr 2002, Liang Yang wrote: > Last time you told me "for 99% of the cases if the first byte of the > file is cached then the whole file is cached." well, this was a first-order estimation for typical web serving. > But I think the probability will be decreased from 99% if the file size > increase dramatically. [...] that is true. Note however that the typical website uses smaller files (not bigger than a couple of megabytes), partly due to the fact that most users have limited network bandwidth. A good second-order estimation is to look at the first byte of the file and the last byte of the file as well (these together are still very cheap), if both are cached then all of it is likely cached. (especially given that fact that the Linux pagecache is a modified form of LRU, and TUX reads the file in a forward sequential fashion, so if the first and last page is present then pages inbetween are quite likely to be present as well.) > [...] Now we try to let a TUX server a 10 MB file, we found > do_generic_file_read will indicate this file is already in the cache > when it is invoked for the second time. But we noticed the Hard Disk LED > of server flashed for a long time when the server received the file > request even for the second time(e.g. the file should be in the cache > now). It seems Linux try to read something(the part of file in disk?) > from the disk. you mean you did a full 10 MB HTTP GET of the file first time around, then the LED flashed, right? And then when you did it for the second time, it still flashed for a long time? Ingo _______________________________________________ tux-list mailing list [email protected] https://listman.redhat.com/mailman/listinfo/tux-list