ASP performance issues

Discussion in 'ASP General' started by Woody, Jun 5, 2004.

  1. Woody

    Woody Guest

    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!
    Woody, Jun 5, 2004
    #1
    1. Advertising

  2. Woody

    Atrax Guest

    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/infinitemonkeys/components/Atrax.RichEdit/

    *** Sent via Devdex http://www.devdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Atrax, Jun 6, 2004
    #2
    1. Advertising

  3. 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"
    Bob Barrows [MVP], Jun 6, 2004
    #3
  4. Woody

    Lord Merlin Guest

    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]" <> wrote in message
    news:#...
    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"
    Lord Merlin, Jun 6, 2004
    #4
  5. Woody

    Bob Lehmann Guest

    global.asa is run once upon accessing the first *.asp page in an
    application.

    Bob Lehmann

    "Lord Merlin" <_SPAM> wrote in message
    news:ca0233$dom$...
    > 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]" <> wrote in message
    > news:#...
    > 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"
    >
    >
    >
    >
    Bob Lehmann, Jun 6, 2004
    #5
  6. 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-us/iissdk/iis/asp.asp

    and

    http://msdn.microsoft.com/library/en-us/iissdk/iis/iis_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"
    Bob Barrows [MVP], Jun 6, 2004
    #6
  7. Woody

    Lord Merlin Guest

    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]" <> wrote in message
    news:...
    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-us/iissdk/iis/asp.asp

    and

    http://msdn.microsoft.com/library/en-us/iissdk/iis/iis_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"
    Lord Merlin, Jun 6, 2004
    #7
  8. 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"
    Bob Barrows [MVP], Jun 6, 2004
    #8
  9. Woody

    CJM Guest

    "Bob Barrows [MVP]" <> wrote in message
    news:...
    >
    > 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
    CJM, Jun 7, 2004
    #9
  10. CJM wrote:
    > "Bob Barrows [MVP]" <> wrote in message
    > news:...
    >>
    >> 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/reference/ASPStateMgmt.htm

    See Tip 4 on this page:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnasp/html/asptips.asp

    Interestingly enough, this guy:
    http://www.vbxml.com/conference/wrox/2000_vegas/text/jimmy_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.
    Bob Barrows [MVP], Jun 7, 2004
    #10
  11. Woody

    CJM Guest

    "Bob Barrows [MVP]" <> wrote in message
    news:...
    > Interestingly enough, this guy:
    > http://www.vbxml.com/conference/wrox/2000_vegas/text/jimmy_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
    CJM, Jun 7, 2004
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JMaelstrom

    IIS 6 vs IIS 5 ASP.NET Performance Issues

    JMaelstrom, Dec 9, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    4,651
    shan420
    Apr 30, 2010
  2. smoody

    Performance Issues / ASP.NET

    smoody, Feb 20, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    545
    Kevin Spencer
    Feb 20, 2004
  3. Ram
    Replies:
    6
    Views:
    7,613
    codezilla94
    Nov 13, 2007
  4. =?Utf-8?B?U3VoYXMgVmVuZ2lsYXQ=?=

    ASP.Net Validators and performance issues

    =?Utf-8?B?U3VoYXMgVmVuZ2lsYXQ=?=, Jul 24, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    696
    Roland
    Jul 27, 2006
  5. JP SIngh

    ASP Processing - Performance Issues

    JP SIngh, Jul 29, 2005, in forum: ASP General
    Replies:
    3
    Views:
    145
    Bob Barrows [MVP]
    Jul 30, 2005
Loading...

Share This Page