Wireless102 Posted February 12, 2007 Share Posted February 12, 2007 Hello, I have built an application for live internet bidding (real time auction). The question i have is, what would be the best way to update the bids? the way i have it setup right now is, during the auction i have an automatic script running that reads the database and writes the current bid, the username of the highest bidder and a few other items to a php file. on the client side of it (front end) i am using a xmlHttpRequest to read the output of the file that the automatic script writes. inside that file it simply writes "echo " currentbid,username,.....";" and the xmlhttprequest reads that as an array and updates the users front end. I do it this way to keep from having every user that is logged into the live auction from hitting the database every 4-5 seconds to get the current bid. it seems like this is not a very efficient way to do this and i am looking for advice on this matter if anyone has any. all of the other functions such as when a user places a new bid does hit the database but i dont see that being a problem since it is just when someone bids on an item. Thanks Link to comment https://forums.phpfreaks.com/topic/38125-php-ajax-polling-question/ Share on other sites More sharing options...
Wireless102 Posted February 12, 2007 Author Share Posted February 12, 2007 anybody got any ideas for this? the way it is now is working, but when i put this into action will it be to much load on the server? Link to comment https://forums.phpfreaks.com/topic/38125-php-ajax-polling-question/#findComment-182896 Share on other sites More sharing options...
Lumio Posted February 12, 2007 Share Posted February 12, 2007 Create an interval that does every minute a http-request. Link to comment https://forums.phpfreaks.com/topic/38125-php-ajax-polling-question/#findComment-182920 Share on other sites More sharing options...
Wireless102 Posted February 12, 2007 Author Share Posted February 12, 2007 with it being a real time application 1 minute is to long between updates, 5 seconds is about as long as i want to go. It is only requesting about 40-60 bytes of data each request. Link to comment https://forums.phpfreaks.com/topic/38125-php-ajax-polling-question/#findComment-182929 Share on other sites More sharing options...
Lumio Posted February 12, 2007 Share Posted February 12, 2007 than make an interval of 5 seconds... I also make intervals within only 1 seconds (AJAX-Onlinechat) Link to comment https://forums.phpfreaks.com/topic/38125-php-ajax-polling-question/#findComment-182936 Share on other sites More sharing options...
Wireless102 Posted February 12, 2007 Author Share Posted February 12, 2007 the interval is at 5 seconds now, what i am looking for is that to much of a load on the server, or is that something that will be to much if 100 users are connected at one time? Link to comment https://forums.phpfreaks.com/topic/38125-php-ajax-polling-question/#findComment-182941 Share on other sites More sharing options...
Lumio Posted February 13, 2007 Share Posted February 13, 2007 that's a good question. But I don't think, that it is too much. (I hope so) Link to comment https://forums.phpfreaks.com/topic/38125-php-ajax-polling-question/#findComment-183564 Share on other sites More sharing options...
Wireless102 Posted February 13, 2007 Author Share Posted February 13, 2007 i did have it setup to do the fwrite from a xmlhttprequest, i changed it to be started by a cron job that checks to see if the auction is active and if it is active it starts a looping script that grabs the mysql data and writes the current bid information every second. its all on the server now. thats about the best i can see for efficiency. its going to be running its first (real) live auction in a couple of weeks and i'll see then how efficient it is. I hate to try it in a real environment but that is the only way i can find to get that many people on the auction at one time. Link to comment https://forums.phpfreaks.com/topic/38125-php-ajax-polling-question/#findComment-183953 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.