Re: Guidlelines for Miaximum Virtual Memory in App Pool by Tim
Tim
Sat Dec 06 16:04:43 CST 2003
I've done a little more testing:
I compared my test application, which consists of a single test.aspx file
that displays the current time. It doesn't use database connections or
anything other than an inline script to display the time. On a Win2003
server with 1GB physical ram, I watched the Perfmon:Process:Virtual Bytes on
the w3wp instance (the worker process I believe). This app peaked at
414,400,512 bytes and generally stayed over 300mb. When I put it in a
separate application pool set to recycle if more than 250MB of virtual
memory was used, it recycled after a few minutes.
When I ran the application on a windows 2000 server with 128M ram, the
application peaked at roughly 168MB and pretty much stayed there (here I
watched the asp_wp instance -- I think this is an apples to apples
comparison).
When I run my database centric application (which retrieves as many as 25
rows at once) it peaks at 173MB - slightly more than the lightweight
test.aspx. Windows never increased the size of the page file, which is
196MB.
Could my problem be that memory is being allocated as a percentage of total
ram and not as a percentage of the ram allowed in my application pool (or
something along those lines)? Does my first test sound plausible or have I
muffed it (I' a little out of my area here). If ASP.NET initially allocates
based on "available" memery rather than the needs of the applicatin, then
any application no matter how small and well behaved will suffer frequent
recycling if the virtual memory limit is smaller than the amount that
ASP.NET attempts to allocate.
"Pat [MSFT]" <patfilot@online.microsoft.com> wrote in message
news:uHZ16GCvDHA.2248@TK2MSFTNGP09.phx.gbl...
> Virtual memory requirements are highly dependent on what the application
is
> doing. There is 2GB of VM available by default.
>
> Into this space go:
> Threads (256k each)
> Dlls (size will vary)
> The system heaps (min. 1MB ea, could be much, much larger)
> The GC Heaps (one per processor, use perfmon to see the size of each
> generation)
> Various other 'plumbing' (connection buffers, DB client cache, etc.)
> Session data (min. 12k per session, depends on what you store there)
>
> The design of the ASP.Net app has a huge impact on the VM required. If
you
> design your queries as "select * from MyTableOf1MillionRows", you will
need
> significantly more memory than a query that selects a single row. Caching
> the recordset also uses memory. These are not inherently bad, it is just
> trading memory footprint for performance.
>
> 200MB is probably a bit low, unless they also limit the number of
> connections and/or ASP.Net worker threads, or the pages are very simple.
> 512-->1GB is probably more realistic for most sites. Keep in mind that
> *every* process gets 2GB and this is irrespective of the RAM installed.
So,
> if you have a server w/8GB of RAM installed a given process would only be
> able to use 2GB, but you could have 50 processes, each getting 2GB.
>
> To see for sure, what your site would need, run it and watch
> Perfmon:Process:Virtual Bytes. Use a reasonable load and wait time (the
> average user clicks 1 ASPX page per minute).
>
> Pat
>
> "Tim Wood" <tww@nomail.com> wrote in message
> news:%23Dr7Y1BvDHA.1680@TK2MSFTNGP12.phx.gbl...
> > I'm trying to find some guidelines on what a reasonable value is for
> Maximum
> > Virtual Memory before recycling worker processes. (IIS6 Application Pool
> > settings). I set up a test pool with a max value of 250MB and run a
> single
> > .aspx page with one line of script in the Page_Load event --
> > Response.Write("this is a test-- " +
> > System.DateTime.Now.ToString("hh:mm:ss"));
> >
> > At this value after a few minutes of requesting the page (I just click
the
> > refresh button), the worker thread is recycled and adds the following
the
> > the event log:
> >
> > Event Type: Information
> > Event Source: W3SVC
> > Event Category: None
> > Event ID: 1077
> > Date: 12/6/2003
> > Time: 11:58:52 AM
> > User: N/A
> > Computer: ******
> > Description:
> > A worker process with process id of '3100' serving application pool
> 'AppPool
> > test' has requested a recycle because it reached its virtual memory
limit.
> >
> > If I increase the value to 500MB I do not get recycled (at least not
> > quickly). Does this make sense? This is a problem because my ISP
running
> > my real application has set my virtual limit to 200MB, I'm getting
> recycled
> > every few minutes and losing session state. I've been looking through
my
> > application for leaks and orphaned DB connections and so on, but my test
> > makes me think the problem lies elsewhere.
> >
> > My test server is Windows2003 Standard Edition with all critical updates
> > installed.
> >
> > If anyone can point me to some definitive reference on this I'd greatly
> > appreciate it.
> >
> > -Tim
> >
> >
>
>