GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Any php mysql guys? have a question (https://gfy.com/showthread.php?t=899914)

Sex9 04-15-2009 11:03 AM

Any php mysql guys? have a question
 
I have a flash multiplayer game, 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..

What could be causing this?
Thanks

grumpy 04-15-2009 11:15 AM

check your browser memory usage and check the indexes of your tables. How big are the tables?

AdultSoftwareSolutions 04-15-2009 11:15 AM

Hard to say since we don't really know anything about this and from the description it is not going to help. Sounds like bad code. Going through PHP and requesting pages each time you need data seems extremely inefficient. I would look into something more low level like some kind of flash remoting that allows straight access to functions instead of pages.

Sex9 04-15-2009 11:43 AM

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

I am self taught and still quite new to this...so I don't know even what to look for.. if someone could even point me in a direction it would be much appreciated.

oh, and the tables are still fairly small(300-900 entries)

gornyhuy 04-15-2009 11:53 AM

Can you get a server guy to check your mysql load and number of connections? You might be locking up your tables or maxing out your connections and then subsequent connections have to wait for previous connections to time out before they can get in there.

Sex9 04-15-2009 12:07 PM

Quote:

Originally Posted by gornyhuy (Post 15747586)
Can you get a server guy to check your mysql load and number of connections? You might be locking up your tables or maxing out your connections and then subsequent connections have to wait for previous connections to time out before they can get in there.

--I think that might be the problem(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)

rowan 04-15-2009 07:28 PM

Do some profiling on your flash app to figure out how long the average wait time for a response from the MySQL server is. It's possible there's some other quirk in your code and it's nothing to do with the phone home process...

Sex9 04-15-2009 07:35 PM

well I did some research and found out it has something to do with the send and receive from the flash file(all my php/mysql stuff was executing very quickly once it receives the info.)...been searching all day and I can't find another instance of this problem anywhere....so I am about to pull my hair out or possibly throw a bagel at some unfortunate passerby

psili 04-15-2009 07:40 PM

I'm dumb but have free time at the moment.

1. Test it without the persistent connection issue from gornyhuy #5.

2. In the flash movie, can you put requests to external PHP scripts into an array / stack and have them execute sequentially: Each user click for data is put into some global flash variable for data requests that must be made before something else can happen? Maybe there's some parallel requests made via the flash movie to gather data's that's causing hiccup somewhere.

I'm just babbling. I'll stop now.

Sex9 04-15-2009 07:51 PM

Quote:

Originally Posted by psili (Post 15749394)
I'm dumb but have free time at the moment.

1. Test it without the persistent connection issue from gornyhuy #5.

2. In the flash movie, can you put requests to external PHP scripts into an array / stack and have them execute sequentially: Each user click for data is put into some global flash variable for data requests that must be made before something else can happen? Maybe there's some parallel requests made via the flash movie to gather data's that's causing hiccup somewhere.

I'm just babbling. I'll stop now.

all responses are greatly appreciated(and am sure you are smarter than I)...i already changed all of of my mysql_pconnect to mysql_connect....changed nothing.
Not sure about the second point...the only thing I can brainstorm,, is that somehow when flash is receiving and sending the data each time..it is stored as brand new data(maybe not overwriting variables, but storing the same variable as a new one?)...therefore the more sections in the file where data is received -maybe the data piles up somehow...not really sure and I still can't believe this problem hasn't come up before(at least I cant find it.)...or maybe it's something completely different...just don't even know what to look for at this point

psili 04-15-2009 08:38 PM

Quote:

Originally Posted by Sex9 (Post 15749417)
all responses are greatly appreciated(and am sure you are smarter than I)...i already changed all of of my mysql_pconnect to mysql_connect....changed nothing.
Not sure about the second point...the only thing I can brainstorm,, is that somehow when flash is receiving and sending the data each time..it is stored as brand new data(maybe not overwriting variables, but storing the same variable as a new one?)...therefore the more sections in the file where data is received -maybe the data piles up somehow...not really sure and I still can't believe this problem hasn't come up before(at least I cant find it.)...or maybe it's something completely different...just don't even know what to look for at this point

1. I'm 99% sure what I write below could be blown away with a simple answer.... so just wait for that answer, as I'm not a flash dude.

2. It's often difficult to debug stuff over forums sometimes, so just keep hopes up that someone chimes in with a fix. I'll bump my retarded thoughts cuz I'd like to see a solution, just for the sake of seeing one. And I'm not a flash guy.

From what I read from your earlier posts, is that when a user clicks too fast through the flash game, and each click possibly requiring feedback from a database call before next click should occur, that's causing slowness.

Again, this is conjecture and purely made up, but the swif, as served in an individual browser instance, is trying to process multiple requests for the database calls at the same time ( or close to the same time if the user clicks too fast ).

So, my guess is:
- In the flash movie, when a user does an action that requires a database call / external PHP call that must return a response to the flash movie, put that into some Flash array.

- Every subsequent call to such things get appended to that array.

- Have a Flash process work through that array, from the first request to the next, until the user can progress.

That's my babble and a bump for ya.
Good luck, yo.

StaceyJo 04-15-2009 11:47 PM

Double check your codes and connection.

KillerK 04-16-2009 03:41 PM

Post the stats of your mysql server.

devine 04-16-2009 06:48 PM

just taking a guess here since I don't understand what you mean, but did you try stopping actions in Flash and opening connections only after a given command is complete? like action 1 (get MySQL) if done --> close | go to action 2 (get MySQL) if done --> close


All times are GMT -7. The time now is 04:16 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123