[SOLVED] Slow Server?

Need help with an engine or coding not on the list? Need help with a game or the website and forums here? Direct all questions here.
Post Reply
Klown
Posts: 90
Joined: Tue Feb 22, 2011 5:59 am

[SOLVED] Slow Server?

Post by Klown »

UPDATE:

I decided to try an experiment after pulling my hair out for a week! I made a PHP if statement in my code which wrapped the AJAX calls for updating my players stats on their screens. I used the if statement to prevent the ajax from loading on the "problem players" account - instantaneously the problem was solved. For some reason his computer or internet connection was taking too long to perform the AJAX calls and somehow was slowing down the game. Not sure why - but short term solution is to keep this code in effect for him.

Thanks for everyone's help on this! It was greatly appreciated.

Hi Guys,

This is an odd question - but I am unable to find any resources on the web for my particular problem. I have been creating a browser game for the last couple years. Long story short - I have 1 player who has recently joined the game, and each time they are logged in - the game is extremely slow to respond for every other player. I have isolated it to 1 player only causing this strange issue. I am hosted on a virtual private server and have access to view my server cpu usage and everything is very low. I have had many other players on at any 1 time and never had any lag issues. Anytime this one player logs in, images load slow, queries to mysql database run slow, even clicking internal links to game pages that use no database queries will take 10 seconds or more to redirect. Normally this would take less than a second.

The game is PHP/mysql with some javascript used. I am quite sure it is not a code issue because of the fact it only happens when the 1 particular player is logged in.

The obvious answer is to ban the player- but it will be very hard to isolate this in the future if I get too many players online at one time to notice when the occurrence happens.

Anyone with any advice would be greatly appreciated!

Thanks in advance,

Dustin
Last edited by Klown on Mon Mar 03, 2014 5:57 am, edited 1 time in total.
if( $myGames != "Crap" ) {
  • please_donate( $money );
} else {
  • just_enjoy();
}
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: Slow Server?

Post by hallsofvallhalla »

can you check to see what resources are actually being loaded? Like is it one page over and over or one image? Do you know the location of that player? Checked the IP to see if it is a known IP?
User avatar
Jackolantern
Posts: 10893
Joined: Wed Jul 01, 2009 11:00 pm

Re: Slow Server?

Post by Jackolantern »

You may also want to start logging all of the actions coming from that IP, just to rule out any hacking attempts, rarely used game functionality, etc.
The indelible lord of tl;dr
Klown
Posts: 90
Joined: Tue Feb 22, 2011 5:59 am

Re: Slow Server?

Post by Klown »

hallsofvallhalla wrote:can you check to see what resources are actually being loaded? Like is it one page over and over or one image? Do you know the location of that player? Checked the IP to see if it is a known IP?
I looked through the access log files for some time periods he was online and could not find any repeated file access coming from the players IP. I also checked the servers CPU usage while he was logged in and it peaked at 0.89 % so its very low.

This lag reminds me of the same lag you get when playing games like Star Craft or Diablo when another player is slowing the game. I'm not sure how it would be possible for another user connected to my server would be able to slow everyone else including myself without some sort of flood attack which does not seem to be the case.


Here is the whois info on the players IP:

It seems to be from Singapore

netname: SINGTELMOBILE-AS-AP
descr: Singapore Telecom Mobile Pte Ltd
descr: 10 Eunos Road 8
descr: Singapore Post Centre #13-01
country: SG
admin-c: SH1968-AP
tech-c: SH1968-AP
notify: dbmon (at) apnic.net
mnt-by: APNIC-HM
mnt-lower: MAINT-SG-SINGNET
mnt-routes: MAINT-SG-SINGNET
mnt-routes: MAINT-SG-STM
mnt-irt: IRT-SINGTELMOBILE-SG1
status: ALLOCATED PORTABLE


Any other input or suggestions to try or check into would be very much appreciated. I've been pouring over the server and came logs all day.

Dustin
if( $myGames != "Crap" ) {
  • please_donate( $money );
} else {
  • just_enjoy();
}
User avatar
Jackolantern
Posts: 10893
Joined: Wed Jul 01, 2009 11:00 pm

Re: Slow Server?

Post by Jackolantern »

It is good you looked at the server logs, but you may need to check game logs if you have them, or add game action logging if you don't. I am not sure how your game or server is setup, so I don't know if you can actually tell action-by-action what he is doing on what you have already looked at, but if not, that is what I would suggest next. See what the lil' bugger is actually doing.

Also, have you tried talking to him about it? If he is really not doing anything untoward, he should be willing to work with you on debugging the problem. If it is something intentional he is doing, he will likely shy away and blow you off. That would likely be pretty telling right there. And if he isn't doing anything on purpose, maybe you could have him try some other pages on your domain, reset his router, etc.
The indelible lord of tl;dr
Klown
Posts: 90
Joined: Tue Feb 22, 2011 5:59 am

Re: Slow Server?

Post by Klown »

Jackolantern wrote:It is good you looked at the server logs, but you may need to check game logs if you have them, or add game action logging if you don't. I am not sure how your game or server is setup, so I don't know if you can actually tell action-by-action what he is doing on what you have already looked at, but if not, that is what I would suggest next. See what the lil' bugger is actually doing.

Also, have you tried talking to him about it? If he is really not doing anything untoward, he should be willing to work with you on debugging the problem. If it is something intentional he is doing, he will likely shy away and blow you off. That would likely be pretty telling right there. And if he isn't doing anything on purpose, maybe you could have him try some other pages on your domain, reset his router, etc.
Thanks for the advice.

I don't have a way to log every single action in the game. I never built that in. As an update - I do have some ajax which auto updates some player stats every few seconds. Those requests show up in the server access log files. The odd thing is, a little while ago while only 3 of us were on the game, including the player who is lagging it. I checked every players IP and could only find my IP and one other players IP in the log files for the ajax requests. The player in questions IP is not found anywhere making any requests in the log files.

I have been talking to him - he seems genuinely helpful in trying to figure it out. He is on a computer connected via Cellular - He will let me know when he is able to get on a land line to see if it has to do with the provider. But in the mean time he is experiencing the lag also.

I will be looking into adding a function to track player actions but that will take time - and I am pretty sure this is not an attempt to attack the game.

Considering this new information, any additional help would be greatly appreciated.

Thanks again for helping!

Dustin
if( $myGames != "Crap" ) {
  • please_donate( $money );
} else {
  • just_enjoy();
}
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: Slow Server?

Post by hallsofvallhalla »

if you are you using ajax then then it may be some kind of "polling" issue. You have responses waiting to happen because he is on a very slow network. So in other words your other network commands are waiting for a response before moving on to the next. While this sounds silly you would be surprised on how you wrote this stuff on how it can factor.
Klown
Posts: 90
Joined: Tue Feb 22, 2011 5:59 am

Re: Slow Server?

Post by Klown »

hallsofvallhalla wrote:if you are you using ajax then then it may be some kind of "polling" issue. You have responses waiting to happen because he is on a very slow network. So in other words your other network commands are waiting for a response before moving on to the next. While this sounds silly you would be surprised on how you wrote this stuff on how it can factor.
Thanks for your input on this.

I have been working with the player - he was able to login from a land line connection - non-cellular and we had the same lag issue. Is it possible for ajax to be slowed by his computer itself? hes running windows 7 laptop which isnt more than 3 years old.

I am wondering if an ajax call which sends a request to refresh a div with some simple mysql queries for some stats would cause lag on the entire server. I'm no pro at ajax - so the question becomes is it possible for ajax to lag the entire game because 1 players computer would not process the requests fast enough? i though each players computers were independently calling the script so they are sort of separated?

Thanks again for the help!

Dustin
if( $myGames != "Crap" ) {
  • please_donate( $money );
} else {
  • just_enjoy();
}
Winawer
Posts: 180
Joined: Wed Aug 17, 2011 5:53 am

Re: Slow Server?

Post by Winawer »

Are you using Apache? Have you tried adding more child processes?
User avatar
MikuzA
Posts: 395
Joined: Thu Aug 08, 2013 8:57 am

Re: Slow Server?

Post by MikuzA »

Klown wrote: The odd thing is, a little while ago while only 3 of us were on the game, including the player who is lagging it. I checked every players IP and could only find my IP and one other players IP in the log files for the ajax requests. The player in questions IP is not found anywhere making any requests in the log files.
Hello Klown, interesting issue you have at hand.
First thing popped into my head when you mentioned the quoted stuff, is that if the person is operating through cellular and it's somehow restricted to do some actions, limited by ISP or Browser, would say Browser since it's the Ajax in this part.

Anyways to my point,
Everyone else accesses the game as designed, however this one particular user has something that hinders it to do the Ajax requests, therefore he constantly requests something but doesn't access it.

And if your game design is dependant on these ajax requests, consider what might happen if they would not get executed.
Can there be some unnecessary loopings happening due the data that the ajax produces doesn't add up to the other stuff happening?

Just some ideas to help you out on the analysis, hope you find the root cause!

-MikuzA
Why so serious?

Business Intelligence, Data Engineering, Data Mining
PHP, HTML, JavaScript, Bash/KornShell, Python, C#, PL/SQL
MySQL, DB2, Oracle, Snowflake
Pentaho, DataStage, Matillion, Unity3D, Blender
Post Reply

Return to “Advanced Help and Support”