GitHub user mobreza opened a pull request:
https://github.com/apache/poi/pull/141
Super-streaming SXSSF
https://bz.apache.org/bugzilla/show_bug.cgi?id=63100
SXSSF works as designed and manages a small memory footprint when
generating large files from a database. But it only writes data to an output
stream once everything has been written to SXSSF. This is problematic when used
in web applications:
In our use case (our website allows users to generate Excel from the
database), generating the SXSSF on the server takes about 5 minutes. Most
clients give up within a minute (or the browser does it automatically), or the
proxy times out due to no data being sent. Some users also retry the download
request. A new request for download is initiated (while the server is busy
generating the SXSSF for a client that already gave up). This can potentially
lead to DOS.
To work around this issue, I've implemented a super-streaming version of
SXSSF, a `SuperSXSSF`, that relies on `rowWriter` callback to generate row data.
With this approach our service is able to stream the generated Excel
directly to the client and, best of all, is terminated in case the user cancels
the download request.
The `SuperSXSSF` prevents both download timeouts and potential DOS, while
allowing developers all other XSSF actions (i.e. define styles) that don't take
much processing time.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/mobreza/poi super-sxssf
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/poi/pull/141.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #141
----
commit 3f34d92ed7fc63d86544b3a31346ece6b3c5ff53
Author: Matija Obreza <matija.obreza@...>
Date: 2019-01-23T01:29:26Z
Super-streaming SXSSF
----
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]