oracle765 Posted June 19, 2015 Share Posted June 19, 2015 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 Quote Link to comment https://forums.phpfreaks.com/topic/296919-bottleneck-somewhere-not-sure-if-php-is-causing-it/ Share on other sites More sharing options...
QuickOldCar Posted June 19, 2015 Share Posted June 19, 2015 Check your apache access logs for excessive traffic, maybe is bots or spammers. deny them in htaccess Quote Link to comment https://forums.phpfreaks.com/topic/296919-bottleneck-somewhere-not-sure-if-php-is-causing-it/#findComment-1514360 Share on other sites More sharing options...
mac_gyver Posted June 19, 2015 Share Posted June 19, 2015 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. Quote Link to comment https://forums.phpfreaks.com/topic/296919-bottleneck-somewhere-not-sure-if-php-is-causing-it/#findComment-1514368 Share on other sites More sharing options...
mac_gyver Posted June 19, 2015 Share Posted June 19, 2015 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. Quote Link to comment https://forums.phpfreaks.com/topic/296919-bottleneck-somewhere-not-sure-if-php-is-causing-it/#findComment-1514372 Share on other sites More sharing options...
oracle765 Posted June 19, 2015 Author Share Posted June 19, 2015 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 Quote Link to comment https://forums.phpfreaks.com/topic/296919-bottleneck-somewhere-not-sure-if-php-is-causing-it/#findComment-1514400 Share on other sites More sharing options...
fastsol Posted June 20, 2015 Share Posted June 20, 2015 You use the microtime() in php at the top of the page and then again at the bottom and minus the 2 to find the difference. Check this out https://www.youtube.com/watch?v=9jgWVTl98DM Quote Link to comment https://forums.phpfreaks.com/topic/296919-bottleneck-somewhere-not-sure-if-php-is-causing-it/#findComment-1514401 Share on other sites More sharing options...
mac_gyver Posted June 20, 2015 Share Posted June 20, 2015 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. Quote Link to comment https://forums.phpfreaks.com/topic/296919-bottleneck-somewhere-not-sure-if-php-is-causing-it/#findComment-1514402 Share on other sites More sharing options...
oracle765 Posted June 20, 2015 Author Share Posted June 20, 2015 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 Quote Link to comment https://forums.phpfreaks.com/topic/296919-bottleneck-somewhere-not-sure-if-php-is-causing-it/#findComment-1514406 Share on other sites More sharing options...
QuickOldCar Posted June 20, 2015 Share Posted June 20, 2015 The first place I would look is the response times coming from the 3rd party api at https://viatorapi.viator.com Quote Link to comment https://forums.phpfreaks.com/topic/296919-bottleneck-somewhere-not-sure-if-php-is-causing-it/#findComment-1514425 Share on other sites More sharing options...
oracle765 Posted June 22, 2015 Author Share Posted June 22, 2015 ok I will look into that Quote Link to comment https://forums.phpfreaks.com/topic/296919-bottleneck-somewhere-not-sure-if-php-is-causing-it/#findComment-1514540 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.