You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "AdNovum (JIRA)" <ji...@apache.org> on 2007/09/18 11:22:35 UTC

[jira] Created: (STR-3096) bufferSize in controller configuration does not work

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
            Priority: Minor


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.


[jira] Commented: (STR-3096) bufferSize in controller configuration does not work

Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/STR-3096?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42595 ] 

Paul Benedict commented on STR-3096:
------------------------------------

There is a memSize attribute which does get propagated. It determines the size used to retain the files in memory. Is this the attribute you are looking for? Probably not, but I am pointing it out.

Do you know which method could have bufferSize set on?

> 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
>            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.


[jira] Closed: (STR-3096) bufferSize in controller configuration does not work

Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/STR-3096?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Benedict closed STR-3096.
------------------------------

       Resolution: Won't Fix
    Fix Version/s:     (was: Pending Review)

The bufferSize attribute used to be configure BufferedMultipartInputStream, but that class was deprecated in 1.2.x and later removed:

* http://struts.apache.org/1.2.x/api/org/apache/struts/upload/BufferedMultipartInputStream.html
* http://mail-archives.apache.org/mod_mbox/struts-dev/200110.mbox/%3C20011011162817.63944.qmail@icarus.apache.org%3E

Although a worthy suggestion, my investigation shows that byte-buffering implementations may rely on it. The attribute shall remain.

> 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
>
> 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.


[jira] Updated: (STR-3096) bufferSize in controller configuration does not work

Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/STR-3096?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Benedict updated STR-3096:
-------------------------------

    Fix Version/s: 1.3.10

> 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
>            Priority: Minor
>             Fix For: 1.3.10
>
>
> 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.


[jira] Commented: (STR-3096) bufferSize in controller configuration does not work

Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/STR-3096?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42707 ] 

Paul Benedict commented on STR-3096:
------------------------------------

Dave, I am trying to pin-point where bufferSize could be applied. We are using Commons Fileupload to do the parsing. I am unsure what could be set to enact the buffer size. Got any time to help investigate?

> 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.


[jira] Updated: (STR-3096) bufferSize in controller configuration does not work

Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/STR-3096?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Benedict updated STR-3096:
-------------------------------

    Fix Version/s:     (was: 1.3.10)
                   Pending Review
         Assignee: Paul Benedict

> 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.


[jira] Commented: (STR-3096) bufferSize in controller configuration does not work

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/STR-3096?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42688 ] 

Dave Newton commented on STR-3096:
----------------------------------

(Paul: ControllerConfig has the bufferSize.)

Increasing the buffer to 100K isn't going to do what you think it does, though; a buffer that large would probably end up being more CPU-intensive since the underlying IO would probably end up breaking it up into a normal buffer size anyway for writing.

> 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.


[jira] Commented: (STR-3096) bufferSize in controller configuration does not work

Posted by "AdNovum (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/STR-3096?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42687 ] 

AdNovum commented on STR-3096:
------------------------------

To your first question: No, memSize is not what I am looking for. It is definitely bufferSize but bufferSize does not take effect.
To your second question: Sorry, I do not understand what you mean.


> 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.


[jira] Commented: (STR-3096) bufferSize in controller configuration does not work

Posted by "AdNovum (JIRA)" <ji...@apache.org>.
    [ 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.