You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@archiva.apache.org by "Brett Porter (JIRA)" <ji...@codehaus.org> on 2011/04/27 05:00:22 UTC

[jira] Commented: (MRM-1469) Uploading large artifacts is dreadfully slow

    [ http://jira.codehaus.org/browse/MRM-1469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=264853#action_264853 ] 

Brett Porter commented on MRM-1469:
-----------------------------------

Agree that's a bug - I thought we had fixed that by switching to IOUtil already, but I may be thinking of another location.

> Uploading large artifacts is dreadfully slow
> --------------------------------------------
>
>                 Key: MRM-1469
>                 URL: http://jira.codehaus.org/browse/MRM-1469
>             Project: Archiva
>          Issue Type: Bug
>          Components: Web Interface
>    Affects Versions: 1.3.4
>         Environment: all
>            Reporter: Dan Armbrust
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira