设置更高的内存限制有哪些潜在问题?
当 php.ini 中的内存限制设置为 100MB 时,可能会遇到哪些潜在问题?
What are the potential problems that could be encountered when the memory limit in php.ini is set to say 100MB?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我只能看到明显的一个:贪婪或损坏的脚本可能会占用您的大量资源。如果多个客户端同时请求这样的脚本,则可能会成为服务器的严重资源问题。
根据您的用例,也许明智的做法是增加每个脚本的内存限制。
I can see only the obvious one: That a greedy or broken script can hog a lot of your resources. If such a script gets requested by multiple clients simultaneously, it could become a serious resource problem for your server.
Depending on your use case, maybe it's wise to increase the memory limit on a per-script basis instead.
在 Linux 上,如果服务器内存不足,它就会开始交换(使用慢速硬盘作为虚拟内存)。
如果交换空间用完,它就会开始半随机地终止进程(算法很复杂并且通常难以预测)。
On Linux, if the server runs out of memory, it starts swapping (using slow hard disk for virtual memory).
If it runs out of swap, it starts killing processes at semi-random (the algorithms are complex and usually hard to predict).