douyanjing8287 2012-04-12 15:58
浏览 21
已采纳

PHP处理大型文件上传的理想Web服务器?

I'm in the middle of technically speccing a file uploading API that will be dealing with a lot of large (250MB+) files.

What I want to avoid as much as possible is the web server eating up a whole load of memory during the file upload, which I know to some degree is possible to avoid.

Also, I can't use Flash or Silverlight to split the files, which would probably significantly decrease memory usage.

I understand that PHP is largely dependent on its host web server software for upload performance. With this in mind, is Apache the best one for the job or should I consider nginx or others?

If PHP itself is the largest bottleneck, then would it be worthwhile considering some sort of hybrid solution? And if so, what language would it be?

  • 写回答

3条回答 默认 最新

  • duanmei2805 2012-04-12 16:18
    关注

    Despite what Daniel Ribeiro says, I'd suggest you keep these uploads well away from Apache. You need an event based server (Apache's implementation is good but IMHO not as polished as nginx / lighttpd). The problem is only indirectly going to be memory - it's about the number of clients and bandwidth. Splitting the files isn't really going to help.

    OTOH there's nothing to stop you using nginx to handle the uploads and apache to serve up the rest of the site.

    You'll get a lot of benefit out of tuning the TCP/IP stack to handle LFNs (large congestion window, tcp window scaling).

    I understand that PHP is largely dependent on its host web server software for upload performance

    The performance of uploads is nothing to do with PHP unless you try to implement the upload using raw socket / web socket with PHP at the back end. Indeed it would make sense to invoke a (forking) PHP interpreter from nginx to process the file - since this only is started when the file is uploaded

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序