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条)

报告相同问题?

悬赏问题

  • ¥30 YOLO检测微调结果p为1
  • ¥20 求快手直播间榜单匿名采集ID用户名简单能学会的
  • ¥15 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题