can I load database data in global.asa

C

c676228

Hi everyone,
I never used global.asa. I am thinking of load some data in
application_onstart which is read only from database(I mean the data will
never be changed in any asp pages of the applcation) and so any session for
this application doesn't need to reload data from database again, reduce
database connection and procedure call.
Am I right? just doesn't see that kind of comments on-line.
I want to make sure this is the right concept before I am heading too far.
 
S

Slim

Yes you can.

but don't load objects into Application or Session variables this is
inefficient. You an load the values you retrieved from the database into
Application or Session variables
 
W

Walter Wang [MSFT]

Hi Betty,

I agree with Slim. You could load read-only data from database and save it
with application scope. Though you need to be caution with the data size,
loading too many data into application state sometimes will decrease your
performance instead.

You can refer to following article for more info:

#IIS 5.0 Resource Guide - ASP Best Practices
http://www.microsoft.com/technet/prodtechnol/windows2000serv/technologies/ii
s/reskit/iisappa.mspx

Please let us know whether or not you need further information regarding
this post. Thanks.

Sincerely,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
C

c676228

Thank you, Slim and Walter. Probably I will write a test asp page to load
this chunk of data to see if it will impact on the performance or not.
 
C

Craig Douglas

I tried that very thing when I was new to this [ with a news site] and found
it to be a complete waste of time.

unfortunately it means making the first user wait while all this data is
loaded in. Try demoing a sluggish-to-start site to your boss and see the
reaction.

If you're thinking a few variables, then it might perform faster in the very
short term, if you're thinking a dataset......then no.

In terms of application development, you're storing up problems for yourself
later. The style of construction won't scale to anything meaning full,
which, if your app is at all successful, will be a problem.

A problem you will have is having to re-boot your app every time the data in
the database is changed[even if not by the app]. (clearing the sessions of
any users who are using it)

Craig
 
B

Bob Barrows [MVP]

Craig said:
I tried that very thing when I was new to this [ with a news site]
and found it to be a complete waste of time.

unfortunately it means making the first user wait while all this data
is loaded in.

vs. making every user wait for the data? hmmm
Try demoing a sluggish-to-start site to your boss and
see the reaction.

I dunno. My boss understands the reasons for this. Of course, it can be
mitigated ... instead of loading everything in global.asa, load the
variables the first time they are used ... epspecially if they are rarely
used. Another idea is to do this activity asynchronously via XMLHTTP (server
or dlient-side).
If you're thinking a few variables, then it might perform faster in
the very short term, if you're thinking a dataset......then no.

Depends on the size of the dataset, doesn't it?
In terms of application development, you're storing up problems for
yourself later. The style of construction won't scale to anything
meaning full, which, if your app is at all successful, will be a
problem.

Sorry, I just don't agree with this statement. It can be true if one
overdoes caching, but it does not have to be true.
A problem you will have is having to re-boot your app every time the
data in the database is changed[even if not by the app]. (clearing
the sessions of any users who are using it)
<chuckle> Reboot the app to update application variables?? How about
creating a page that reloads them and calling that page when they need to be
refreshed? Loading/refreshing the app variables does not have to take place
in global.asa.

If the data changes that frequently, it is probably not a good candidate to
be cached in Application ... Session may be more suitable.
 
M

Mike Brind

c676228 said:
Hi everyone,
I never used global.asa. I am thinking of load some data in
application_onstart which is read only from database(I mean the data will
never be changed in any asp pages of the applcation) and so any session
for
this application doesn't need to reload data from database again, reduce
database connection and procedure call.
Am I right? just doesn't see that kind of comments on-line.
I want to make sure this is the right concept before I am heading too far.


Tip 2 in the article here:
http://msdn2.microsoft.com/en-gb/library/ms972335.aspx#asptips_topic3 is
probably more like what you are looking for. Tip 3 is relevant too.

I use Tip 2 for data that only changes once a month or so, and store a
string of html in an Application level variable. Each time a new item is
added, or an existing one amended, one line on the Add or Edit page script
sets the Application level variable to an empty string, forcing a function
to rebuild the string with the new data.
 

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,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top