Performance improvement on Streams
----------------------------------

                 Key: VFS-267
                 URL: https://issues.apache.org/jira/browse/VFS-267
             Project: Commons VFS
          Issue Type: Improvement
    Affects Versions: 1.1
         Environment: Any
            Reporter: Oliver Haider
            Priority: Minor


Using sftp over streams is quite slow, but changing some Default-Buffersizes 
increased the performance.

Adust the the super-call in 
   org.apache.commons.vfs.util.MonitorInputStream
   org.apache.commons.vfs.util.MonitorOutputStream
and the function 
   org.apache.commons.vfs.FileUtil.writeContent

to a default size of 32*1024bytes, that seems to be the sweet point.
Some Date: Filetransfer sftp remote to local 330MB took 383 seconds without 
adjustment and 36 seconds afterwards, so it't worth patching.

    public MonitorInputStream(final InputStream in)
    {
        // ohaider increase buffer from 1024 to 32*1024 bytes for better 
performance on large files
        super(in,32*1024);
        count = 0;
    }


    public MonitorOutputStream(final OutputStream out)
    {
        // ohaider increase buffer from 1024 to 32*1024 bytes for better 
performance on large files
        super(out,32*1024);
    }


org.apache.commons.vfs.FileUtil.writeContent

    public static void writeContent(final FileObject file,
                                    final OutputStream outstr)
        throws IOException
    {
        final InputStream instr = file.getContent().getInputStream();
        try
        {
            // ohaider increase buffer from 1024 to 32*1024 bytes for better 
performance on large files
            final byte[] buffer = new byte[32*1024];

cheers

oliver

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to