468,505 Members | 1,696 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,505 developers. It's quick & easy.

server response slowing down

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
happen.

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!?).

Thanks,
Chris.


Aug 2 '06 #1
7 1400
Chris Thompson wrote:
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 happen.

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!?).

Thanks,
Chris.
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)?

Regards,
Erwin Moller
Aug 2 '06 #2
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,
Chris.

"Erwin Moller"
<si******************************************@spam yourself.comwrote in
message news:44**********************@news.xs4all.nl...
Chris Thompson wrote:
>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 happen.

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!?).

Thanks,
Chris.

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)?

Regards,
Erwin Moller

Aug 2 '06 #3
Chris Thompson wrote:
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...
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
questions.
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
up.
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.

Regards,
Erwin Moller
>
Cheers anyway,
Chris.

"Erwin Moller"
<si******************************************@spam yourself.comwrote in
message news:44**********************@news.xs4all.nl...
>Chris Thompson wrote:
>>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 happen.

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!?).

Thanks,
Chris.

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)?

Regards,
Erwin Moller
Aug 2 '06 #4
On Wed, 2 Aug 2006 12:17:47 +0100, "Chris Thompson"
<c.********@zen.co.ukwrote:
>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.
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: <http://www.bizorg.co.uk/news.html>
Great gifts: <http://www.ThisBritain.com/ASOS_popup.html>
Aug 3 '06 #5
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
posted.

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.

Regards,
Chris.
"David Quinton" <us****************@REMOVETHISBITbizorg.co.ukwro te in
message news:aj********************************@4ax.com...
On Wed, 2 Aug 2006 12:17:47 +0100, "Chris Thompson"
<c.********@zen.co.ukwrote:
>>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.

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: <http://www.bizorg.co.uk/news.html>
Great gifts: <http://www.ThisBritain.com/ASOS_popup.html>

Aug 3 '06 #6
"Chris Thompson" <c.********@zen.co.ukwrote:
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
posted.
magic_quotes is an abomination and a curse.

miguel
--
Photos from 40 countries on 5 continents: http://travel.u.nu
Latest photos: Malaysia; Thailand; Singapore; Spain; Morocco
Airports of the world: http://airport.u.nu
Aug 3 '06 #7
On Thu, 3 Aug 2006 14:42:59 +0100, "Chris Thompson"
<c.********@zen.co.ukwrote:
>Hi David,

Thanks for your reply... Although it wasn't the problem, it did get my
brain going in the right direction, so thankyou...
Excellent news!
It's always useful to get someone else to look at a prblem "from the
outside" IMO.
<G>
--
Locate your Mobile phone: <http://www.bizorg.co.uk/news.html>
Great gifts: <http://www.ThisBritain.com/ASOS_popup.html>
Aug 4 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by TheKeith | last post: by
3 posts views Thread by Dan Stromberg | last post: by
7 posts views Thread by =?Utf-8?B?RWRkaWU=?= | last post: by
46 posts views Thread by RAZZ | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.