Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Oct 2007 19:09:35 +0400
From:      "Artem Kuchin" <matrix@itlegion.ru>
To:        "William LeFebvre" <bill@lefebvre.org>, <freebsd-stable@freebsd.org>
Subject:   Re: Question about 'top' values on memory usage
Message-ID:  <037501c80f3d$69120730$0c00a8c0@Artem>
References:  <008801c80e66$7be49490$0c00a8c0@Artem> <471367F2.7050303@lefebvre.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?037501c80f3d$69120730$0c00a8c0>