dlebowski Posted January 21, 2010 Share Posted January 21, 2010 I have an application that runs a mysql query every 2 seconds a user is on the page. When I do a netstat to see my active internet connections, I will some times have one person with over 100. This creates huge load problems on my server (and I have a pretty fast dedicated server) My question is, how can one limit this? Can apache do something? I really need help with this! Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/189276-ajax-server-load/ Share on other sites More sharing options...
Mchl Posted January 21, 2010 Share Posted January 21, 2010 Do you use persistent mysql connections? Don't. Quote Link to comment https://forums.phpfreaks.com/topic/189276-ajax-server-load/#findComment-999218 Share on other sites More sharing options...
dlebowski Posted January 21, 2010 Author Share Posted January 21, 2010 Thanks for the reply. Are you telling me to run : mysql_close() After each query? Or change something on sql server? What about "mod_limitipconn.c"? Will this help? Quote Link to comment https://forums.phpfreaks.com/topic/189276-ajax-server-load/#findComment-999219 Share on other sites More sharing options...
Mchl Posted January 21, 2010 Share Posted January 21, 2010 How do you connect to mysql? Do you use mysql_connect or mysql_pconnect? Quote Link to comment https://forums.phpfreaks.com/topic/189276-ajax-server-load/#findComment-999220 Share on other sites More sharing options...
dlebowski Posted January 21, 2010 Author Share Posted January 21, 2010 mysql_connect() Quote Link to comment https://forums.phpfreaks.com/topic/189276-ajax-server-load/#findComment-999221 Share on other sites More sharing options...
Mchl Posted January 21, 2010 Share Posted January 21, 2010 Ok. So that's not a problem with persistent connections. You can limit maximum connections MySQL will allow http://dev.mysql.com/doc/refman/5.0/en/user-resources.html but this will make your webpage unresponsive when it hits the limit. Quote Link to comment https://forums.phpfreaks.com/topic/189276-ajax-server-load/#findComment-999224 Share on other sites More sharing options...
dlebowski Posted January 21, 2010 Author Share Posted January 21, 2010 What about "mod_limitipconn.c"? Will this help? Quote Link to comment https://forums.phpfreaks.com/topic/189276-ajax-server-load/#findComment-999226 Share on other sites More sharing options...
Mchl Posted January 21, 2010 Share Posted January 21, 2010 I'm not really experienced with Apache configuration, but from description of this mod it seems it does something else. As I said: no experience, so I might be wrong. Quote Link to comment https://forums.phpfreaks.com/topic/189276-ajax-server-load/#findComment-999228 Share on other sites More sharing options...
dlebowski Posted January 21, 2010 Author Share Posted January 21, 2010 Well, thanks for your time. I have had problems with my script and it's because of the server load. I may have to look at something other than ajax. Quote Link to comment https://forums.phpfreaks.com/topic/189276-ajax-server-load/#findComment-999229 Share on other sites More sharing options...
dlebowski Posted January 21, 2010 Author Share Posted January 21, 2010 One last thing. Other than AJAX, what would you suggest I run server side that updates pretty close to real time? Java applets? Quote Link to comment https://forums.phpfreaks.com/topic/189276-ajax-server-load/#findComment-999235 Share on other sites More sharing options...
RichardRotterdam Posted January 21, 2010 Share Posted January 21, 2010 You might be looking for Comet. Also take a look at this thread http://www.phpfreaks.com/forums/index.php/topic,258102.msg1214978.html#msg1214978 Quote Link to comment https://forums.phpfreaks.com/topic/189276-ajax-server-load/#findComment-999337 Share on other sites More sharing options...
dlebowski Posted January 21, 2010 Author Share Posted January 21, 2010 Comet looks interesting. Not sure why i haven't heard of it before. I am looking for a good example used in conjunction with php. Having a hard time. Do you know of any resources? Quote Link to comment https://forums.phpfreaks.com/topic/189276-ajax-server-load/#findComment-999345 Share on other sites More sharing options...
RichardRotterdam Posted January 21, 2010 Share Posted January 21, 2010 Haven't gotten my hands dirty with Comet yet but this project looks promissing http://www.ape-project.org Quote Link to comment https://forums.phpfreaks.com/topic/189276-ajax-server-load/#findComment-999350 Share on other sites More sharing options...
dlebowski Posted January 21, 2010 Author Share Posted January 21, 2010 Man....That does look good. Thanks, man. I'm going to play with this tonight. Ryan Quote Link to comment https://forums.phpfreaks.com/topic/189276-ajax-server-load/#findComment-999542 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.