服务器文件最大访问频率 [英] Maximum server file access frequency

查看:96
本文介绍了服务器文件最大访问频率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Comet长轮询方法在PHP中创建AJAX推送实现。我的代码涉及使用 file_get_contents()重复读取文件,以检查是否有任何消息要发送给用户。为了减少服务器负载,我使用了两个文本文件;一个包含实际命令,另一个充当更改通知程序,它可以通过0-9进行迭代,或者包含UNIX时间戳。我的问题是,在不使服务器超负荷的情况下,我多久可以访问和读取一个小文件(仅几个字节)?强制实施意味着我可以比每隔几秒钟请求文件更频繁地轮询更改,但是仍然有一定的限制。

I'm trying to create a AJAX push implementation in PHP using a Comet long-polling method. My code involves using file_get_contents() to read a file repeatedly to check for any messages to send to the user. To reduce server load, I'm using two text files; one containing the actual command and one acting as a "change notifier", which either is iterated through 0-9 or contains a UNIX timestamp. My question is, how often can I access and read from a small (only a few bytes) file without overloading the server? The push implementation means that I can poll for changes much more often than requesting a file every few seconds, but there's still must be a limit.

如果有帮助,我正在使用1& 1 Home(Linux)托管计划,这是共享托管。

If it helps, I'm using the 1&1 Home (Linux) hosting plan, which is shared hosting.

推荐答案

假设您运行的是sane os,它将在ram中缓存更改通知程序文件,操作将如此便宜至微不足道。在此之前,PHP将成为瓶颈。

Assuming you're running a sane os which will cache the 'change notifier' file in ram, the operation would be so cheap as to insignificant. PHP would become a bottleneck way before then.

这篇关于服务器文件最大访问频率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆