Request Size Limit When Using MultipartHttpServletRequest Spring 3.0

I would like to know what a size limit is if I upload a list of files in one view of a client form using the HTTP multi-page content type. On the server side, I use Spring MultipartHttpServletRequest to process the request. mM questions:

  • There must be different file size restrictions, and a limit to the total size of the request or file size is the only limit, and the request is able to upload 100 files because they are not too large.
  • Run the Spring request shell to read the full request and store it in the JAVA heap memory or store temporary file files to be able to use a large quota.
  • Using reading the httpservlet request in streaming will change the size limit than using the full HTTP request read by the application server right away.
  • What is the bottleneck of this process - the Java heap size, the quota of the file system on which my web server is running, the maximum allowed BLOB size, which DataBase in which I am going to save the file knows? or spring internal constraints?

Related topics that still do not have an exact answer to this question:

+4
source share
1 answer

I looked at the Spring CommonsMultipartResolver code. It uses apache file upload to parse multi-part data. CommonsMultipartResolver set the default buffering threshold to DiskFileItemFactory and uses DiskFileItemFactory to create a FileItem. If Stream is greater than 10kB, FileItem written to disk. You can also change the location of the repository folder to store temporarily downloaded file items.

There should be a different file size limit and the total request size limit or file size is the only limit and the request is capable of downloading 100 files as they are not too big.

I am not the maximum limit on the number of parts in multi-page data you can send, or the Spring CommonsMultipartResolver limit, but since it uses Apache FileUpload, I assume that they should be of the same limit. I used Apache FileUpload (without Spring) to get a multi-page stream larger than 3 GB and consists of 2 files, 20 MB and 3.6 GB. Although, I cannot give you an exact limit, it should be able to handle several GBs of stream.

Run the Spring request wrapper, read the full request, and store temporary files in JAVA heap memory or in the store to be able to use a large quota.

As I explained earlier, CommonsMultipartResolver uses Apache FileUpload. FileItem is created using DiskFileItemFactory , so FileItem temporarily saved to disk. Deaf memory threshol 10kB.

Is using the httpservlet request read in streaming to change the size limit than using the full HTTP request read once by the application server.

Sorry, I canโ€™t answer this. What is the difference between an httpservlet request in streaming and an HTTP request being read at the same time?

What is the bottleneck in this process - the Java heap size, the quota of the file system on which my web server is running, the maximum allowed BLOB size that the database in which I am going to save the file? or Spring internal restrictions?

The total neck of the bottle can be sorted in the following order: File IO <Memory

You can change the size of the Java heap before starting the servlet container. 2 ^ 64 is the theoretical limit for the JVM 64 bit.

For a file system quota, this depends on the file system, for example. FAT32 allows you to have a maximum file size of 4 GB, NTFS 16TB, EX3 16GB-2TB, etc.

According to ibm, the BLOB limit must be 2 GB.

I do not know the inner limit of Spring. But Apache FileUpload should be able to handle multiple GB streams without any problems.

+2
source

Source: https://habr.com/ru/post/1333673/


All Articles