server response slowing down

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi All,

I have a private website created using HTML/PHP.  Within this site, there is  
a page that has a form (question.php), which is populated depending on the  
question number that has been posted to it.

When the form is submitted, the data is posted back to the same page  
(question.php), and the code within the page saves the posted data, and  
displays the next question, and so it goes on...

While the page loads almost instantly for the first 15 or so questions, the  
server response gets gradually slower, to the point where the page takes  
about 30 secs to start loading after about 18 questions.

I'm trying to understand what may be causing the lag...  It doesn't seem to  
be the loading of the page that's taking the time, it's the response time  
from the server before the page starts loading that seems to increase.

The page does use MySQL tables, but all are well indexed, and as I say, you  
can load the page about 15 times, before any noticeable delay starts to  

Anyone any ideas please?

(I've put the complete site on 2 different servers - 1 on a shared hosting  
account, and 1 on completely different managed server, and the same thing  
happens on both servers!?).



Re: server response slowing down

Chris Thompson wrote:

Quoted text here. Click to load it

Hi Chris,

That indicates that your script has a higher workload the higher the  
questionnumber is.
That could indicate that the script is doing more work for question number  
20 than for question number 1.

Do you only perform the quesries needed?
Are you maybe 'counting' by doing subsequent databasequeries untill you  
pulled the 'right' question from the table(s)?

Erwin Moller

Re: server response slowing down

Hi Erwin,

Thanks for this, but if I start at question 20, and navigate backwards to  
question 1, it still starts to slow down at question 5, so doesn't seem to  
be the answer...

Cheers anyway,

"Erwin Moller"  
Quoted text here. Click to load it

Re: server response slowing down

Chris Thompson wrote:

Quoted text here. Click to load it

If that is true depends on the (mistakes in) underlying code.

I think nobody can answer this question without more information/code.

I expect your code is somehow doing more and more work as it handles more  
Why else show question 5 the first time be quick, and after 15 subsequent  
question become slow?
It sounds like all old given answers are somehow reinserted each time or all  
questions are re-queried, or something like that.

Show us some relevant code or describe in detail how your application is set  
I cannot think of any valid reason why the database or your script gets slow  
if you design the application in a normal way. Must be some mistake  
somewhere in the logic.

Erwin Moller

Quoted text here. Click to load it

Re: server response slowing down

On Wed, 2 Aug 2006 12:17:47 +0100, "Chris Thompson"

Quoted text here. Click to load it

Is the page writing each set of responses to MySQL every time, or is
it mererly appending them to the form as a load of hidden form fields
- ready to be written when all questions have been answered?

Locate your Mobile phone: <
Great gifts: <

Re: server response slowing down

Hi David,

Thanks for your reply...  Although it wasn't the problem, it did get my  
brain going in the right direction, so thankyou...

The problem was that I was passing a hidden field from question to question,  
which had an apostrophe in it.

I was populating the hidden field with the posted version of itself on each  
load of the page, without using the 'stripslashes' command, so PHP was  
adding more and more slashes to the hidden field, every time the page was  

I realised the problem, when I did a 'view source' of the page, and saw  
pages and pages of \\\\\\\

Obviously, the amount of slashes was doubling every time, and making the  
HTML code being sent back to the client huge, and slowing the load down.

All sorted now.

Thanks to Erwin to, for his reply.


Quoted text here. Click to load it

Re: server response slowing down

Quoted text here. Click to load it

magic_quotes is an abomination and a curse.

Photos from 40 countries on 5 continents:
Latest photos: Malaysia; Thailand; Singapore; Spain; Morocco
Airports of the world:

Re: server response slowing down

Kimmo Laine wrote:
Quoted text here. Click to load it

Unless next_page.php generates PHP, the script with this include will
only get HTML.

Quoted text here. Click to load it


    if (isset($_GET['foo'])) {
      echo '<?php echo $_GET[\'foo\']; ?>';
    } else {
      echo '<?php echo \'Not available\'; ?>';

File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot

Site Timeline