FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


long polling concerns and tips?





jmraker
When switching an ajax chat server from short to long polling where it loops until a new message is inserted into the database should the program open and close the database inside the loop to free up the connection?

In mysql the max connections is set to 100, and there number of chat users and normal web traffic for the site could go over that limit, which I assume would slow down the mysql_connect() until it times out and fails.

Also, on the apache side, wouldn't long polling tie up the child processes to the point where eventually none of them becoming available to normal web traffic because off the apache threads are waiting for a message and one can't come in because it's stuck in the run queue?

I have the long polling loop setup to exit after 60 seconds.

Would it be dangerous to remove the timeout to the loop for the reasons above?

--
I've been playing with https://github.com/esromneb/phpwebsocket and it seems to be the only one that PHP socket server that works, but for some reason there's a big problem with disconnects.
Related topics
Affilate
referal links
Hello all
multiplayer: use db, sockets or others?
Blackberry Torch
Blackberry, ActiveSync etc
Interview Tips: Thriving on Phone Interviews
Joking....
web design and site optimisation tips
Travelling tips....
Hosting moodle
Interview Tips: Handling Difficult Question
Interview Tips: Does Your Resume Sparkle?
Interview Tips:E-Mailing Your Resume...
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.