You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Baldur Dae <ba...@gmail.com> on 2016/02/25 22:44:56 UTC

Uploading large files

Hi all,
  I have a Primefaces webapp which lets users upload files up to 50MB and
saves posted files into Alfresco (located in another tomcat machine). I've
successfully configured it to avoid Heap exceptions  but it is very slow
and has a huge impact in CPU load.

  Basically, the configuration has involved these steps:
- web.xml (PrimeFaces FileUpload Filter): thresholdSize set to 1MB
- Tomcat: maxPostSize parameter set to 0
- Webapp: saves posted file using InputStream (
http://stackoverflow.com/questions/10326460/how-to-avoid-outofmemoryerror-when-uploading-a-large-file-using-jersey-client
)

How can I improve it? Is it just a hardware problem?

Thanks very much

Re: Uploading large files

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Baldur,

On 2/25/16 4:44 PM, Baldur Dae wrote:
>   I have a Primefaces webapp which lets users upload files up to 50MB and
> saves posted files into Alfresco (located in another tomcat machine). I've
> successfully configured it to avoid Heap exceptions  but it is very slow
> and has a huge impact in CPU load.

If you use Tomcat to upload your files, it should not be using a lot of
CPU, nor should it require a great deal of memory. Tomcat can be
configured to put the in-progress uploading file onto the disk instead
of in memory. There is a size threshold that triggers this to avoid the
foolishness of storing 50MiB of data in the heap during an upload.

>   Basically, the configuration has involved these steps:
> - web.xml (PrimeFaces FileUpload Filter): thresholdSize set to 1MB

PrimeFaces upload filter. This is the component performing the upload,
not Tomcat. Please review the configuration of this filter. Perhaps
there are trade-offs being made.

> - Tomcat: maxPostSize parameter set to 0

Does the PrimeFaces upload filter use POST or something else? (POST is
typical, but it could be a PUT)

> - Webapp: saves posted file using InputStream (
> http://stackoverflow.com/questions/10326460/how-to-avoid-outofmemoryerror-when-uploading-a-large-file-using-jersey-client
> )
>
> How can I improve it? Is it just a hardware problem?

Probably not a hardware problem. The great thing about processes that
are taking a lot of time is that you can take some thread dumps[1] to
see what the process is doing.

-chris

[1]
http://wiki.apache.org/tomcat/HowTo#How_do_I_obtain_a_thread_dump_of_my_running_webapp_.3F

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org