本文介绍了AJAX推送服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我最近写了一个AJAX推脚本,有PHP在后台睡觉,等待有人来进行更新。然而,睡眠进程占用了大量的CPU。我如何能prevent任何想法?我猜我必须要么找到一个程序,它可以做睡觉的线程或写我自己在Python或C ++对此我不是很熟悉。我使用AJAX推动基于浏览器的游戏,让人们可以在实时播放,但我想,如果我在后台将超载的服务器太多睡眠的进程。

Alright, I recently wrote a ajax push script which had php on the backend sleeping while waiting for someone to make an update. However, the sleeping processes took up a lot of cpu. Any ideas on how I can prevent this? I am guessing I will have to either find a program which can do the sleeping with threads or write my own in python or c++ which I am not very familiar with. I am using ajax push for a browser based game so people can play it in real time but I think if I get too many sleeping processes on the backend it would overload the server.

推荐答案

在很多研究昨天晚上,我发现这为服务器端的答案。然后写在客户端的PHP脚本。然后让Ajax调用该函数调用服务器的客户端。唯一的问题是某些扩展,必须手动安装。

After much research last night, I found this as the answer for the server side.Then write a php script for the client side.Then have ajax call the client which calls the server.Only problem is some of the extensions have to be manually installed.

的http:// PHP-MAG。净/ ITR /网上%5Fartikel / psecom,身份证,484,NODEID,114.html

这篇关于AJAX推送服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 21:16