Jump to content

Queries slow to a halt if end user clicks to different sections too quickly


Recommended Posts

I have a flash multiplayer game -http://www.battlebubes.com/, the problem is..if you go through a bunch of different sections quickly(i.e. go to the bank, then go train your guy then go to the bank, and then train your guy)...things start to get incredibly slow...the problem is solved if you reload and log in again.

The game is 1 flash file that just sends and recieves info to a bunch of php files which send and recieve info from the databases.

 

The game works fine unless you do a bunch of different things in a row too quickly...then you have to reload the page and re-login..

 

any info on what could be causing this?

Thanks

I know! It's because the user goes through many sections too quickly!

 

That's about all we can say without knowing any further details.

 

You posted it in MySQL Help so you suspect that MySQL is slowing you down... any reason for that?

I know! It's because the user goes through many sections too quickly!

 

That's about all we can say without knowing any further details.

 

You posted it in MySQL Help so you suspect that MySQL is slowing you down... any reason for that?

I would assume that is the problem...I am self taught, so I am still a newb about alot of things..I am not sure where to look and just found this forum....

 

I would assume that the problem is with mysql, but again not entirely sure... I will try to be more specific... If the end user goes to a section on my game...flash sends info to a php file that looks up there info about that players stats in the database and then returns that info to the flash file...then it repeats ,looking up the data for that section

I realize that are probably better ways to do this, but it works fine until you go to a bunch of different sections quickly......if you wait a few seconds...it will start running smoothly again.

 

I am assuming it's a problem with mysql..because the php files are fairly short, so I can only think it has something to do with the database

 

This might be the wrong forum, but I don't know even what to look for.. if someone could even point me in a direction it would be much appreciated.

Ok...I have been searching the web all morning and I think I might have identified what the problem might be(please forgive me if this is a total newb question)...but every php file connects to the database using mysql_pconnect...I read that you can only have a certain amount of connections at 1 time...does this mean that I am opening a new connection everytime the enduser goes to a different section?(every section sends info to 2 different php files that look up different things in different tables)

 

First of all you should actually try to see where is the bottleneck.

 

Use something like this

 

$timeStart = microtime(true);
mysql_query(...);
$timeEnd = microtime(true);
$queryExecutionTime = $timeEnd - $timeStart;

 

to measure how long queries are executing (you should probably save these results to a txt or csv file for later analysis)

 

[edit]

 

And do not use mysql_pconnect. It doesn't work as most users expect it to. Use mysql_connect instead.

Thanks Mchl, I changed all my php files to mysql_connect ...then I did a test, I went to 1 section..where there are 2 php files called on and 5 queries being exacuted...when I first go there, it loads up right away, so I kept hitting reload...the first few times..everything loads up fast...then it starts to take longer and longer... so it can't be the queries...the tables have not changed

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.