并发AJAX文件上传限制 [英] Concurrent AJAX file upload LIMIT

查看:193
本文介绍了并发AJAX文件上传限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用XMLHttp 2进行多个文件上传,以上传我的文件.执行此操作时,如果我一个接一个地上传文件(通过ajax请求发送文件并等待其完成后再发送)接下来,依此类推),上传器效果很好.但是,当我通过使用并发ajax请求并发上载多个文件来上传多个文件时,浏览器挂起.这是性能比较,

I'm doing multiple file uploader to upload my files by using XMLHttp 2. When i'm doing this, if i upload the files one by one (by sending a file through an ajax request and waiting it to complete before sending the next and so on), the uploader works well. But when i upload multiple files by using concurrent ajax requests to upload multiple files concurrently, the browser hangs down. Here is the performance comparison,

那么浏览器可以同时处理的上传文件大小 AJAX请求数没有最大限制吗?

So is there any maximum limit for UPLOAD FILE SIZE or NUMBER OF AJAX REQUESTS that the browser can handle concurrently?

注意:红色数字表示Firefox(使用firebug)上传所有文件所花费的总上传时间.在并行上传中,由于所有上传同时发生,因此我花费了最大的文件所消耗的时间,该文件最后结束了.

Note: That red numbers shows the total upload time in that the Firefox(using firebug) consumes to upload all the files. In parallel upload, since all uploads happening concurrently, i took the time consumed by the largest file which ended at last.

推荐答案

并发上载的数量没有理论上的最大值(除非浏览器构建者明确地将其放入其中).

There's no theoretical maximum for the number of concurrent uploads (unless the browser builders put one in explicitly).

但是,实际上,由于带宽阻塞,在并发两次或三个并发上传后,上传速度性能会显着下降,但非常低的延迟除外,因为tcp窗口限制了单个上传的最大速度.

However, in practice, upload speed performance drops significantly after two or three concurrent uploads due to bandwidth choking, with the exception of very low latency whereby the tcp window limits the maximum speed of a single upload.

我建议将并发限制设置为2,特别是如果您要为带宽可能变化的外部用户提供此限制.另外,您也可以进行速度基准测试,并根据测得的上传性能调整并发级别.

I would recommend setting a concurrency limit of 2, especially if you're providing this to external users whose bandwidth may vary. Alternatively, you could do speed benchmarking as well, adapting the concurrency level based on measured upload performance.

这篇关于并发AJAX文件上传限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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