473,394 Members | 1,794 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

ASP.NET 2.0 web cache insert fails

As per Anthony's suggestion, I'm moving this discussion thread to this group.
The history:

We recently moved an older ASP.NET 1.1 code base on to ASP.NET 2.0, .NET 3.0
and Windows 2003 Server SP2. We started experiencing the following issue with
the web cache (the code is straightforward and worked flawlessy before the
upgrade):

Dim o As Object = Cache.Get(key)
If o Is Nothing Then
Cache.Insert(key, GetTheData())
o = Cache.Get(key)
End If

Randomly, Cache.Get(key) returns nothing, even after the application has
been up for a while. Then the Cache.Insert kicks in. Only that the call to
Insert fails with no error and no exception. The subsequent Cache.Get(key)
returns nothing. I've tried to set up the expiration to some remote date in
the future and the sliding expiration; still nothing. I tried something like
this;

Cache.Insert(key, GetTheData(), Nothing,
DateTime.Parse("1/1/9999"),Cache.NoSlidingExpiration)

and

Cache.Insert(key, GetTheData(), Nothing, Cache.NoAbsoluteExpiration,
TimeSpan.FromDays(365))

I even added after the first failed Insert a Thread.Sleep(20) the tried the
Insert again. Didn't work either.

I searched on the Internet and I found a few other posts describing a
similar issue. Yet no reply to any of them so it seems that there is not much
knowledge about this strange issue.

Any idea is highly appreciated.

Thanks,

cat
Could the problem be with the GetTheData method?
You might be better off asking in the

microsoft.public.dotnet.framework.aspnet

group.

--
Anthony Jones - MVP ASP/ASP.NET

Thank you Anthony for taking the time to reply. After my initial posting I
spent some time researching on the Internet and trying out some other things,
so I do have some more information.

1. To answer to your questions/suggestions:
1.a. I will move this discussion to microsoft.public.dotnet.framework.aspnet
1.b. GetTheData was just some very generic pseudocode. The real code
retrieves the information as a dataset based on some criteria, then saves
this dataset to the cache. I am storing a reference to the retrieved dataset
before putting it in the cache, so the code is more like this:

Dim dt As DataSet = GetTheData()
Cache.Insert(key, dt, Nothing,
DateTime.Parse("1/1/2999"),Cache.NoSlidingExpiration)
2. After several days of researching this issue and experimenting various
things, I kind of reached the conclusion that this must be something related
to the memory management. Everything is ok until w3wp (iis worker process)
exceends 400 MB. The computer I am running all those tests has 1 GB RAM.
Subtracting the OS and system cache memory allocations, the 400 MB threshold
means that the computer has under 100 MB of available physical RAM. After
passing that threshold, it seems that .NET runtime refuses to add items to
the cache while also not telling anything to the code (as in, raising some
sort of out of memory exception). Either ASP.NET 2.0 is a more memory hog or
whatever else changed, but this was not happening before upgrading the code
base/site to .NET 3.0 / ASP.NET 2.0 / w2k3 SP2. The site itself is complex
but not that big. It puzzles me why w3wp would grow beyond 400 MB of RAM.

3. I have downloaded, installed and run CLR profiler and ANTS profiler. I am
trying to figure out what's going on at the lower levels. To my surprise,
ANTS (non-Microsoft, not free tool) is worse than CLR profiler (Microsoft
free tool). To this point, it seems that the .net runtime is doing some
allocations (mostly strings) that sit there forever and eat up memory. At
some point I manage to induce a system failure; w3wp gets into a continuous
loop, and IIS fails to ping it therefore it recycles it. I can do that afther
hitting the site for about 10 minutes continuously. All very weird. Never had
those problems before upgrading the code to .NET 3.0 / ASP.NET 2.0 / Win2k3
SP2. A colleague of mine has a similar environment, just SP1 instead of SP2,
so I started wondering whether Microsoft created some weird bug in the heap
allocator in SP2.

Dec 23 '07 #1
4 1886
After further testing, I've noticed that on a Windows Server 2003 R2 SP1
machine w3wp stays under 90 MB, on the SP2 machine that I'm doing development
on it goes to around 250 MB with the same code and same pages hit; if I
navigate for a while (like 15-30 minutes) between those pages at some point
the w3wp's memory consumption exceeds 350 MB and it starts going up by itself
with no navigation whatsoever. At that point the IIS ping fails (so w3wp
becomes unresponsive) and so IIS restarts the worker process. Not sure if
this has any relevance, but the pages are a mixture of old ASP with VB COM+
objects and ASP.NET pages with business layer components written in VB.NET
and C#.
Dec 23 '07 #2
Do you have "ASPCOMPAT = true" in the @Page directives for your pages that
need to support classic COM components?
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
"cat" wrote:
After further testing, I've noticed that on a Windows Server 2003 R2 SP1
machine w3wp stays under 90 MB, on the SP2 machine that I'm doing development
on it goes to around 250 MB with the same code and same pages hit; if I
navigate for a while (like 15-30 minutes) between those pages at some point
the w3wp's memory consumption exceeds 350 MB and it starts going up by itself
with no navigation whatsoever. At that point the IIS ping fails (so w3wp
becomes unresponsive) and so IIS restarts the worker process. Not sure if
this has any relevance, but the pages are a mixture of old ASP with VB COM+
objects and ASP.NET pages with business layer components written in VB.NET
and C#.
Dec 24 '07 #3
We didn't use that as we deemed it's not needed. The .NET pages use .NET
application & business components. The classical ASP pages use COM+ VB
components. We are in the process of converting the current code base to .NET
and we converted all layers for the features that we managed to convert. The
code base is fairly big, so it will be another while until we are pure .NET
(we are at about 75% of the code base at this point).

From my initial tests, it seems that when hitting only the ASP.NET pages or
only the ASP pages, w3wp memory usage stays relatively constant (still over 2
times higher than on the SP1 machines). The issue seems to get triggered when
navigating between the 2 kinds of pages. I'll run further tests today to
validate this assumption.

"Peter Bromberg [C# MVP]" wrote:
Do you have "ASPCOMPAT = true" in the @Page directives for your pages that
need to support classic COM components?
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
"cat" wrote:
After further testing, I've noticed that on a Windows Server 2003 R2 SP1
machine w3wp stays under 90 MB, on the SP2 machine that I'm doing development
on it goes to around 250 MB with the same code and same pages hit; if I
navigate for a while (like 15-30 minutes) between those pages at some point
the w3wp's memory consumption exceeds 350 MB and it starts going up by itself
with no navigation whatsoever. At that point the IIS ping fails (so w3wp
becomes unresponsive) and so IIS restarts the worker process. Not sure if
this has any relevance, but the pages are a mixture of old ASP with VB COM+
objects and ASP.NET pages with business layer components written in VB.NET
and C#.
Dec 24 '07 #4
Just to be very clear on this aspect: we have no problem whatsoever with this
code base on the production servers, which are windows 2003 server R2 SP1.
This problem started happening about 2 months ago in development and qa.
During those 2 months we wrote some new features and we installed w2k3 SP2.
I've reviewed the code we changed and there seems to be no relevant change
in the application layer that could have caused any such problem. That would
leave SP2 as suspicious.

"cat" wrote:
We didn't use that as we deemed it's not needed. The .NET pages use .NET
application & business components. The classical ASP pages use COM+ VB
components. We are in the process of converting the current code base to .NET
and we converted all layers for the features that we managed to convert. The
code base is fairly big, so it will be another while until we are pure .NET
(we are at about 75% of the code base at this point).

From my initial tests, it seems that when hitting only the ASP.NET pages or
only the ASP pages, w3wp memory usage stays relatively constant (still over 2
times higher than on the SP1 machines). The issue seems to get triggered when
navigating between the 2 kinds of pages. I'll run further tests today to
validate this assumption.

"Peter Bromberg [C# MVP]" wrote:
Do you have "ASPCOMPAT = true" in the @Page directives for your pages that
need to support classic COM components?
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
"cat" wrote:
After further testing, I've noticed that on a Windows Server 2003 R2 SP1
machine w3wp stays under 90 MB, on the SP2 machine that I'm doing development
on it goes to around 250 MB with the same code and same pages hit; if I
navigate for a while (like 15-30 minutes) between those pages at some point
the w3wp's memory consumption exceeds 350 MB and it starts going up by itself
with no navigation whatsoever. At that point the IIS ping fails (so w3wp
becomes unresponsive) and so IIS restarts the worker process. Not sure if
this has any relevance, but the pages are a mixture of old ASP with VB COM+
objects and ASP.NET pages with business layer components written in VB.NET
and C#.
Dec 24 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Dave | last post by:
I am currently having a problem with retaining the cache in my asp.net application. I am trying to insert a small DataView into cache, then recall it on various pages throughout the site. When on...
3
by: martin | last post by:
Hi, I am storing a dataset in cache, which is happening fine. I can easily retrive it at postback from the cache, cast it to a dataset and reuse it. However I have specified that the cache...
1
by: Glenn | last post by:
Hi, I have a config XML file that I am using from the application cache. I have configured the entry with a remove callback to re-populate cache automatically when the XML file changes. All is...
3
by: MattC | last post by:
Hi, I am persisting the viewstate for each page into the Cache object, below is shown my methods for saving and loading: I am able to save the viewstate to the cache and most times I can load...
5
by: Andrew | last post by:
I insert into the cache: if (Cache == null) { Cache.Insert("testQuestion"+ i, ds.Tables); }
5
by: Stan SR | last post by:
Hi, Some newbie questions.. :-) First, what is the namespace to use for the Cache class ? When I use this bit of code I get an error if (Cache==null) Cache.Insert("myUserList",userlist);...
1
by: =?Utf-8?B?ZGF2ZQ==?= | last post by:
I have an asp.net project with a business layer (project) that has a class called references. It loads up a data set and stores in cache with the following code. _cached =...
0
by: pmouse | last post by:
Hi Guys, I've written a templated lru cache based on the SGI version of STL. To use the class, simply write: lru_cache<key_type, data_type, cache_length, custom_containercache; cache.insert( key,...
2
by: =?Utf-8?B?Y2F0?= | last post by:
We recently moved an older ASP.NET 1.1 code base on to ASP.NET 2.0, .NET 3.0 and Windows 2003 Server SP2. We started experiencing the following issue with the web cache (the code is straightforward...
3
by: helveticus | last post by:
This really puzzles me. I have an application with a single style sheet (30KB) and a series of js files, all declared in the header section of the master page the standard way: <link...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.