title: Spring boot upload zip files slow
body: <p>I am using Spring boot upload files to server.I found something weird.when I upload a Jpg file with 4.88MB ,it takes 8.47s,but a 3.16M zip file,it takes about 1.3min. Considering this compressed file contains over 900 small files. I changed another zip file contains 10 small files.Now it takes 33.96s to transfer data even this new zip file is 6.52M,more lager then the old.</p>
  
  <p>So does the number of files in the zip file affect the upload speed? If so, why?</p>
  
  <p>application.yml:</p>
  
  <pre><code>spring:
    http:
      multipart:
        enabled: true
        max-file-size: 20MB
  </code></pre>
  
  <p>java:    </p>
  
  <pre><code>@RequestMapping("/changeMainAttachment")
  @ResponseBody
  public Object addChangeMainAttachment(@RequestParam("changeMainAttachment[]") MultipartFile[] files){
      String fileSavePath = gunsProperties.getFileUploadPath();
      for (MultipartFile multipartFile : files) {
          String fileName = UUID.randomUUID() + "#_#_#" + multipartFile.getOriginalFilename();
          try {
  
              logger.info("file uploaded to: " + fileSavePath + fileName);
              multipartFile.transferTo(new File(fileSavePath + fileName));
          } catch (Exception e) {
              throw new BusinessException(BizExceptionEnum.UPLOAD_ERROR);
          }
  
      }
      return new Msg();   
  
  }
  </code></pre>
  
  <p>At the front side,I use <a href="http://plugins.krajee.com/file-input" rel="nofollow noreferrer">Bootstrap File-input</a></p>
  
  <p>js:</p>
  
  <pre><code>initFileInput: function(select,_url,_showZone,_async,befordUpload,afterUploaded){
          var i = $(select).fileinput({
              theme: "gly",
              uploadUrl: _url,
              dropZoneEnabled: _showZone,
              uploadAsync: _async,
              showUpload: true,
              showUploadedThumbs: true,
              maxFileSize: 20*1024,
              maxFileCount: 5, 
              msgFilesTooMany: "选择上传的文件数量({n}) 超过允许的最大数值{m}！",
              hideThumbnailContent: true // hide image, pdf, text or other content in the thumbnail preview
          });
          if(befordUpload &amp;&amp; typeof befordUpload == 'function'){
              i.on('filebatchpreupload',befordUpload);
          }
          if(afterUploaded &amp;&amp; typeof afterUploaded == 'function'){
              i.on('filebatchuploadcomplete',afterUploaded);
          }
  
  
      }
  </code></pre>
  
  <p>I call this method by the following way</p>
  
  <pre><code>ChangeAdd.initFileInput("#changeMainAttachment", /change/changeMainAttachment", true, true, ChangeAdd.fileBeforeUpload, ChangeAdd.fileAfterUploaded);
  </code></pre>