By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,784 Members | 1,248 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,784 IT Pros & Developers. It's quick & easy.

ASP performance issues

P: n/a
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!
Jul 19 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
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!
Jul 19 '05 #2

P: n/a
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"
Jul 19 '05 #3

P: n/a
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]" <re******@NOyahoo.SPAMcom> wrote in message
news:#g**************@TK2MSFTNGP11.phx.gbl...
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"


Jul 19 '05 #4

P: n/a
global.asa is run once upon accessing the first *.asp page in an
application.

Bob Lehmann

"Lord Merlin" <SP*************@Bonzai.org.za_SPAM> wrote in message
news:ca**********@ctb-nnrp2.saix.net...
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]" <re******@NOyahoo.SPAMcom> wrote in message
news:#g**************@TK2MSFTNGP11.phx.gbl...
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"

Jul 19 '05 #5

P: n/a
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"
Jul 19 '05 #6

P: n/a
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]" <re******@NOyahoo.SPAMcom> wrote in message
news:u9**************@TK2MSFTNGP09.phx.gbl...
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"


Jul 19 '05 #7

P: n/a
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"
Jul 19 '05 #8

P: n/a
CJM

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:OO**************@tk2msftngp13.phx.gbl...

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
Jul 19 '05 #9

P: n/a
CJM wrote:
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:OO**************@tk2msftngp13.phx.gbl...

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.
Jul 19 '05 #10

P: n/a
CJM

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:uw**************@TK2MSFTNGP10.phx.gbl...
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."

It does say that under IIS5, it must be free-threadind AND must aggregate
the free-threading marshaller. Still double-dutch to me(!) but nevertheless
it shows that IIS is a bit more fussy.

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.


Connection Pooling: Agreed

Disconnected RS: It mentions that it is safe to cache disconnected rs's in
Item 5, so I suspect this isnt to do with Item 4.

Interesting: Scripting.Dictionary is non-agile, but there is a (free) 3rd
Party that is and therefore can be cached. Might be useful...

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.


Same here sometimes...
Anyway, thanks for this...

Chris
Jul 19 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.