Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: max no of users

  1. #1
    New Coder
    Join Date
    Feb 2007
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation max no of users

    is there any limit for the no of the users accessing my ASP Page simlutanously , am using windows 2000 server ,
    and whether my system will be slow or it will make some problem if around 400 to 800 users are accessing an ASP page (ASp page contains Personal information form to be filled by the users).

    and during making connection to the database how i can ensure that my connection is closed , if am in need to use this connection in multiple location in my page , shall i close this connection at the end of my page

    am using Pentium 4 (3000 mhz)
    1 gb ram
    windows 2000 server


    for the database am using oracle 8i

  • #2
    Senior Coder BarrMan's Avatar
    Join Date
    Feb 2005
    Location
    Israel.
    Posts
    1,644
    Thanks
    69
    Thanked 83 Times in 82 Posts
    Use the global file to get the users count:
    Global.asa
    Code:
    Sub Application_OnStart
    Application("Users") = 0
    End Sub
    Sub Session_OnStart
    Application.Lock
    Application("Users") = Application("Users") + 1
    Application.UnLock
    End Sub
    Sub Session_OnEnd
    Application.Lock
    Application("Users") = Application("Users") - 1
    Application.UnLock
    End Sub
    Then in your asp page:
    Code:
    If Application("Users") => 800 Then
    Response.Write "Sorry, the server is currently busy handling other requests. Please refresh or try again later."
    Response.End
    End If
    Last edited by BarrMan; 03-03-2007 at 07:58 PM.

  • #3
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,072
    Thanks
    4
    Thanked 8 Times in 8 Posts
    Classic asp is poor at garbage collection so yes ALWAYS close your objects and set them to nothing when done using them!!! Otherwise they will stay in scope as long as that session is in scope. This is not a problem if a small number of users are visiting the site, but a huge problem when there are many users. This is not to say that you cannot use the same object over again multiple times. You can and should as it is more efficient than destroying the object and then making a new one each time. for example if you are querying 3 tables to populate a recordest you can close the recordset object after use and reuse it for each query. Also if you are using the connection object then you can use the same connection object for the entire page(as long as you are only connecting to one database, note I said database and not table).

    Try to seperate your data tier as much as possible from the web tier. If using MS Access this isnt as easy to do as it is in MySQL or MS SQL Server

    Then there is the problem that MS Access limits the number of concurrent connections. Not a problem most of the time but can be a problem if hundreds of users are on at a single time. (a concurrent connection is the same millisecond that the database is being accessed by another user. Rememebr that the connection only exists as long as the SQL Query takes to run. after that it is disconnected.) If you have a large number of users and want to speed up your database querys use GetRows as much as possible. This also helps to limit the number of times you need to query the data because you can reuse that same array as many times as you want to use it on the same page.

    ALSO do not use the * in your SQL query's unless you really want to grab all fields. Spell out the fields you want to grab in your query as that will run faster and keep the connection open a shorter amount of time.

    If you want to know how long a page takes to execute you can use this code
    Code:
    Dim StartTime
    Dim RunTime
    Dim EndTime
    'place at the beginning of the asp code
    StartTime = Timer()
    
    
    'place your asp code here
    
    'placed at the end of all of your asp code
    EndTime = Timer()
    RunTime = EndTime - StartTime
    Response.Write "<h3>This script took " & RunTime & " seconds to execute.</h3>"


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •