[
https://issues.apache.org/struts/browse/STR-3096?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42690
]
AdNovum commented on STR-3096:
------------------------------
Thank you very much for your efforts!
Yes, it is true, I am not sure whether 100K really is better than 4K. But 4K
won't be the best choice in all cases.
I think it works like this:
When uploading a file, struts will store it temporarily to disk if the file is
large. So an internal buffer is needed for the following loop:
1. If not yet at end of socket-stream, read from socket to internal buffer,
until end of stream reached or buffer is full.
2. write contents from internal buffer to disk (and go to back to 1.)
With bufferSize, I can set the size of the internal buffer. With a small
buffer, I will have to go through this loop lots of times, but
I do not waste memory. With a large buffer size, I need a lot of memory, but I
can transfer the data efficiently.
The question is: What is a good size for the internal buffer. It probably
depends on the settings of the two IO systems involved:
networking and disk. We can tune these IO-systems on a per machine level and
need struts to adapt its internal buffer size as well.
To find a good size for our target system, we will have to do tests as soon as
this bug is fixed.
> bufferSize in controller configuration does not work
> ----------------------------------------------------
>
> Key: STR-3096
> URL: https://issues.apache.org/struts/browse/STR-3096
> Project: Struts 1
> Issue Type: Bug
> Components: Core
> Affects Versions: 1.3.9
> Environment: simple struts web application with file-upload feature
> Reporter: AdNovum
> Assignee: Paul Benedict
> Priority: Minor
> Fix For: Pending Review
>
>
> Controller configuration allows to set a buffer size to be used when doing
> file uploads (described in online documentation):
> <controller
> className="..."
> processorClass="..."
> inputForward="true"
> bufferSize="102400"
> >
> ...
> Unfortunately it seems that this value is never propagated to the
> implementation classes (CommonsMultipartRequestHandler, DiskFileUpload and
> FileUploadBase)
> from struts and apache commons-fileupload. So the default buffersize (4K) is
> used which could possibly lead to bad performance (high CPU usage).
> Either the bufferSize should take effect or it should not be available as a
> configuration attribute.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.