Laravel slow on 1st time load - laravel

I have a laravel app that loads fine on localhost but when deployed on a shared 1&1 host server (for demo purposes) the first page load is very slow (up to 12s !). It's only occuring on first page load, after that it works perfectly fine as if the site was going on "sleep" mode when not used for a while.
It does sound like a cache issue though I activated all laravel caches (views, config, routes..).
Someone mentioned a similar problem on a godaddy shared host, their solution was to have a cron pinging the site every minute to keep it alive, that probably works but that's not a very satisfactory solution.
The debugger/console are not showing much :
On first page load :
Queries 343ms
Route request 12.46s
The console is showing a 12.69s TTFB waiting time
After reload
Queries 39.47ms
Route request 238ms
console 334ms.
Has anyone come across a similar issue before ?

Issue seems to be related to the host. Same install on a different host works perfectly, no real answer here..

Related

Why are my localhost HTTP response times so slow?

Using localhost and Tomcat 7, I'm seeing between 600-800ms per request in Chrome Developer tools for a specific webapp. Requests are JS files, CSS files, images or the initial server response. Some responses are less than 1KB, others are over 100KB.
As a result, it's taking around 10 seconds to load one page of the webapp. When I load the same webapp on our production server, it's taking less than 1 second to load an entire page.
I'm not sure where to continue debugging the issue...
I've ruled out it being a browser issue by testing in Safari too.
I've turned it off and on again
Reduced response to 500-600ms overall
I've cleared out my log files
I've ruled out the webapp's frontend entirely by hitting a resource directly, ex: http://ts.xyz.com:9091/1.0/toolsList/javascript/toolsList.js or http://ts.xyz.com:9091/awake
I've tested another webapp and that performs lightning-quick
So, it has to be this particular app and it has to be locally.
I've seen such behaviour long time ago when the webserver (Apache httpd back then) was configured to make DNS lookups for logs - these took awfully long time especially when an IP could not be resolved. As it doesn't make sense for a localhost app to be orders of magnitude slower (especially when you're talking about serving static resources) I'd check for any network related issues: Database connections, logging configurations, DNS lookups, TLS server trust issues (with backends, database, LDAP or others).
I can't decide if I add this as "if everything else fails" or rather add this as "but first try this:"... you decide:
Compare the setup of your production server with your development server (localhost) and make extra extra extra sure that there's no meaningful difference.

Why is it taking so long for Meteor to load my data on Heroku?

I am using Meteor on Heroku (free tier) with MongoHQ. My app is very simple right now, it loads 3-4 entries from a Collection, but when I deploy it to Heroku, I am seeing ridiculous load times (1-2 minutes). The HTML is rendered immediately. When I deploy to Meteor.com's free server, load times are a lot lower but still about 15 seconds for 4 tiny pieces of data. I'm not seeing this whatsoever when I deploy locally, app pulls data from the DB right away.
It is worth noting that I don't think it's an "idling" issue for Heroku. Even if I already have one browser window with the app just opened, if I use a different browser and try again I still get 1-2 minute load times. Once the data is loaded, however, performance goes back to being great, I can read and write with no problems.
What am I missing? I'm not seeing any errors in the console, mongo shows several queries in the logs and shows that it is responding quickly with 4 documents, but apparently somewhere in the middle there's a traffic jam. Any help with this is greatly appreciated, if I can't get past this Meteor is useless for my needs right now.
UPDATE: I've been watching it closely in Firebug, and it looks like the performance is largely inconsistent. Sometimes a simple refresh will take 1 minute, sometimes it will take 10 seconds. But what I've noticed is that the times when its slow, it GETs the sockjs/info file, then right after that the sockjs POST is aborted (sometimes multiple times). When it runs fast, the POST and subsequent POSTs run smoothly
Slow:
GET http://pocleaderboard.herokuapp.com/sockjs/info 200 OK 22ms
POST http://pocleaderboard.herokuapp.com/sockjs/029/su0d77fb/xhr Aborted
GET http://pocleaderboard.herokuapp.com/sockjs/info 200 OK 27ms
POST http://pocleaderboard.herokuapp.com/sockjs/132/uljqusxd/xhr Aborted
GET http://pocleaderboard.herokuapp.com/sockjs/info 200 OK 28ms
POST http://pocleaderboard.herokuapp.com/sockjs/154/kcbr6a5p/xhr Aborted
Fast(er):
GET http://pocleaderboard.herokuapp.com/sockjs/info 200 OK 1.08s
POST http://pocleaderboard.herokuapp.com/sockjs/755/xiggb555/xhr 200 OK 1.02s
Meteor gets loaded that fast locally, because it doesn't depend on your internet connection and the files can just be read from your harddrive and don't need to be downloaded.
And once the data is loaded it's the same everywhere you host, because the client (you) perform all actions on your cached mongo database and then just wait for the server to say if the action was alright or not.
But for the Heroku loading times, I have no idea, Sorry!
UPDATE:
These are the long-pulls from SockJS that is used by Meteor.
Normally these pulls only get Aborted on a hot code push (when a file is added/changed/removed).
Either you or Heroku seem to write or change something in the directory.
Because then a hot code push may be initiated by Meteor.
Heroku may not support web-sockets, which means you're stuck with the slower polling approach. See this:
https://devcenter.heroku.com/articles/using-socket-io-with-node-js-on-heroku

MVC3 Speed on production iis7

I have an MVC3 application which is working fast in my dev environment (even when pointed at the production database). However, when I publish the application and move it onto the production iis7 environment it runs at a snails pace. I understand that the inital load can take a few seconds as the application pool starts up, but this is taking 20+ seconds. Then will be fast for a few clicks and the next click will again take 20+ seconds.
I've put in the MVCMiniPorifler and it doesn't look like the database is causing problems. But, I also can't see what is causing the problem. I can hit the same page multiple times and it comes back in a second or 2 and then suddenly that same page will take 20+ seconds to respond.
Has anyone seen this sort of behaviour before? Any help would be greatly appreciated and I'm not sure what to try next.
It's possible that the other web apps running on your production server are locking required resources. Is there a common file or folder that multiple sites utilize? Are you sharing the app pool between any of the sites?

Long delay getting data from a server for one site but not 2 others

We're running 3 different Drupal (Pressflow to be specific) sites on the same server. The 2nd and 3rd sites were cloned from the first one and load just fine. The first one, though, is taking a few seconds to connect and start sending data back from the server. Same box, same config (as far as we know), same modules, and generally the same theme. Here's what Pingdom shows...
Fast site:
http://i.stack.imgur.com/YZilC.png
Slow site:
http://i.stack.imgur.com/6Um1M.png
Edit: Those are from Pingdom, the yellow indicating "The web browser is waiting for data from the server"
The configs are the same, performance options same, server configs, as far as we can tell are the same. The delay occurs before any page elements are visible so it's not an on-page object problem or a page speed problem.
Could this be a config issue with the server? Where should we be investigating?
Thanks in advance!
I would try increasing the size of your MySQL cache. It's possible the fast sites have their particular queries cached and the slow site has a query that doesn't quite fit the cache, so the MySQL query results need to be regenerated each time.
Just a guess!

Ajax submitted form takes long time to process

I am wondering where this comes from : I have a 2 field form for a site that I am building and for some reason, the post request takes up to 13 seconds to complete, according to firebug... The script literally just sends an email in plain text with the user inputs and that's it, nothing complicated.
I am wondering where that delay could come from, any idea ?
Here is a link to a dev version : http://vps-sd.com/sd2012/
I tend not to click links to sites I don't trust, but it could be either
1) Network latency. Are you on a vpn? Where is the dev server hosted? You can use traceroute or something like that to follow the request from the command line.
If both the client and the server are on your dev box this should not be an issue.
2) For really long requests, I think it is more likely something in your dev server is screwed up. It could be the code, or it could be that the dev server is having some issues. Did you log onto the dev server and look at its load? Has some process gone haywire? Has it used all its memory? Did you add some simple benchmarking code to the application server?
You need to diagnose where exactly the slowdown is.

Resources