Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > ASP performance issues

Reply
Thread Tools

ASP performance issues

 
 
Woody
Guest
Posts: n/a
 
      06-05-2004
I have a page that is linked into by other pages that pass it query
strings, it then reads a config file, displays 1 of several forms, gets
posted to itself, depending upon users response may display a different
form etc etc.

I want to take the config data and have that read by a globals.asa and
then use application("VariableName") to reference it.

i also want to take the initial query strings and load them into session
variables.

Problem is, whats does a globals.asa file look like? how do i build one?
how do i make it referenced in my page?

Thanx
Woody
any sugestion or comment made by me should be examined first for
validity and appropriateness before assuming i have any idea at all
what the heck i am talking about. I am not responsible for anything you
may see with my name attached to it, i think.

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
 
Atrax
Guest
Posts: n/a
 
      06-06-2004
ummm... what does this have to do with global.asa? as far as I can see
your objective has nothing to do with it. but maybe if you were more
clear about your explanation it'd help...





________________________________________
Atrax. MVP, IIS
http://rtfm.atrax.co.uk/

newsflash : Atrax.Richedit 1.1 in beta with Mozilla-compatibility.
http://rtfm.atrax.co.uk/infinitemonk...trax.RichEdit/

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      06-06-2004
Woody wrote:
> I have a page that is linked into by other pages that pass it query
> strings, it then reads a config file, displays 1 of several forms,
> gets posted to itself, depending upon users response may display a
> different form etc etc.
>
> I want to take the config data and have that read by a globals.asa and
> then use application("VariableName") to reference it.
>
> i also want to take the initial query strings and load them into
> session variables.
>
> Problem is, whats does a globals.asa file look like? how do i build
> one? how do i make it referenced in my page?
>


Here is the default global.asa page created by Interdev:

************************************************** ****************
<SCRIPT LANGUAGE=VBScript RUNAT=Server>

'You can add special event handlers in this file that will get run
automatically when
'special Active Server Pages events occur. To create these handlers, just
create a
'subroutine with a name from the list below that corresponds to the event
you want to
'use. For example, to create an event handler for Session_OnStart, you would
put the
'following code into this file (without the comments):

'Sub Session_OnStart
'**Put your code here **
'End Sub

'EventName Description
'Session_OnStart Runs the first time a user runs any page in your
application
'Session_OnEnd Runs when a user's session times out or quits your
application
'Application_OnStart Runs once when the first page of your application is
run for the first time by any user
'Application_OnEnd Runs once when the web server shuts down

</SCRIPT>

<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
End Sub
</SCRIPT>
************************************************** *********

The global.asa page is run whenever one of the 4 events mentioned in the
comments section above occurs. You do NOT refer to global.asa in any of your
other pages. You simply use the application and session variables that may
have been created in global.asa.

HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
Lord Merlin
Guest
Posts: n/a
 
      06-06-2004
Doesn't this impose a performace issue? doesn't global.asa get read
everytime, by every script? What happens if you have a lot of arb stuff in
global.asa, which is only used in one script, each one of those items as
needed? Won't this have performance implications on the whole site?

--

Kind Regards
Rudi Ahlers
+27 (82) 926 1689

Greater love has no one than this, that he lay down his life for his friends
(John 15:13).
"Bob Barrows [MVP]" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
Woody wrote:
> I have a page that is linked into by other pages that pass it query
> strings, it then reads a config file, displays 1 of several forms,
> gets posted to itself, depending upon users response may display a
> different form etc etc.
>
> I want to take the config data and have that read by a globals.asa and
> then use application("VariableName") to reference it.
>
> i also want to take the initial query strings and load them into
> session variables.
>
> Problem is, whats does a globals.asa file look like? how do i build
> one? how do i make it referenced in my page?
>


Here is the default global.asa page created by Interdev:

************************************************** ****************
<SCRIPT LANGUAGE=VBScript RUNAT=Server>

'You can add special event handlers in this file that will get run
automatically when
'special Active Server Pages events occur. To create these handlers, just
create a
'subroutine with a name from the list below that corresponds to the event
you want to
'use. For example, to create an event handler for Session_OnStart, you would
put the
'following code into this file (without the comments):

'Sub Session_OnStart
'**Put your code here **
'End Sub

'EventName Description
'Session_OnStart Runs the first time a user runs any page in your
application
'Session_OnEnd Runs when a user's session times out or quits your
application
'Application_OnStart Runs once when the first page of your application is
run for the first time by any user
'Application_OnEnd Runs once when the web server shuts down

</SCRIPT>

<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
End Sub
</SCRIPT>
************************************************** *********

The global.asa page is run whenever one of the 4 events mentioned in the
comments section above occurs. You do NOT refer to global.asa in any of your
other pages. You simply use the application and session variables that may
have been created in global.asa.

HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"




 
Reply With Quote
 
Bob Lehmann
Guest
Posts: n/a
 
      06-06-2004
global.asa is run once upon accessing the first *.asp page in an
application.

Bob Lehmann

"Lord Merlin" <(E-Mail Removed)_SPAM> wrote in message
news:ca0233$dom$(E-Mail Removed)...
> Doesn't this impose a performace issue? doesn't global.asa get read
> everytime, by every script? What happens if you have a lot of arb stuff in
> global.asa, which is only used in one script, each one of those items as
> needed? Won't this have performance implications on the whole site?
>
> --
>
> Kind Regards
> Rudi Ahlers
> +27 (82) 926 1689
>
> Greater love has no one than this, that he lay down his life for his

friends
> (John 15:13).
> "Bob Barrows [MVP]" <(E-Mail Removed)> wrote in message
> news:#(E-Mail Removed)...
> Woody wrote:
> > I have a page that is linked into by other pages that pass it query
> > strings, it then reads a config file, displays 1 of several forms,
> > gets posted to itself, depending upon users response may display a
> > different form etc etc.
> >
> > I want to take the config data and have that read by a globals.asa and
> > then use application("VariableName") to reference it.
> >
> > i also want to take the initial query strings and load them into
> > session variables.
> >
> > Problem is, whats does a globals.asa file look like? how do i build
> > one? how do i make it referenced in my page?
> >

>
> Here is the default global.asa page created by Interdev:
>
> ************************************************** ****************
> <SCRIPT LANGUAGE=VBScript RUNAT=Server>
>
> 'You can add special event handlers in this file that will get run
> automatically when
> 'special Active Server Pages events occur. To create these handlers, just
> create a
> 'subroutine with a name from the list below that corresponds to the event
> you want to
> 'use. For example, to create an event handler for Session_OnStart, you

would
> put the
> 'following code into this file (without the comments):
>
> 'Sub Session_OnStart
> '**Put your code here **
> 'End Sub
>
> 'EventName Description
> 'Session_OnStart Runs the first time a user runs any page in your
> application
> 'Session_OnEnd Runs when a user's session times out or quits your
> application
> 'Application_OnStart Runs once when the first page of your application

is
> run for the first time by any user
> 'Application_OnEnd Runs once when the web server shuts down
>
> </SCRIPT>
>
> <SCRIPT LANGUAGE=VBScript RUNAT=Server>
> Sub Application_OnStart
> End Sub
> </SCRIPT>
> ************************************************** *********
>
> The global.asa page is run whenever one of the 4 events mentioned in the
> comments section above occurs. You do NOT refer to global.asa in any of

your
> other pages. You simply use the application and session variables that may
> have been created in global.asa.
>
> HTH,
> Bob Barrows
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
>
>
>



 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      06-06-2004
Lord Merlin wrote:
> Doesn't this impose a performace issue? doesn't global.asa get read
> everytime, by every script?


No. Global.asa is run only during the events shown in the sample page
comments section. Pages access session variables and application variables.
Your pages do NOT run the code in the global.asa file. The code in the
global.asa file is run by your web server:

a) when the application starts
b) when a session starts
c) when a session ends
d) when the application ends

I don't know how to say it any clearer than that. I suspect you need to do
some reading of the ASP documentation at msdn.microsoft.com. Here's a link:
http://msdn.microsoft.com/library/en...dk/iis/asp.asp

and

http://msdn.microsoft.com/library/en..._web_pages.asp

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
Lord Merlin
Guest
Posts: n/a
 
      06-06-2004
ok, why is it then a bad idea putting your DB connections strings into
global.asa, when not all of your scripts would access the DB? I have found
that if I remove the DB connection strings, and only include them into the
files that access the DB, my site seems to be quicker

--

Kind Regards
Rudi Ahlers
+27 (82) 926 1689

Greater love has no one than this, that he lay down his life for his friends
(John 15:13).
"Bob Barrows [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
Lord Merlin wrote:
> Doesn't this impose a performace issue? doesn't global.asa get read
> everytime, by every script?


No. Global.asa is run only during the events shown in the sample page
comments section. Pages access session variables and application variables.
Your pages do NOT run the code in the global.asa file. The code in the
global.asa file is run by your web server:

a) when the application starts
b) when a session starts
c) when a session ends
d) when the application ends

I don't know how to say it any clearer than that. I suspect you need to do
some reading of the ASP documentation at msdn.microsoft.com. Here's a link:
http://msdn.microsoft.com/library/en...dk/iis/asp.asp

and

http://msdn.microsoft.com/library/en..._web_pages.asp

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"




 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      06-06-2004
Lord Merlin wrote:
> ok, why is it then a bad idea putting your DB connections strings into
> global.asa, when not all of your scripts would access the DB?


It's not. Who told you this??? There is absolutely no performance issue with
storing ANY string, let alone connection strings, in Application or Session.


Maybe you are confusing the advice against storing COM objects in
Application and Session.
COM objects, such as ADO connections, by default, are apartment-threaded,
and should not be stored in Application or Session. They are not designed to
be used by the multiple threads involved in a web server application. Go
back to aspfaq and read about this again:
http://www.aspfaq.com/show.asp?id=2053

The advice is about COM objects, not strings and numeric data.

BTW, it is possible to modify a Registry key on your web server to make the
ADO objects free-threaded instead of apartment-threaded, allowing them to be
safely used in Application or Session. A batch file called makfre15.bat is
usually installed in C:\Program Files\Common Files\System\ADO to automate
making this change. A major caveat is to avoid doing this when using a Jet
database, because Jet is single-threaded. I reiterate: DO NOT DO THIS WHEN
USING ACCESS DATABASES IN YOUR WEB APPLICATIONS.

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
CJM
Guest
Posts: n/a
 
      06-07-2004

"Bob Barrows [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> BTW, it is possible to modify a Registry key on your web server to make

the
> ADO objects free-threaded instead of apartment-threaded, allowing them to

be
> safely used in Application or Session. A batch file called makfre15.bat is
> usually installed in C:\Program Files\Common Files\System\ADO to automate
> making this change. A major caveat is to avoid doing this when using a Jet
> database, because Jet is single-threaded. I reiterate: DO NOT DO THIS WHEN
> USING ACCESS DATABASES IN YOUR WEB APPLICATIONS.
>
> Bob Barrows
>


Bob,

This is news to me. Have you got any pointers to some background reading on
this?

How do this fit in with our existing Good Practice guides? Is it a Good
Thing (tm) or a Bad Thing (tm)?

Not sure if I could change my habits after all this time! lol

Chris


 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      06-07-2004
CJM wrote:
> "Bob Barrows [MVP]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>>
>> BTW, it is possible to modify a Registry key on your web server to
>> make the ADO objects free-threaded instead of apartment-threaded,
>> allowing them to be safely used in Application or Session. A batch
>> file called makfre15.bat is usually installed in C:\Program
>> Files\Common Files\System\ADO to automate making this change. A
>> major caveat is to avoid doing this when using a Jet database,
>> because Jet is single-threaded. I reiterate: DO NOT DO THIS WHEN
>> USING ACCESS DATABASES IN YOUR WEB APPLICATIONS.
>>
>> Bob Barrows
>>

>
> Bob,
>
> This is news to me. Have you got any pointers to some background
> reading on this?


http://www.insightgraphics.com/refer...PStateMgmt.htm

See Tip 4 on this page:
http://msdn.microsoft.com/library/de...ml/asptips.asp

Interestingly enough, this guy:
http://www.vbxml.com/conference/wrox...immy_cache.pdf
says he could not get a disconnected recordset into Application in IIS5 (it
worked as advertised in IIS4). He surmises that IIS5 is a little " ...
stricter about what counts as an agile object."
..
>
> How do this fit in with our existing Good Practice guides? Is it a
> Good Thing (tm) or a Bad Thing (tm)?


I'm not so sure about it being a Good Thing. Maybe for disconnected
recordsets. I can see the benefit of storing one of those in Session. It
does not seem to be a good thing for connections, since it would tend to
defeat connection pooling. Also, if you have any functionality that depends
on discrete database "sessions", then global connections should certainly be
avoided.

>
> Not sure if I could change my habits after all this time! lol
>

Same here. But the main reason for me is that some of our web applications
are using Jet databases.

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
IIS 6 vs IIS 5 ASP.NET Performance Issues JMaelstrom ASP .Net 2 04-30-2010 04:32 PM
Performance issues with ASP.NET web application - Slow response Ram ASP .Net 6 11-13-2007 01:35 AM
ASP.Net Validators and performance issues =?Utf-8?B?U3VoYXMgVmVuZ2lsYXQ=?= ASP .Net 5 07-27-2006 05:58 PM
ASP Processing - Performance Issues JP SIngh ASP General 3 07-30-2005 07:01 PM
Performance Issues / ASP.NET smoody ASP .Net 4 02-20-2004 09:13 PM



Advertisments