DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23863>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23863

redirect uses unbuffered FileOutputStream -> bad performance when accessing networked 
Windows Shares

           Summary: redirect uses unbuffered FileOutputStream -> bad
                    performance when accessing networked Windows Shares
           Product: XalanJ2
           Version: 2.5Dx
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan.lib.Redirect
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


The code for the redirect extension creates an unbuffered FileOutputStream. This 
results in very 
bad performance when accessing networked Windows shares.

For a test, I patched the source in org.apache.xalan.lib.Redirect.java in line 449 to 
read:

transformer.createSerializationHandler(new StreamResult( new 
java.io.BufferedOutputStream( 
ostream )), format);

i.e. I wrapped the FileOutputStream with a BufferedOutputStream.

An example I conducted resulted in the following performance figures:
Xalan 2.5.1 (no patch): 33s
Xalan 2.5.1 (w/ my patch applied): 2s

In these cases, the destination for redirect was a networked Windows share, not a 
local drive. The 
wrapping seems to dramatically decrease communication overhead with the networked 
destination 
machine.

I suggest wrapping FileOutputStream()s created by redirect and possible other 
locations in Xalan's 
code by a BufferedXXX() implementation to improve performance over networks.

[Disclaimer: The patch above was only done here locally to investigate the issue, it 
is not intended 
to be the final patch applied as I am not fluent with Xalan internal code structure 
and flow path.]

-- Christian

Reply via email to