From owner-freebsd-questions Fri Mar 26 4:47:36 1999 Delivered-To: freebsd-questions@freebsd.org Received: from hecate.webcom.com (hecate.webcom.com [209.1.28.39]) by hub.freebsd.org (Postfix) with ESMTP id 95EA615100 for ; Fri, 26 Mar 1999 04:47:35 -0800 (PST) (envelope-from graeme@echidna.com) Received: from kigal.webcom.com (kigal.webcom.com [209.1.28.57]) by hecate.webcom.com (8.9.1/8.9.1) with SMTP id FAA24541 for ; Fri, 26 Mar 1999 05:47:14 -0800 Received: from [204.143.69.15] by inanna.webcom.com (WebCom SMTP 1.2.1) with SMTP id 32399975; Fri Mar 26 04:44 PST 1999 Message-Id: <36FB81DB.10E5760B@echidna.com> Date: Fri, 26 Mar 1999 07:47:23 -0500 From: Graeme Tait Reply-To: graeme@echidna.com Organization: Echidna X-Mailer: Mozilla 4.5 [en] (Win98; U) X-Accept-Language: en Mime-Version: 1.0 To: freebsd-questions@freebsd.org Subject: Caching of large files in memory References: <3.0.6.32.19990313090012.007a0650@we.mediaone.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I have a moderately busy web server (2.2.7S/Apache - a few hundred thousand hits a day). It has been running fine with 128MB of memory. Recently the memory was expanded to 256MB, and about the same time, we started running a task that scans a large file (about 112MB) on each execution. This task also requires reading two smaller files of 12 and 20MB. So that's a total of 144MB, but there's an extra 128MB available, and the system seemed to cache the smaller files OK with 128MB memory. At first, it was clear all the files were being cached in memory. In the first execution after an idle period, the files might be read from disk, but then no disk activity was evident on repeated executions. However, after the server had been running about a day, things shifted so that the large file is evidently being read more-or-less entire from disk every time. This is true even after repeated, frequent reads of the file. Since the time the server was rebooted, named has been building a cache from reverse name resolution (about 8MB now, it will grow bigger yet), but otherwise I'm not aware of any changes. Presently top shows Mem: 90M Active, 46M Inact, 26M Wired, 87M Cache, 8318K Buf, 784K Free I'm wondering if anything can be done to encourage caching of the large file. I'm also curious as to why the system seems to read the large file entire, rather than caching at least some major part of it. I do have the option of breaking the large file into smaller pieces, the largest of which would be about 12MB. I'm wondering if this was done, and all the pieces were accessed frequently, would the system then cache most or all of these files in memory? Alternatively, I'd be prepared to expand memory still further, but only if I could be sure it would result in the files being reliably cached. -- Graeme Tait - Echidna graeme@echidna.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message