View Full Version : max no of users

03-03-2007, 07:22 PM
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

03-03-2007, 07:56 PM
Use the global file to get the users count:

Sub Application_OnStart
Application("Users") = 0
End Sub
Sub Session_OnStart
Application("Users") = Application("Users") + 1
End Sub
Sub Session_OnEnd
Application("Users") = Application("Users") - 1
End Sub

Then in your asp page:

If Application("Users") => 800 Then
Response.Write "Sorry, the server is currently busy handling other requests. Please refresh or try again later."
End If

03-06-2007, 07:12 PM
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

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>"