Jump to content


This topic is now archived and is closed to further replies.


Performance error

Recommended Posts

Hi guys, I'm considered as a new comer with PHP. [b]So please read on, I know it's a little bit wordy for my problem but I have no expertise in this area at all you are my only hope[/b]. Therefore, I'm here seeking for help.
For my first project. I was instructed to create an Online-Examination site. The site should allows a group of people  (employees in the company. About 500 users on average per test, we have total of 1300 employees) to take the test online at the [b]same time[/b], report the result after test finnished, report the summary report to  the manager of training center.Since there are very bad environment in some place therefore network disconnecting or out of electricity is expected every moment. The Site should support user to re-login and continue the test once he/she got disconnected from the network or her office goes out of electricity. The requirement also include creating a back-end (admin section) to manage users, tests, questions, reports.
  [b]Now the problem comes: [/b] The rest of the modules was ok but there is 1 module which created a lot of problem.That is the module to display the test questions, storing the result, and calculate the time-Left for a candidate.

[b]System description:[/b]
When user login to the system, the server will verify which test was assigned to the user (1 user can't do more then 1 test at a time).
The server will then generate a list of random questions taken from the Question table which belong to the test verified above.
Those questions are save into a temp table together with the column time-left (time-left is an integer which indicates the second left for the user to continue test).
After done those job, user will be directed to a page where the first questions will be display, this page also contain a Java Script timer.
The JS timer take the parameter is the data on time-left column on table temp, JS timer will count down from this number and display to the screen as the time format (e.g. You have  [i]hh:mm:ss[/i] left to finnish this test). If the parameter is 0 or less than 0, the JS timer will activate a function to submit the form and print a message to inform user that no more time left.
[u]THere are 2 submit buttons on the this page[/u]
[i]when finnished one question, user will click on  the button (named: Next)[/i]. This will submit the form to itself (e.g. the page is taketest.php so the action of the form will be <action = "taketest.php">). The page receive the result then update the temp table with first question is done, time interval of first question. The server will get the last time-left minus the time-interval then store the new time-left back to temp table.
[i]when finnished the entire test, user will click on the button (named: Finnish).[/i] This will submit the form to the same page as above, it will display the result report, update temp table, result table in the database.

The above are how the test work. Next question is just a recursive work until the last question. The site works fine with 1-4 users concurrently taking test. However, [b]when I raise the number of users taking test to more the 5 users[/b] then I got [b]2 errors:[/b]
1. Fatal Error: Timeout.
2. The timer return a negative value right from the beginning of the test (e.g. Time to do test is 60 Mins, after 2 mins JS timer return value x and is sent to server, after the calculation it stored the nagative value x1 to time-left column on table temp)
I used PHP 4.3, MS SQL server Enterprise Edition 2000, server IBM Xseries 206 1 CPU 3.4 GHz 2GB RAM, Windows server 2003, Apache 1.3 and IIS 5.1 was tested with the site. Users have various connection speed however the lowest bandwidth is 1Mbps (leased line). 
[b]The question is:[/b]
1. Is this problem caused from the databse, the Web server or any other cause like network traffic?
2. What should I do to test and find out the problem if the question 1 was not answer?
3. Is there any other solution for this problem to eliminate the problem?
Thanks for you time to read this
Plsss...... help me. I'm totally lost in this problem

Share this post

Link to post
Share on other sites
The database is the first place I would look, (5) users taking the test should do nothing to the server. It's most likely a indexing problem. Believe when I tell you, a database not setup to use the proper indexing can slow the server down to a crawl. I'm not saying that is the case, but it sounds like it could be contributing to the problem. There is no way to know for sure, without seeing all the scripts, and the database scheme!


Share this post

Link to post
Share on other sites
if you wanted to see if it was the databases fault you could do something like ($query being the most complicated query that performed):

$time = time();
$time2 = time() + 60;
$i = 0;
while(time() < $time2) {
Echo "{$i} queries in 60 seconds.  About {$i/60} queries a second.";

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.