Cakephp slow-done on ovh - php

I observed a strange behavior when I deployed my CakePhp website on my ovh server (mutualized):
Response time seem to be ok (I have the webpage I asked for in less than a minute), but the browser seems to load again something.
Looking with the firefox web developer tools I see this is the html page reception that took every time exactly 5 seconds. The strange thing is that I can see all the content of my webpage during those 5 seconds.
The html page I've tested is 4ko. If I try to do a hard refresh (by ignoring firefox cache), all the images, css, js, fonts ... are loaded before the html page has been received.
I don't have this problem when I run the website on my computer, and I think its CakePhp related because I can access a html test page without this problem.
It doesn't seem to be linked to a specific layout / page : every page and layout I tried cause the same effects.
An other interesting point : I have tested some pages with pingdom and the 5 seconds reception time doesn't appear.
Does anyone experienced a similar issue ?

The problem was related to PHP-FPM optimization activated by default in OVH mutualized servers since 2014. I don't know why the problem appeared in my browser and not with pingdom, I will investigate further and edit if I have more informations.
To desactivate PHP-FPM you have to upload a .ovhconfig file at the root of your server with the following content :
app.engine=phpcgi
app.engine.version=AUTO
I will try to use both CakePhp and PHP-FPM and edit if I have a solution.

Related

iOS apparently permanently caching web pages

I changed my website at the beginning of March to use php instead of shtml. I put server-side redirects in place, and my analytics showed almost everyone picking up the php versions within a couple of days. The only devices that went on and on showing as .shtml were all iOS, but even that seemed to stop after a week or so. However, I have just now seen a .shtml usage come up on an iOS 10.3.3 tablet running Safari 10.0. How can this be happening? Surely no browser is going to cache a page for over 40 days? There were no special cache settings on the old shtml pages.
Any ideas gratefully received.
Thanks
Mandy
From the comments:
iOS seems to keep tabs open indefinitely now, and just suspends the page as if it were an app. It's possible that the person with the tablet just hasn't visited your page in a couple months, discovered the tab while scrolling through them, and re-opened it. The browser MIGHT try to do a reload, but if it doesn't, they may have just tried to navigate inside a stale version of your app

'waiting time' for a drupal page taken is more thats why the drupal page is slow

'waiting time' for a drupal page taken is more thats why the drupal page is slow
There is one page in my drupal site, which loads in 23sec this is too much and the page is of 1.8MB.
Upon checking why its slow, it seems the 'waiting' time taken is large like 19 secs.
Checked this with 'NET' firebug plugin.
Also i checked disabling custom modules and checking queries execution time.
Thing to note is its 'https://' page.
Can it be a server problem?
Tried boost module but it doesn't cache https:// pages.
Thanks!
First thing I would do is switch the sites theme to the standard drupal theme, it will break bits of your site momentarily but it will give you an indication if the issue is in the site current theme.
Then would use console in chrome to see some hints. Mainly look at the network tab and compare it with regular pages. It could also be a JS function timing out or taking forever.
Finally if you think it's your server then I would install a program called htop. this will monitor your servers performance. Also try setting the site up locally to recreate the error.
Are there any over complex views on the page? If so, try disabling these to find the culprit.

Why are my php pages loading so slowly?

This has been frustrating me for a while now. I started developing a site for a friend using ajax to load content, but whenever the image galleries are loaded it takes soooo long. The annoying thing is that it wasn't like that when i tested it on my own server.
The test site is here: http://www.europeanbob.co.uk/phil/index.html
And the actual site is here: http://www.philmarsdenphotography.co.uk
The test is hosted on dreamhost and the actual one on krystal if that makes any difference?
You are doing some weird things, but Stack Overflow is not a debugging service. What I've seen from a cursory look at the network pane, when you click on Gallery > People, there are two simultaneous requests to /inc/people.php — one takes 4-4.5s and the other 8-9s, thus my guess is one gets locked waiting on the other to finish, which might be either due to session or database. These scripts return a bit under 4k, so the long delay cannot be explained by network latency — it is something you're doing server-side. Good luck.
Part of the problem is that you have a lot of javascript and css files which all have to load before the image loads.
Every external file that you link to (ie non-inline file) requires a separate dns lookup and then retrieval. The problem is that the browser will only look up a few at a time (a limitation of the TCP/IP protocol) and make the browser wait for those to return before looking up the next ones.
The solution is to combine some of these javascript and css files from 8 or so to 2-3. This should shave off about 2 seconds

Apache is lagging or something else is bad

I have a website. It's my first website with Zend Framework but I think it's written good. Generatiom time is about 0.9s now. I'll do it something like 0.2 but leave it now. When you press any link on the website it tooks about 1,5-2s before web browser is loading page. Then it tooks 0.15s to show it. So if execution time is 0.9 where are the other 1.1s? Ping is about 13ms. Website address is http://zgarnijlicke.pl
Edit:
Strange. Second domain, http://lottek.eu, is working good. Look at http://lottek.eu/picostreamer. It isn't lagging like the zgarnijlicke.pl domain.
Edit 2:
There is a problem with Zend-Framework. I setted up action without rendering view (layout disabled too) and it's working as fast as server can do it. I'll make new question for it.
Here's a webpagetest.org report for your site: http://www.webpagetest.org/result/100721_1P0Y/
If you view the waterfall graph for the first view, you'll see that the browser gets your HTML source at around the 1.2 second mark, and is first able to render your page at just after 4 seconds. What happens in between those two is downloading of your three javascript files and two CSS files. So, this is where you want to start. Some suggestions:
Consider using a free CDN for jquery.js insteading of serving it from your server, e.g. Google's: http://code.google.com/apis/ajaxlibs/ . This way, users are more likely to already have it cached, Google will serve it from a location geographically closer to the user, and (I think) in compressed format.
For jquery.corner.js and jquery.media.js, consider merging them into one file and serving them compressed (the Apache module mod_deflate makes this very easy to do)
Same for your CSS files - consider merging them into one file and serving them compressed.
Those will give you some quick wins. However there are other things you can improve:
Add width and height attributes to your image tags. Without these, some browsers will halt rendering while they download the images so that they know how much space they'll occupy. None of your image tags have these attributes.
Make sure you're using the right image format for the job. Your banner.png image is over 300k which is far too large. I converted this to a JPEG image (80% quality) and it was 30k.
As for the execution time, 0.9 seconds seems quite high. Are you using APC or similar? Is the page doing any heavy database work?
Try putting some timer code in your php that measures the length of time it takes to generate the page content. This way you can confirm or rule out server problems.
You might also use network tools like ping and traceroute to see if your problem is caused by network latency.
A quick test with wget here gets an overall execution time of 1.5s to transfer one of the pages, with an actual download time of 0.2 seconds, so 1.3s of overhead. The pause occurs before the transfer starts, so that's a server-side problem.
Is that site on a virtual server? It's possible that if the underlying physical server is heavily loaded, your image could be getting swapped out or otherwise CPU-starved and takes ~1 second to become responsive again.
Perhaps it's an internal resource thing - are you connecting to a DB, especially a remote one? Even if some or most of the pages aren't DB-driven, the overhead of connecting to a DB could be causing this slowdown. And then gets swapped/delayed again as there's little further activity to keep the image active.
It could even be something as silly as Apache being configured with 'IdentityCheck' on, though unlikely, as this would slow down all requests. I'm not seeing any slowdown on the requests for .css/.js files from your server when viewed from HTTPFox. Interestingly, requesting the .css/.js via wget returns a '500 Internal Server Error'.
I found it. It's problem with ZF because when I did hello.php page with code like that:
hello world
Without any < ?php ?> script took 0.4s to complete.

What can cause a website to not always load

Roughly about 20% of the time when clicking on links in my website (www.slr-lens.co.uk), the site completely fails to load. I have tried removing and adding all code segments but to no avail... I've also asked the web hosts, but apparently the server is working normally.
Does anyone have any suggestions about what could cause a web page to sometimes not load? E.g. any specific lines in the php.ini?
The site uses sessions, and there's quite a lot of mysql action for each page load.
Internet explorer will say:
"Internet Explorer can't load this page"
Google chrome will say:
This web page is not avialable: Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error.
Firefox will sometimes only show a blank page.
Sorry for being so vague but its a really vague problem!
Thanks
The answer (or at least a clue) likely lies within your PHP / Apache error logs.
It could be your Apache logs or you just have a bad host. Either way, it seems to load every time here (10+). Have you tried replicating this problem somewhere else?

Categories