Unacceptable Load Time

Connect with other users about what to run on your webhosting (and how to run it) here.
Post Reply
tenub
A semi-regular
A semi-regular
Posts: 29
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Tue Aug 27, 2013 6:28 am

Unacceptable Load Time

Post by tenub »

I went ahead and added separate web hosting for use with my VDS instead of running game servers AND web hosting on the VDS thinking it would improve performance. Instead, my php pages (which I wrote myself for the most part) are taking LONGER to load. I had a similar issue when I was running my web server on Windows (5+ second load times), but after optimizing my code I got my index.php load time down to around 900ms. However, I started noticing seemingly random long load times (10+ seconds), so I swapped to Debian and everything was very responsive (~350ms with rock solid stability). However, my game servers were not stable in the least on linux, so now I'm back to Windows and I added the web hosting separately. Now my index.php consistently takes well over 10 seconds to load.

Feel free to test it yourself:

http://tenub.site.nfoservers.com or http://kz-endo.us

My guess is that it has something to do with fetching data from MySQL.

Edit: I just realized it's most likely due to failing to ping my other three servers since I haven't gotten them running yet on my new Windows install on my VDS. Will report back if I'm still experiencing this issue after I get those servers up.
tenub
A semi-regular
A semi-regular
Posts: 29
Joined: Tue Aug 27, 2013 6:28 am

Re: Unacceptable Load Time

Post by tenub »

Follow up: my guess was partially correct. Once all my servers were up and my server pinging script stopped timing out load time of index.php did go down. It's still unacceptably slow and takes far longer than when I was hosting on my own VDS while running four game servers (~2s down from ~10s).
User avatar
soja
This is my homepage
This is my homepage
Posts: 2389
Joined: Fri May 18, 2012 3:20 pm

Re: Unacceptable Load Time

Post by soja »

What do you consider unacceptably slow? The only page that took more than a second to load was the main page, which had a lot of data. Even that only took ~3s to load.

If I had to guess it has something to do with the game servers and web server no longer being on the same machine. Have you looked into how sourcebans does their server displaying, which queries the server while loading the rest of the page(and have a "querying server information" displayed until it is finished).
Not a NFO employee
User avatar
kraze
Former staff
Former staff
Posts: 4362
Joined: Fri Sep 17, 2010 9:06 am
Location: California

Re: Unacceptable Load Time

Post by kraze »

Both links took about an equal time to load for me. I would definitely check MySQL and make sure no connections are hanging up, MySQL doesn't like latency and having any can cause weird issues.

Our web hosting is in Seattle so if you have a game server in NYC the latency between those two locations could cause the slow loading you're seeing.

If MySQL is the issue you may try changing your script to only update once every five minutes instead of on refresh, which it what it appears to be now.
@Kraze^NFo> Juski has a very valid point
@Juski> Got my new signature, thanks!
@Kraze^NFo> Out of context!
@Juski> Doesn't matter!
@Juski> You said I had a valid point! You can't take it back now! It's out there!
User avatar
soja
This is my homepage
This is my homepage
Posts: 2389
Joined: Fri May 18, 2012 3:20 pm

Re: Unacceptable Load Time

Post by soja »

Is mysql on NFO webhosting right now, or your vds still? If you can, move it to NFO to have the fastest page load times.

kraze, I'm pretty sure it is the server querying which is making the pages load longer than they should, not mysql traffic
Not a NFO employee
User avatar
Edge100x
Founder
Founder
Posts: 13110
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Unacceptable Load Time

Post by Edge100x »

You can add debug code to your script to determine for certain what part of the execution is slow, but it's highly likely that the sluggishness comes from querying several faraway services, especially if you're doing those queries in a serial fashion. To speed it up, you could use separate processes for each query, or you could cache results (either by doing a background query regularly to keep the cache relatively fresh, or caching the output from query for a client-triggered query for a certain period of time).
tenub
A semi-regular
A semi-regular
Posts: 29
Joined: Tue Aug 27, 2013 6:28 am

Re: Unacceptable Load Time

Post by tenub »

My VDS is in Atlanta and my web hosting is wherever you guys have it. I may try experimenting by setting up MySQL again on my VDS and using it for my databases as opposed to the web hosting in WA (or wherever). I may also try splitting up my index.php into separate scripts and load them via ajax whenever each has been processed by the server. I could also maybe preprocess the page every 5 minutes or so via cron and store the results in json on the server so all it has to do is retrieve that data when the client loads the page since the data is all static (only depends on time) and has nothing to do with the user.
Post Reply