Link to home
Start Free TrialLog in
Avatar of APD Toronto
APD TorontoFlag for Canada

asked on

Application Slow on Remote Server

Hi Experts,

I just created a little application in PHP and MySQL, and on my localhost it is very quick, but when I upload it to my VPS at http://crm-cor.aces-project.com/ it is very slow, even the login page.

There is not that much activity on this server, and I have other applications on there that are fast, but can anyone tell what it could be? Both my localhost and VPS are IIS.

This is a test copy, so the credentials are :

aleks@aces-project.com
testing


As well, I am using Google API, which I installed on my localhost with Composer, but on the VPS. I just uploaded it for now. Could that be it?
Any help will be greatly appreciated.
Avatar of Shalom Carmel
Shalom Carmel
Flag of Israel image

Your application is slow.

Did you try to look at the pages waterfall? Start Chrome, and open developer tools (or press F12). Then, select the network tab and refresh the page.
User generated image
Slow connection time, very long time to first byte, and very high download times. This becomes most apparent with the font file you use.
Unfortunately, I don't know what is the cause. Could be the VPS, or the VPS network, or your IIS setup. I don't think it's your code, as the html download is ok, but the static objects suck big time.

If you want to debug it, then start an AWS account, and reinstall your app there to compare timing.
If you want to solve it, use a CDN. Try Cloudflare, they have very economical starter packages (starting at $0..).
The downside is that with the starter packages you will have to move the DNS for the domain you need to serve to Cloudflare.
If you cannot touch the DNS, then use AWS Cloudfront with your VPS, or Fastly.
Either will add less than $50/month to the total monthly cost of the web site, and will improve the page load tremendously.

One more thing regarding your programming style: You use absolute links when referring to objects like images, scripts, stylesheets and internal links.
This is a bad, bad habit.
It means that your web pages are rigid. It will be difficult to add TLS, it will be difficult to test different environments.
If your javascripts images and stylesheets are not shared between projects, then instead of this  
   
<script type="text/javascript" src="http://crm-cor.aces-project.com/utilities/timeout.js"></script>

Open in new window

try to have this
 
 <script type="text/javascript" src="/utilities/timeout.js"></script>

Open in new window

It looks like  your fonts are the biggest culprit. Make sure they are loading asynchronous.  The way you have not now, nothing loads until this is finished (blocked). When you load asynchronous everything continues and the font loads in the background.
 https://blog.fontawesome.com/how-to-use-asynchronous-font-loading-e774227a5b3c

Another issue that is taking up time is your logo.  As best you can, upload your image 100% of the actual size you will use as the resizing in the browser also takes time.

The last thing I have not tested but could also be an issue and that is Chrome is detecting the form is asking for personal information and the site is not using https.

The first thing I would do is to remove fontawsome from any javascript/jquery and css as well as the actual link to the font
 <link rel="stylesheet" type="text/css"
                      href="http://crm-cor.aces-project.com/styles/font-awesome.css">
                

Open in new window


Then run your site and see if that makes a difference. Remember to use the browser console to detect issues as you may have forgot to remove a reference.

If that speeds it up, you know that is one of the issues. Next remove the logo and any references to it and see if you can visually detect a difference as well as using the browser console to see actual speed. Remember to refresh while holding down the shift key to prevent caching.  

If you see a difference with the font, add it back and  use asynchronous loading and test.

If you saw a difference when removing the logo, make a copy using the exact size you will load in the browser and upload and see if that makes a difference.

Also remember to set your css, js and any other files you will load to use the path and not the full url as each time you load something using http:// or https:// it is another trip to the server. I do think you will see the biggest improvement with my first two suggestions. The reason it may be running faster locally is caching and the fact you don't have to download anything when it runs.
Avatar of APD Toronto

ASKER

What if I use Google fonts API to load my fonts?
First try without the fonts. The reason is to rule that out. If you notice that is the issue, then you can try other things. However, it will not matter where you load, it is how. Async appears to be the answer for that.
Actually you will see that I removed the fonts now, but it is still slow.
I can see it is faster. Keep using the browser console that Shalomic mentioned.  Currently it looks like loading jquery from the cdn may be an issue. Load it from your server.  Fontawsome css is still being loaded. Are you loading async?  Is there an issue with vps.apdcompany.ca?  Is that a web server?
Changing my db host from localhost:3306 to 127.0.0.1:3306 seem to do the trick. Any iidea why
ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you!