473,394 Members | 1,932 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

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

Dec 21 '07 #1
2 2831

"cat" <ca*@discussions.microsoft.comwrote in message
news:E3**********************************@microsof t.com...
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.
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
Dec 22 '07 #2
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.
"Anthony Jones" wrote:
>
"cat" <ca*@discussions.microsoft.comwrote in message
news:E3**********************************@microsof t.com...
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.

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
Dec 23 '07 #3

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

Similar topics

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,...
4
by: =?Utf-8?B?Y2F0?= | last post by:
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...
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: 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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.