Wrox Programmer Forums
|
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 7th, 2013, 10:58 AM
Registered User
 
Join Date: Dec 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Angry Many users at the same time

Hello Experts
I am a teacher and I am very desparate because I wrote some educational games (wissensspiele.eu) using classic ASP on IIS2008 & SQL Server 2008. The games are used very frequently with many users at the same moment and I get many error mails every day. I stored the input of the users in session vars. And I send an email with all data to me. When I try the games with the same data I never get an error.
So I guess that I have to program another way for applications with many users in the same time.
I would be very happy to get some hints!
Greetings from Austria
Uwe
 
Old December 8th, 2013, 04:51 AM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Hi Uwe. I can not tell what your issue is im sorry. Im not sure anybody can witht he very brief description to be honest. To get help on specific issues ideally you will need to post errors and the offending code....A couple of questions come to mind:
> What does your error mail say?
> You store all of the users input in session variables. FYI this is not efficient. ideally these should be stored in a database and carried from page to page using the request object
> 'When I try the games with the same data I never get an error' We would need to see the data....
__________________
Wind is your friend
Matt
 
Old December 8th, 2013, 04:49 PM
Registered User
 
Join Date: Dec 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Hints for developing webapps for many users at once

Thank you for your quick answer.
Yes I save all user data in the SQL Server. But my program does not reach this point and therefore I stored the user input in sessionvars to find the reason of the errors. But when I enter the same data I never get an error. So I persume that it happens only when many users are using my programs at the same second and I was asking for hints for developing ASP apps for multiuser.

The errors are different. This is only 1 example:
Error message:
Error Number: -2146828279
Error File: /bingo.asp
Line Number: 242
Index außerhalb des gültigen Bereichs: '[number: -1]' (index outside the range)
Querystring: thema=11+%2F+26&thema1=0&level=3&grad=1&checkbox1= 1&Spieler=&SpielNr=0

The relevant code:
Code:
ok = 0
  do while ok < level*level
  Dummyzahl = Int(Rnd - 89098)
  Randomize
	rec = Int((x) *Rnd + 1)										if fertig(rec-1) = 0 then			// this is line 242
			ok = ok +1
			fragen(ok,1)=alle(rec-1)
			fragen(ok,2)=typen(rec-1)
			fragen(ok,3)=0
			fragen(ok,4)=rec
			fertig(rec-1)=1
		end if
  loop
When I enter the same data I never get an error and the variable x is always 32.
So I suspect, that the variables are jumbled when many users access at the same moment.
I am desparate because when I test my programs everything works fine. But now many users are playing my games and I get a lot of error mails every day and I do not know what to do. I learned ASP 12 years ago by myself and maybe I never learned programming for many users....

Please apologisze my bad English. Thanks for your help!
Greetings from Austria
Uwe
 
Old December 8th, 2013, 08:42 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

mmmm I have never seen a error/post not in English. This makes things difficult. What I can tell from this:

'[number: -1]' (index outside the range)

is that it is almost definatley the 'subscript out of range' issue. If you research this you will find it simply referring to an element of the array that does not exist. So the 'rec-1' in this part of the code is your issue:

if fertig(rec-1) = 0 then

So this code:

rec = Int((x) *Rnd + 1)

is where your issue is. rec is equal to a number which does not exist in your fertig array. Hope that helps.

IMO this has nothing to do with many users at all
__________________
Wind is your friend
Matt
 
Old December 9th, 2013, 01:37 PM
Registered User
 
Join Date: Dec 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASP many users

Thank you Matt,

I know what the error means. But my problem is that I test the programm with the same input data and no error occurs. The variable x is always 32 and "rec" can not be -1.
The only difference is that the error occurs when many users use the game at the same moment.
So I thought that I have to know something more developing Webapps for many users. There are maybe more than 200 in the same moment when the teachers say "start the game...".

Greetings from Austria
Uwe
 
Old December 9th, 2013, 05:26 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Uwe - Perhaps you don't 100% understand the error. The -1 in the error does not mean rec is equal to -1. Ignore the -1 as a value, this is not an indication of any real value for anything. Simply, the error is telling you that you are referring to an index which does not exist in your array.

You need to find out what the value of rec is when this errors. Can you send this to your email? The error is indicating this number is out of range.

What do you minus 1 from rec here?

if fertig(rec-1) = 0 then

What if the random number is at the lowest point in your range? You will get subscript out of range in this scenario.




I have not used Rnd for a while. After looking up some info it looks like you are not defining the range that the result need to fall within. It also talks about call Randomize. See borrowed information below:


Before calling Rnd, use the Randomize statement without an argument to initialize the random-number generator with a seed based on the system timer. To produce random integers in a given range, use this formula:

Int((upperbound - lowerbound + 1) * Rnd + lowerbound)

Here, upperbound is the highest number in the range, and lowerbound is the lowest number in the range.

Note To repeat sequences of random numbers, call Rnd with a negative argument immediately before using Randomize with a numeric argument. Using Randomize with the same value for number does not repeat the previous sequence.

Ok im back...In my experience a few hundred users is not all that many. I dont do anything special to cater for many more than this. Any well written application will handle this easy. IMO the number of users is irrelevant providing the application is well written
__________________
Wind is your friend
Matt

Last edited by mat41; December 9th, 2013 at 05:31 PM..





Similar Threads
Thread Thread Starter Forum Replies Last Post
Loading Chapter 3 project takes a long time to load first time!! 999csharp BOOK: Beginning ASP.NET Web Pages with WebMatrix 2 April 6th, 2013 09:07 AM
Time Shift time in minus time out lechalas Beginning VB 6 1 August 11th, 2008 01:56 PM
Access 2000 "Time Out Users" cjdphlx Access VBA 3 July 19th, 2005 11:22 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.