From owner-freebsd-stable@FreeBSD.ORG Mon Oct 15 15:09:49 2007 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C4E116A419 for ; Mon, 15 Oct 2007 15:09:49 +0000 (UTC) (envelope-from matrix@itlegion.ru) Received: from corpmail.itlegion.ru (corpmail.itlegion.ru [84.21.226.211]) by mx1.freebsd.org (Postfix) with SMTP id E650E13C468 for ; Mon, 15 Oct 2007 15:09:46 +0000 (UTC) (envelope-from matrix@itlegion.ru) Received: (qmail 12481 invoked from network); 15 Oct 2007 19:09:43 +0400 Received: from unknown (HELO Artem) (192.168.0.12) by 84.21.226.211 with SMTP; 15 Oct 2007 19:09:43 +0400 X-AntiVirus: Checked by Dr.Web [version: 4.44, engine: 4.44.0.09170, virus records: 249595, updated: 15.10.2007] Message-ID: <037501c80f3d$69120730$0c00a8c0@Artem> From: "Artem Kuchin" To: "William LeFebvre" , References: <008801c80e66$7be49490$0c00a8c0@Artem> <471367F2.7050303@lefebvre.org> Date: Mon, 15 Oct 2007 19:09:35 +0400 Organization: IT Legion MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="koi8-r"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 Cc: Subject: Re: Question about 'top' values on memory usage X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Oct 2007 15:09:49 -0000 William LeFebvre wrote: > Artem Kuchin wrote: >> Hello! >> >> Maybe someone with deeper knowledge of the internals of FreeBSD >> can clean up something for me (any for many others)^ >> >> Here are lines from my top: >> >> PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU >> COMMAND 9258 hordelo_ru 1 4 0 40992K 4260K accept 0 0:00 >> 0.00% httpd 9257 hordelo_ru 1 44 0 40992K 4296K select 1 >> 0:00 0.00% httpd 9259 hordelo_ru 1 4 0 40992K 4292K select >> 1 0:00 0.00% httpd >> >> As you see, 'size' is the same for all processes, while RES varies. >> >> As i understand, the real memory taken by a process is RES and SIZE >> include a bunch of shares .so libs, so, if more httpd's started each >> will take only about 4300K more, so, 100 https will take 430000K to >> run, right? >> >> Another question is that is httpd uses threads (as provided by >> FreeBSD) starting a new thread will or will not copy executable copy >> and data? Basically, >> will a new thread eat another 4300K or just a little bit for its >> data? >> > > > SIZE is the total amount of virtual memory that a process has > allocated. This includes text, data, and stack. It also includes > all the stuff that's shared with other processes (mostly through the > use of shared libraries). > > RES is the amount of physical memory in use by the process and will > only include that part of a process's virtual memory space which is > currently allocated in physical memory. > > Unfortunately, freebsd does not appear to track the amount of shared > virtual memory for each process. It could be obtained by walking > through all the pages in a process's vm map, but that would really > slow top down. I don't know of any freebsd utility that would give > that information for an individual process. But hey, if it's out > there somewhere where it is easy to grab, I would be very happy to > add it to top. My knowledge of VM system of FReebSD is so low, that even though i can write in C i don't know where to start here. I haven't found anything ready for this. make search in port on 'memory' and 'ram' does not return much. >> All this i need to calculate maximum possible number of https i can >> run on a box >> with certain amount of memory and select proper MPM for Apache. >> Somehow, i could not find any practical info on this regarding >> FreeBSD. > > > limits how many of them can be active at a given time. You're not > just going to be able to sit down and plug numbers in to a formula > and say "voila!". You will have to observe how httpd performs in your > particular environment to see how many page faults per second it > generates and decide for yourself the point at which X pf/s is too > much. Of course, but i need to start with something instead of just pure guess out of the blue. > Personally, based on my experience, I would be more concerned with the > amount of available cpu cycles than memory. CPU is more than just enough in my case. There will a a lot https sitting there but load, i am sure, will be low. Swapping is simply unacceptable, so i am counting only real physical ram. However, noone mentioned anything about threads. DO they give any memory advantage on freebsd? -- Regards, Artem