473,401 Members | 2,139 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,401 software developers and data experts.

Application State usage/tuning and "Object reference not set" erro

Our system is:
IIS Server: dual Intel Xeon 2.80 GHz, 4 GB Ram
Windows Server 2003 SP2
IIS 6.0

SQL Server: dual Intel Xeon 2.80 GHz, 4 GB Ram (separate server)
Windows Server 2003 SP2
SQL Server 2000

We are having some problems with a website we are developing, and had some
questions.

Background:
The application consists of ASP.Net 2.0 pages calling VB.Net 2.0 dlls. The
application retrieves a large dataset from SQL Server and creates a large
object structure, which is then stored in the Application “state” area with a
line like
Current.Application.Add(Current.Session.SessionID + keyName, keyValue)

As the user navigates to the various pages of the application, the stored
object is retrieved from state as follows
strWhatIsCheckedOut = SessionCache.Project.ItemCheckedOutValue

The SessionCache.Project object is actually a function, that when unrolled
makes this line:
strWhatIsCheckedOut =
DirectCast(Current.Application.Get(Current.Session .SessionID +
"CurrentProject"), Project).ItemCheckedOutValue

There are times in the code when SessionCache.Project is called repeatedly
to fetch multiple items. Sometimes the object that is returned is walked in
order to retrieve the information needed to present to the user for this
particular page. After a couple of minutes when multiple people, and
possibly multiple browsers per person, are accessing the site one of the
pages will get an ‘Object reference not set to an instance of an object”. We
have tracked this down to the line of code where we get the object from the
application state. Once the error occurs, the other browsers for the same
user will also throw similar errors when the user takes some action on the
page. The other users also have similar errors at that point in time. Even
before the errors happen, there are sometimes substantial delays (~10
seconds) in bringing a page up with no database hits, just retrieving data
from the application state.

We added code to our Application_OnStart event to let us know when the
application recycles. Very seldom did it appear that the Application_OnStart
event fired when we were losing sessions. Thus, is it possible, that the site
spawns a new application pool when the existing one becomes heavily loaded
which might cause a inproc session problem without triggering an
Application_OnStart event.

We have been using various tools to troubleshoot these problems. We have
been watching CPU utilization with Performance Monitor, and Memory
utilization with Task Manager. We have also put in some debugging
information into our pages. Looking at the size of the garbage collector
memory {System.GC.GetTotalMemory(True) }, it appears that one of the larger
“Project” objects can take up around 70 MB of memory when it is created. As
we load one of these Project objects from the database and into the
application state, we observed in TaskMgr the memory footprint of the
w3wp.exe process increases by around 120MB (fairly evenly split between real
memory and virtual memory). As additional browsers were launched and loaded
this “project” object, the w3wp.exe process kept increasing by varying
amount, often around 100MB.

When the user initially loads a “project”, we see a short (1 sec) ~80% CPU
hit on the SQL box as the data is retrieved. On the IIS box, we see a longer
(4 – 20 sec) ~40% CPU hit when we think the object is being put into the
application state. As the user navigates around the site, and each page
fetches the object from the application state, we see similar 4-20 sec 40%
CPU hits on IIS.

We have 3 main concerns:
1. The errors which not only bring down the first user, but tends to bring
down all the users.
2. The performance of the site is poor. Pages take a substantial amount of
time to load. (CPU utilization is high for an extended period of time)
3. It appears that there is a large memory footprint, that greatly limits
the number of users that the system can handle.

Questions:
1. Are we guaranteed that every unique instance of an IE browser on a single
computer will have its own unique session and unique session id, even if the
browsers are all open concurrently?
2. How is a complex object, such as an arbitrary object structure with
several thousand child objects, stored in the application state?
3. What kind of overhead is associated with storing an object in application
state?
4. How are lookups by key for objects in the application state performed?
a. Do lookups happen in O(1), O(#keys), O(size of application state)?
5. What has to happen (deserialize, transfer data from one process to
another, etc.) to get an object out of application state? E.g. obj =
Application(key)
6. What kinds of things, besides Application(key) = SomethingElse, could
cause the object associated to a given key to “disappear” from the
application state?
7. Will the system need to refetch the object from state when there are
multiple calls to Current.Application.Get() occurring on the same key?
8. What is the w3wp.exe process?
9. Is its growth in memory footprint, both real and virtual, indicative of
the size of object stored in the application state?
10. What will happen as this footprint approaches and exceeds 2GB?
11. Should there be concern having the memory footprint of w3wp.exe get
large.
12. Is it to be expected to have multiple second elapsed time in putting
objects of this size into and getting it out of the application state?

Jun 25 '07 #1
0 2190

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

Similar topics

7
by: Ryan Park | last post by:
Hi, //SITUATION I got a panel control that hold a certain position on a form. Every controls or UIs are on this panel. At certain situation, I called dispose() method of this panel control...
0
by: howie | last post by:
I've upgraded a vb6 application to vb .net and am having an issue. whenever I try to set the recordset property of the VB6.adodc object in .net and run the application I get the error “object...
2
by: tJ | last post by:
Hi I'm working on a form with a splitControl. In the RHS panel2, I need to add a panel to drop radioButtons onto. But when i do this, I get the following error message: "Object reference not...
1
by: Paul Tomlinson | last post by:
Question about a System.Threading.Timer object and the "state" object you pass to it... Timer stateTimer = new Timer( = new TimerCallback( OnTimer ), o, 1000, 1000); I have an array of timer...
1
by: vijay | last post by:
Hi I am working on a web application. I have huge form where in I have filled some part of the form and after two hours again I started filling the rest of the form but I got the following error ...
18
by: Microsoft | last post by:
When I try this in my code I alwas get an errormessage: "Object reference not set to an instance of an object" Dim g As System.Drawing.Graphics g.DrawString("Test", New Font("Arial", 12,...
2
by: xhenxhe | last post by:
I don't some Excel automation. I've created a program that opens and Excel template and inputs information to it. It runs great on my machine. When I build and deploy I have a user that keep...
1
by: nguyentrongkha | last post by:
I have two asp.net applications that host on server 2003. I create a hyper link on one application that links to default page of the other application.Whenever users click on that link, I get a...
3
by: Sarah | last post by:
Hi - Please be gentle. I am quite new to visual basic, but I have been going through tutorials and reading up. I found a code snippet on the internet that I wanted to see if I could re-purpose...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.