Uploaded image for project: 'Archiva (Retired)'
  1. Archiva (Retired)
  2. MRM-1469

Uploading large artifacts is dreadfully slow

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.3.4
    • 1.3.5
    • Web Interface
    • None
    • all

    Description

      The performance of the Upload Artifact page is absolutely dreadful.

      Technically this is probably an enhancement, rather than a bug... but it is so bad in current form I'm filing it as a bug.

      The UploadAction class uses what must be the worst copy file
      implementation possible.

      It says:

      FileOutputStream out = new FileOutputStream( new File(targetPath, targetFilename ) );
      FileInputStream input = new FileInputStream( sourceFile );

      try
      {
      int i;
      while ( ( i = input.read() ) != -1 )

      { out.write( i ); }

      out.flush();
      }

      Alternating between reading and writing one bit at a time???? No
      wonder it was taking me over a 1/2 hour to try to upload a simple 150
      MB file (with the CPU locked at 100% utilization). Wow.

      Please replace that implementation with this (or similar):

      BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(new File(targetPath, targetFilename)));
      BufferedInputStream input = new BufferedInputStream(new FileInputStream(sourceFile));
      try
      {
      byte[] buf = new byte[1024];
      int len;
      while ((len = input.read(buf)) > 0)

      { out.write(buf, 0, len); }

      out.flush();
      }

      Tis about 100 orders of magnitude faster.

      Attachments

        Activity

          People

            oching Maria Odea B. Ching
            armbrust Dan Armbrust
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: