Re: IIS 6 app pool memory usage questions by Pat
Pat
Wed Mar 15 09:07:51 CST 2006
The string itself doesn't take that much - when you hit a page for the 1st
time, all of the ancillary structures and libraries get loaded up - which
bumps the VM usage. .Net leverages multiple heaps - small strings are
actually placed in Heap0 for garbage collection. So, whether a string is 8
bytes or 40k, the initial hit initiallizes all of the heaps, spawns worker
threads (256k per thread), etc. You can think of VM allocations as sparse
arrays - they tend to be oversized on allocation and are filled in over
time. Also, from the OS perspective, VM allocations tend to overstate the
issue. For example, NTDLL.DLL is the first dll loaded into every process -
and from a purely VM perspective space for the dll will be allocated from
every process. But the OS only actually loads one copy and remaps it
multiple times. So the actual amount of physical memory needed is much
smaller than adding up VM allocations.
Private Bytes gives you a better idea of memory actually used - though
w/.Net (or Java) you will tend to see stair steps b/c the memory manager
tends to preallocate large chunks. This ignores bytes that are remapped
from the OS. So, you don't get the double count. So, PB will give you an
idea of the resource footprint that adding another pool will have.
Pat
"jason" <jason@discussions.microsoft.com> wrote in message
news:F85A4EBB-CD35-44D4-9AD3-9384A99313BA@microsoft.com...
>I am using pefmon counter to monitor virtual bytes
>
> I look at task manager, that maps to RAM
>
> The two map directly to the memory based recycling in IIS app pools. at
> least all my testing indicates this.
>
> I am using 2 test apps, both very simple that do nothing more than to
> store
> a test string into session state
> one is using 1.1 framework, the other is using the 2.0
>
> what i see based on these counters, is that storing a short string in 1.1
> used about 30 megs or RAM and 440 megs of virtual
> on 2.0 its about 30 megs of RAM and 540 megs of virtual.
>
> when i look at other apps i see various numbers but nearly always over 400
> megs of virtual memory.
>
>
>
>
> "Pat [MSFT]" wrote:
>
>> 1) How are you measuring memory usage. The 2 counters that really matter
>> are (in PerfMon) Virtual Memory Allocated & Private Bytes. You can't
>> actually see the RAM used. VM Used will always be greater than private
>> bytes.
>>
>> 2) Depends to some degree on how much stuff you are loading into the
>> pool.
>> On a 32bit system, generally < 100; and most are 20-->50, complex ones
>> may
>> be <10.
>>
>> 3) It will depend entirely on the app itself. Perfmon:Process:Private
>> Bytes
>> is the best indicator of the actual memory footprint. Virtual Memory
>> allocated may not actually be 'backed' by RAM/Page File unless there is
>> data
>> actually put there. Windows Internals 4th Edition goes into great detail
>> on
>> memory and understanding how it is used.
>>
>>
>> Pat
>>
>>
>>
>>
>> "jason" <jason@discussions.microsoft.com> wrote in message
>> news:960EB4E0-FAF5-47F4-A746-49D6D99AD332@microsoft.com...
>> > 1. is it normal for an app pool to use a lot more virtual memory than
>> > RAM,
>> > say 15 times as much?
>> >
>> > 2. what can I expect the overhead per application pool to be? reason I
>> > as
>> > is
>> > I am wondering how many app pools I can have on a server.
>> >
>> > 3. where can I find benchmarks on how much memory an app should use?
>> >
>> > I am looking to break up application into their own app pools to
>> > isolate
>> > them from each other, but in doing so I noticed that each app pool that
>> > uses
>> > the 1.1 framework is consuming over 400 megs in virtual memory
>> > apps using the 2.0 framework use up over 500 megs of virtual memory,
>> > which
>> > is higher than the default for app pool recycling based on memory
>> > usage.
>> >
>> > I am trying to find out if that is normal, but haven't had much luck
>> > yet.
>> > thanks
>>
>>
>>