文件传输请求最快的方式

Our test shows that the implementation of the chunked requests makes the upload 30% faster.

我们的测试表明,分块请求的实现使上载速度提高了30%。

介绍 (Intro)

I am a front-end software engineer at TransPerfect. TransPerfect is language service / localization company. At TransPerfect, I am mainly working on a file sharing platform called GlobalLink Share (GLShare). GLShare has some outstanding features such as anonymous file sharing, guest file sharing, and unlimited file size sharing. Clients use GLShare to share files

我是TransPerfect的前端软件工程师。 TransPerfect是语言服务/本地化公司。 在TransPerfect,我主要在一个名为GlobalLink Share(GLShare)的文件共享平台上工作。 GLShare具有一些出色的功能,例如匿名文件共享,来宾文件共享和无限的文件大小共享。 客户端使用GLShare共享文件

Recently, I implemented chunked request in GLShare and improves the uploading speed more than 30%. In this article, I want to share my long journey to implement chunked request and what I learned from it.

最近,我在GLShare中实现了分块请求,并将上传速度提高了30%以上。 在本文中,我想分享我实现分段请求的漫长旅程以及从中获得的经验。

Note: It’s developed using Vue.js and the code snippets will be written in Vue.js as well

注意:它是使用Vue.js开发的,代码段也将用Vue.js编写

什么是分块请求(What is Chunked Request)

I believe that many of readers are asking “what is Chunked Request?” I had the same question and did not have any of experiences implementing it at all. According to Wikipedia,

我相信许多读者都在问“什么是分块请求?” 我有同样的问题,完全没有经验。 根据维基百科,

In chunked transfer encoding, the data stream is divided into a series of non-overlapping “chunks”. The chunks are sent out and received independently of one another

在分块传输编码中,数据流分为一系列不重叠的“块”。 块彼此独立地发送和接收

Chunked transfer encoding is like slicing a baguette and throwing out each slices of the baguette one at a time instead of throwing the whole piece

块状传输编码就像将法棍切成薄片,然后一次扔出法棍的每一片,而不是一整块地扔掉

Scalability would not be the issue for throwing the whole piece of baguette in the real life because the baguette weighs only around few grams. But what if the baguette weights 100 pounds? It will be little bit harder to throw it as a whole chunk

可伸缩性并不是现实生活中将整个法式面包扔掉的问题,因为法式面包仅重约几克。 但是,如果法式长棍面包重100磅,该怎么办? 将其整体丢掉会有点困难

But what if, the baguette weighs 100 pounds?

但是,如果法式长棍面包重100磅,该怎么办?

The similar issue happens for uploading large ( > 1GB) file. Larger file size gives more stress for both FrontEnd and Backend to upload it. Memory and Timeout issues are the two most prominent issues that can be caused while uploading large file.

上载较大(> 1GB)文件时也会发生类似问题。 较大的文件大小会给前端和后端带来更大的上传压力。 内存和超时问​​题是上载大文件时可能引起的两个最突出的问题。

  1. Memory issue for uploading large file

    上载大文件的内存问题

Apache and other web servers might start complaining due to the memory usage required if the file size exceeds above 1GB

如果文件大小超过1GB,则由于所需的内存使用量,Apache和其他Web服务器可能会开始抱怨

2. Timeout issue for uploading large file

2.上传大文件超时问题

Uploading a file can take a lot of time. For example, given that a user might have bandwidth in the 100-KBs range, uploading a file around 100MB will take a significant amount of time. Many web servers time out requests after a certain amount of time, which can be as low as 30 seconds, causing the upload to fail

上载文件可能需要很多时间。 例如,假设用户的带宽可能在100 KB范围内,则上载大约100MB的文件将花费大量时间。 许多Web服务器在一定时间后(可能低至30秒)使请求超时,从而导致上传失败

Therefore, it’s more convenient to slice the file and sends the multiple chunked data one at a time

因此,切片文件并一次发送多个分块数据更为方便。

jQuery插件 (jQuery plugin)

There are some good jQuery plugins available for chunked upload. For example, blueimp’s jQuery-File-The-Upload Git repository has many advanced features for uploading file. It provides chunk uploading with maxChunkSizeproperty and I was almost tempted to integrate blueimp’s jQuery plugin into Vue.js codebase

有一些不错的jQuery插件可用于分块上传。 例如,blueimp的jQuery-File-The-Upload Git存储库具有许多用于上传文件的高级功能。 它提供了具有maxChunkSize属性的块上传maxChunkSize ,我几乎想将blueimp的jQuery插件集成到Vue.js代码库中

blueimp’s jQuery-File-The-Upload snippet and maxChunkSize property

blueimp的jQuery-File-The-Upload片段和maxChunkSize属性

$('#fileupload').fileupload({    url: 'https://fs-qa.transperfect.com/fs/car-test',    method: 'POST',    maxChunkSize: 100000000 //suggested chunk size 100mb  });$('#fileupload').bind('fileuploadsubmit', function (e, data) {        data.headers = $.extend(data.headers,        {"car-meta-chunk-file-id": generateFileUniqueIdentifier(data),        "Authorization": "Bearer " + token}        );

I actually tried to integrate its jQuery plugin into Vue.js but I was failed completely

文件传输请求最快的方式_实施块请求并更快地上传大文件30相关推荐

  1. antd upload手动上传_SpringBoot 如何上传大文件?

    最近遇见一个需要上传超大大文件的需求,调研了七牛和腾讯云的切片分段上传功能,因此在此整理前端大文件上传相关功能的实现. 在某些业务中,大文件上传是一个比较重要的交互场景,如上传入库比较大的Excel表 ...

  2. SpringBoot如何上传大文件

    最近遇见一个需要上传超大大文件的需求,调研了七牛和腾讯云的切片分段上传功能,因此在此整理前端大文件上传相关功能的实现. 在某些业务中,大文件上传是一个比较重要的交互场景,如上传入库比较大的Excel表 ...

  3. JavaScript上传大文件并支持中途取消上传

    最近遇见一个需要上传超大大文件的需求,调研了七牛和腾讯云的切片分段上传功能,因此在此整理前端大文件上传相关功能的实现. 在某些业务中,大文件上传是一个比较重要的交互场景,如上传入库比较大的Excel表 ...

  4. Android基础—基于Socket实现上传大文件

    上节中我们给大家接触了Socket的一些基本概念以及使用方法,然后写了一个小猪简易聊天室的 Demo,相信大家对Socket有了初步的掌握,本节我们来学习下使用Socket来实现大文件的断点续传! 这 ...

  5. 快速传输大文件,怎么通过网络传大文件给对方(1G以上)

    在生活和工作中,我们总是要发送一些比较大的文件给别人,或者在自己的设备之间.在互联网日益发达的今天,我们可以用什么方法通过互联网快速传输大文件,发送1G以上的文件? 一.使用QQ传 在电脑上打开QQ, ...

  6. 如何快速地向服务器传大文件,大文件如何快速传输

    在这个互联网时代,信息更新速度逐渐加快.用户在进行文件传输时,一定是希望既稳定又快速的,并且还能够保证安全.但是通常来讲,FTP文件传输并不能同时实现这三点的,特别是上传大文件时,FTP上传文件速度明 ...

  7. QQ上传大文件为什么这么快

    今天和同事在群里讨论"QQ上传大文件/QQ群发送大文件时,可以在极短的时间内完成"是如何做到的. 有时候我们通过QQ上传一个几百M的文件,竟然只用了几秒钟,从带宽上限制可以得出,实 ...

  8. win7计算机之间传输文件,win7电脑与电脑之间怎么传大文件_win7电脑断网时怎么相互传大文件...

    我们一般传送文件,利用qq.微信.邮箱等.如果碰到断网,手头又没有U盘.那么win7纯净版的两台电脑之间如何互传大文件呢?针对怎么在电脑之间快速传送大文件的问题.爱纯净整理了以下的办法,在局域网内可以 ...

  9. 移动端上传大文件到服务器,android上传大文件到服务器地址

    android上传大文件到服务器地址 内容精选 换一换 安装传输工具在本地主机和Windows云服务器上分别安装数据传输工具,将文件上传到云服务器.例如QQ.exe.在本地主机和Windows云服务器 ...

最新文章

  1. liunx上mysql源码安装mysql,搞定linux上MySQL编程(一):linux上源码安装MySQL
  2. C语言文件实验要求,实验教学的目的和要求.doc
  3. Hadoop(Install)
  4. linux 保存编译log,(转)Linux下编译安装log4cxx
  5. (面试)java基础-String一些特性
  6. SAP 序列号与库存关联起来?
  7. 【大吉大利 今晚吃包】002 - array-first
  8. Oracle 基础知识——客户端连接oracle数据库服务端的四种方法
  9. 手把手演示:如何规划一个企业级数据中台
  10. 【Python基础】关于Python的前后、单双下划线作用
  11. 从新获取jar_SpringBoot配置文件放在jar外部
  12. SEO如何快速提高网站排名?
  13. Win10 Redstone再添新技能:深度集成App-V应用虚拟化
  14. 标准代码页(codepage)列表
  15. 游戏挂机计算机自己保护怎么办,游戏中遇到玩家挂机该如何应对?做好这5件事可以降低输的机率...
  16. java前端传汉字到后端出现乱码解决办法
  17. Springboot微信公众号开发入门流程(校验签名、access_token获取、生成带参二维码、发送文字、图文消息、被动回复消息、图文消息静默跳转)
  18. 各型号iPhone的屏幕参数 逻辑分辨率 物理分辨率 - iOS Device Display Summary - 更新到iPhone 13系列
  19. 模块定义图(BDD)
  20. 58子站安居,经纪人营销管理平台登录接口加密逆向

热门文章

  1. 从菜鸟到架构师(二)
  2. linux文件属性644到755,linux:644、755、777权限详解
  3. Axure RP Extension for Chrome安装注意问题
  4. 南开大学,布局深圳!
  5. 二、什么是项目集、项目组合及运营管理
  6. 大数据Hadoop生态圈介绍
  7. 你饿不饿,我给你带了小黄鱼
  8. 解决input在ios存在重影边框问题
  9. 苹果终于不再敷衍,iPhone15性能提升40%,高通彻底跪了
  10. CPU对存储器的读写