server response slowing down

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chris Thompson

    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.






  • Erwin Moller

    #2
    Re: server response slowing down

    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

    Comment

    • Chris Thompson

      #3
      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,
      Chris.



      "Erwin Moller"
      <since_humans_r ead_this_I_am_s pammed_too_much @spamyourself.c omwrote in
      message news:44d08c5e$0 $4525$e4fe514c@ 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

      Comment

      • Erwin Moller

        #4
        Re: server response slowing down

        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"
        <since_humans_r ead_this_I_am_s pammed_too_much @spamyourself.c omwrote in
        message news:44d08c5e$0 $4525$e4fe514c@ 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
        >questionnumb er 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

        Comment

        • David Quinton

          #5
          Re: server response slowing down

          On Wed, 2 Aug 2006 12:17:47 +0100, "Chris Thompson"
          <c.thompson@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.u k/news.html>
          Great gifts: <http://www.ThisBritain .com/ASOS_popup.html >

          Comment

          • Chris Thompson

            #6
            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
            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" <usenet_2005D_e mail@REMOVETHIS BITbizorg.co.uk wrote in
            message news:aj83d21jrd s09un0lls25h5cg n0kme89cp@4ax.c om...
            On Wed, 2 Aug 2006 12:17:47 +0100, "Chris Thompson"
            <c.thompson@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.u k/news.html>
            Great gifts: <http://www.ThisBritain .com/ASOS_popup.html >

            Comment

            • Miguel Cruz

              #7
              Re: server response slowing down

              "Chris Thompson" <c.thompson@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

              Comment

              • David Quinton

                #8
                Re: server response slowing down

                On Thu, 3 Aug 2006 14:42:59 +0100, "Chris Thompson"
                <c.thompson@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.u k/news.html>
                Great gifts: <http://www.ThisBritain .com/ASOS_popup.html >

                Comment

                Working...