ASP Caching, how does it work?

L

Larry Bud

I've tried to read up on ASP Caching in IIS 5, and have some questions
about.

Can someone tell me exactly WHAT is cached? Is it the output of the
page? If so, how can this be benefitial since ASP is dynamic.

I've always thought that ASP 3 was interpreted, so there's no
compiling going on. Is this right?

Bottom line is we're monitoring memory activity in dllhost.exe, and
the question of why one app would be larger than another (both in hi
isolation mode) when all the sessions of both apps have closed. We do
not have a memory leak in either, as the size of the app hasn't
gradually increased in time. So I figure some type of caching may be
going on that affects the memory.
 
P

Paul Baker [MVP, Windows - SDK]

Larry,

I think that ASP is compiled on first use in IIS 5, hence the "cache". I
have seen it be the case that I modified a .ASP file and it uses the one
from the cache, ie. the output *is* dynamic but the ASP behaves the same as
it did.

Paul
 
M

Michael D. Kersey

Larry said:
I've tried to read up on ASP Caching in IIS 5, and have some questions
about.

Can someone tell me exactly WHAT is cached?
There are two levels of caching in ASP:
1. Preprocessed ASP pages, or "templates, are cached as text:
- any #includes have been evaluated,
- each block of HTML has been replaced by a call to
Response.WriteBlock(N) where N = 0,1,... is the Nth block of HTML.
See
http://groups.google.com/groups?q=+...&rnum=1&ic=1&[email protected]
for some details.

2. The templates above are compiled to byte code and cached.
See
http://groups.google.com/groups?q=+...ng=r&[email protected]&rnum=2
for an example of the compiled byte code.

For more details read Appendix 3 at
http://www.microsoft.com/technet/pr...ptimize/iis5tune.mspx#XSLTsection130121120120
Is it the output of the page? No.

I've always thought that ASP 3 was interpreted, so there's no
compiling going on. Is this right? No.

Bottom line is we're monitoring memory activity in dllhost.exe, and
the question of why one app would be larger than another (both in hi
isolation mode) when all the sessions of both apps have closed. We do
not have a memory leak in either, as the size of the app hasn't
gradually increased in time. So I figure some type of caching may be
going on that affects the memory.

Here's the full text from Appendix 3 referred to above
( Note: this refers to IIS 5):

Appendix 3: ASP Caching

The ASP Template Cache stores templates: pre-compiled ASP pages in text
format (#includes have been evaluated, and so on). Its size is governed
by the AspScriptFileCacheSize setting in the metabase, which defaults to
250. The ASP Script Engine Cache holds ASP templates that have been
compiled into byte code. Its size is governed by the
AspScriptEngineCacheMax setting in the metabase, which defaults to 125.
The relationship between the two is that an ASP page is cached once in
the template cache, but it can appear many times in the script engine
cache if it is being executed on many threads simultaneously. A site
with a lot of memory and a lot of distinct ASP pages that get hit often
will probably want to increase AspScriptFileCacheSize (monitor ASP
counters with System Monitor to diagnose). There is much less need to
increase AspScriptEngineCacheMax; the main reason would be that the
defaults are inadequate for machines with 8 or more processors.
AspScriptEngineCacheMax should have a metabase value that is equal to or
greater than the number of CPUs plus one, multiplied by
AspProcessorThreadMax. AspProcessorThreadMax defaults to 25.

Every process that hosts ASP will have its own ASP Template and Script
Engine Caches. By default that is just one process because ASP
applications run at medium isolation in the pooled Dllhost process.

When ASP gets a request for a page, it checks the ASP Template Cache
first. If there's an instance of that page cached there, the request is
forwarded to the Script Engine Cache. If the requested page is not in
the Template Cache, it is compiled into a template and forwarded to the
ASP Script Engine Cache. If an instance of the page is cached in the
Script Engine Cache and it is ready to run, that engine is run. Failing
that, if there is an instance of the page that is already executing, ASP
clones that running engine and executes the clone. This avoids the cost
of re-parsing the template into byte code. If there is no script engine
associated with the page, ASP takes the precompiled template from the
ASP Template Cache, creates a new script engine and has it compile the
template into byte code, and then executes it. When a page finishes
executing, the script engine is put at the head of the free list. If the
free list has grown larger than AspScriptEngineCacheMax, the
least-recently used script engine is destroyed. A hit in the script
engine cache means that ASP can avoid recompiling the template into byte
code.

Good Luck,
Michael D. Kersey
 
P

Paul Baker [MVP, Windows - SDK]

Just to be clear:

Brian is talking about the Internet Explorer cache on the client side. The
response to ASPs are cached. They will not have modified date, etc.,
therefore these cache entries should only be used when working offline or if
you configured Internet Explorer never to look for newer versions. Having
said that, there may be a bug there in some versions of Internet Explorer.

Others are talking about the IIS cache on the server side. That is what I
thought Larry was talking about, but perhaps not.

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top