- changed status to open
Spring MVC: reading long request bodies is awfully slow
For the validation against Swagger the whole request body has to be read. - This is slow because currently it is done by the java.util.Scanner.
Additionally the request body has to be cached as it has to be accessed by Spring MVC again. - This is slow because currently Springs ContentCachingRequestWrapper is used. That wrapper is suboptimal because it only implements the read() method for ServletInputStreams. This is done a million times if the request body has 1MB. - This is further suboptimal as it is backed by a ByteArrayOutputStream which grows its capacity on every single write() by 1 and then copies its current content to a newly created array. This is done a million times if the request body has 1MB.
Comments (3)
-
reporter -
reporter Can be closed.
It was solved last year with this merge: https://bitbucket.org/atlassian/swagger-request-validator/pull-requests/52/issue-69-fasten-reading-the-requests-body/diff
-
- changed status to resolved
Available in v1.3.1
- Log in to comment