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 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 :

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.
APD TorontoSoftware DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shalom CarmelCTOCommented:
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.
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=""></script>

Open in new window

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

Open in new window

Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
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.

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"

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.
APD TorontoSoftware DeveloperAuthor Commented:
What if I use Google fonts API to load my fonts?
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
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.
APD TorontoSoftware DeveloperAuthor Commented:
Actually you will see that I removed the fonts now, but it is still slow.
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
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  Is that a web server?
APD TorontoSoftware DeveloperAuthor Commented:
Changing my db host from localhost:3306 to seem to do the trick. Any iidea why
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
My only generic answer is the dns / server set up.  On my windows server I have used both the ip and localhost and don't remember a difference. The good thing is you have it figured out!  For a deeper dive, post another question and select the windows server os topics. Then somebody more familiar with that side of things can answer.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
APD TorontoSoftware DeveloperAuthor Commented:
Thank you!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.