Jump to content

Bottleneck somewhere not sure if php is causing it


oracle765

Recommended Posts

LOG File

[19-Jun-2015 14:00:21 UTC] PHP Notice:  Undefined index: HTTP_ACCEPT_ENCODING in /home/oracle765/public_html/index.php on line 2

I have never noticed this code before but the index file has not been updated as far as I am aware




 if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); 

Hi professional

 

We have a bottleneck somewhere and our website has just started running really really slow, not sure what could be causing the problem

 

We have it written in PHP, it has been running for over 6 months now on new technology but still cannot find out where to look properly

 

 

here some of the scenarios which we have alleviated which we thought may be causing the problem

 

1:  We had a cron job loading some data into a database on a nightly basis, we thought the table might be to big so we stopped this and purged the data.

 

2:  We also had on the same host (shared IP) a wordpress site which we thought may be causing problems, so we have now migrated this and hosted elasewhere

 

3:  We have worked on page speed for last 6 months and google still shows our website is really fast

 

4:  We have contacted godaddy and they said the IO is just about maxed out, but they told us to check our website

 

5:  We have checked all our website and still I cannot find the problem

 

What I have found in the error_log is attached (but I don't think that's causing issues, not sure

 

our site is compareandchoose.com.au which does load, but when you click through the pages it takes a while, especially the adventure_activities link which sometimes fails to load

 

I am so confused, thanks in advance

 

Alan

Link to comment
Share on other sites

you need to determine the page generation time, by taking the microtime(true) value at the start of the code on a page and again at the end of the code on the page, and calculate the difference. this will tell you if the problem is with the generation of the page or elsewhere, such as in the web server taking a long time to actually invoke php after the http request was received.

 

if it turns out the problem is in the page generation, you need to calculate the time taken at different points in the code, around database activity, around calls to external api's, ... to narrow down where the time is being consumed.

Link to comment
Share on other sites

i just checked the http://www.compareandchoose.com.au/adventure_activities page at both http://developers.google.com/speed/pagespeed/insights/ and http://tools.pingdom.com/fpt/ and the large amount of time taken, ~2 seconds, is waiting for the response back from your server, rather than things the browser must do to render the the page.

 

the amount of time is fairly consistent, over about a 5 minute period i checked. you will need to profile what the code is doing in order pin down where it is spending this amount of time.

Link to comment
Share on other sites

hi quickoldcar and mac_giver fr some carzy reason it seems to be running a bit quicker today although its still not right

 

How do I determine to record tracing the micro timing on the page, is there php functions for this?

 

FYI

 

Here is the adventure_activities page it is calling which includes api.php,  functins.js and the actual adventure_page_banner.php

 

I did not write these and I cannot see if there is anything potentially causing a problem... Also within functions.js it looks like it calls some ajax to load the Cities, do you think that would be a good starting point?

 

 

Thanks again for your prompt responses

ajax_statelist.php

adventure_page_banner.php

api.php

functions.js.txt

adventure_activities.php

Link to comment
Share on other sites

do you think that would be a good starting point?

 

 

no. you have to find what''s causing the problem, before you can fix it. the javascript would apply to the client-side rendering time, which isn't much, compared to the time waiting for the server to send the response.

Link to comment
Share on other sites

Start Time

1434768642.0989 

End Time
1.6194911003113 

This is the code I have used on the video

At top of page
echo $start_time = microtime(true);

At bottom of page
echo (microtime(true) - $start_time);

ok seems to be running ok sometimes but it shows the following which I don't really understand what it means in for instance seconds

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.