RE: doubt about 99% of the cases if the first byte of the file is cached.

Ingo Molnar <[email protected]>
Newsgroups gmane.network.tux
Message-ID <[email protected]>
On Tue, 23 Apr 2002, Liang Yang wrote:

> In our test case, we just build 10 files and each file is 5MB,10 files
> and each file is 10MB, 10 files and each file is 50MB. The main memory
> of TUX server is 256MB.

ok. Then depending on the workload it might as well happen that portions
of a bigger file are flushed. But generally it should be an all or nothing
flush. Partial flushes should in theory happen in LRU order, ie. the
beginning of the file (the one accessed earlier by TUX) should be flushed
out first. Note that this a pretty much unspecified portion of the Linux
VM, and i've seen bugs in this area previously. But the first-byte and
last-byte rule should be good enough. You might also want to test the
middle of the file for good measure :-)

> Why we build such big files for testing, the reason is we want linux to
> flush out those files when the cache limit is reached.  So we can update
> caching status table in proxy.

sure, this is a sensible thing.

> Now the question is can we know the maximum cache size of a backend
> server running Linux 2.4.18 if the main memory is 256MB?

hm. The available free RAM right after bootup should be a good measure. Or
80% of the MemTotal field in /proc/meminfo is also something that should
be pretty close to the real value. Or adding the 'MemFree' value to the
current 'Cached' value.

the easiest way is to do a 'cat * > /dev/null' in your docroot, and look
at the Cached value in /proc/meminfo - that is the exact maximum size of
your pagecache.

there is no exact measure for the maximum, the pagecache uses the same 
page pool that is used for network buffers and all the other stuff, so the 
limit is dynamic.

of course it also depends on how much load other applications generate -
for a dedicated proxy there shouldnt be many.

> BTW, we record the time for the request of a speicifc file in our test
> case. We found if the total size of all those http request files is
> bigger than 100MB, then the request time for a file again and again will
> be increased instead of decreased. So the performance of TUX is not
> improved because Linux take much time to swap between cache and disk.

hm, the effective pagecache size should definitely be larger than 100 MB,
on a 256 MB box.

	Ingo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.