drummerjeff Posted April 15, 2009 Share Posted April 15, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/154240-queries-slow-to-a-halt-if-end-user-clicks-to-different-sections-too-quickly/ Share on other sites More sharing options...
Mchl Posted April 15, 2009 Share Posted April 15, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/154240-queries-slow-to-a-halt-if-end-user-clicks-to-different-sections-too-quickly/#findComment-810857 Share on other sites More sharing options...
drummerjeff Posted April 15, 2009 Author Share Posted April 15, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/154240-queries-slow-to-a-halt-if-end-user-clicks-to-different-sections-too-quickly/#findComment-810881 Share on other sites More sharing options...
drummerjeff Posted April 15, 2009 Author Share Posted April 15, 2009 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) Quote Link to comment https://forums.phpfreaks.com/topic/154240-queries-slow-to-a-halt-if-end-user-clicks-to-different-sections-too-quickly/#findComment-810914 Share on other sites More sharing options...
Mchl Posted April 15, 2009 Share Posted April 15, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/154240-queries-slow-to-a-halt-if-end-user-clicks-to-different-sections-too-quickly/#findComment-810917 Share on other sites More sharing options...
drummerjeff Posted April 15, 2009 Author Share Posted April 15, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/154240-queries-slow-to-a-halt-if-end-user-clicks-to-different-sections-too-quickly/#findComment-810938 Share on other sites More sharing options...
fenway Posted April 16, 2009 Share Posted April 16, 2009 If you're confident it's not the "tables" or database, then this is wrong board. Quote Link to comment https://forums.phpfreaks.com/topic/154240-queries-slow-to-a-halt-if-end-user-clicks-to-different-sections-too-quickly/#findComment-811442 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.