I'm trying to implement an AJAX script that will be responsible for checking for new data on my MySQL server and updating a list if new data exist. The one solution that I found is to have a timer to checking any given time, which works, but because on my system i'm going to have more than 50 online users at the same time, they will execute this script and I will have an impact on the processing time of my MySQL server. The second solution is to use Comet model but in order to update the A form I have to link somehow the B form to inform the server that new data has been inserted in order for the server to send a response to A form to inform it that new data have been added, which i don't want to link the B form with the server. Is there any different scenario that I can use in order for limiting the processing time, overloading the server ,minimize the performance and not reaching the max MySQL connections on my server for checking for new data.
我正在尝试实现一个AJAX脚本,该脚本负责检查MySQL服务器上的新数据,并在存在新数据时更新列表。我找到的一个解决方案是有一个计时器来检查任何给定的时间,这是有效的,但因为在我的系统上,我将同时有超过50个在线用户,他们将执行此脚本,我将有对MySQL服务器处理时间的影响。第二个解决方案是使用Comet模型但是为了更新A表单,我必须以某种方式链接B表单以通知服务器已插入新数据,以便服务器向A表单发送响应以通知它添加了新数据,我不想将B表单与服务器链接。我是否可以使用任何不同的方案来限制处理时间,使服务器过载,最小化性能并且不到达我服务器上的最大MySQL连接以检查新数据。
Thank you
1 个解决方案
#1
0
If you are using php, use set_time_limit ( int $seconds );
to limit the max execution time of the php script that you will be calling using AJAX. That will also limit the max execution time of the mysql running.
Also, you can use ini_set('max_execution_time', $seconds);
to limit the max execution time
如果您使用的是php,请使用set_time_limit(int $ seconds);限制您将使用AJAX调用的php脚本的最大执行时间。这也将限制运行mysql的最长执行时间。此外,您可以使用ini_set('max_execution_time',$ seconds);限制最长执行时间
#1
0
If you are using php, use set_time_limit ( int $seconds );
to limit the max execution time of the php script that you will be calling using AJAX. That will also limit the max execution time of the mysql running.
Also, you can use ini_set('max_execution_time', $seconds);
to limit the max execution time
如果您使用的是php,请使用set_time_limit(int $ seconds);限制您将使用AJAX调用的php脚本的最大执行时间。这也将限制运行mysql的最长执行时间。此外,您可以使用ini_set('max_execution_time',$ seconds);限制最长执行时间