In our application, we allow users to upload/download data through an excel sheet and we use Apache POI to read and write these excel sheets.
We were planning to migrate all our xls sheets to xlsx, but came to know during the process that the memory footprint of XSSF(for xlsx) through Apache POI is significantly high.
As a result, we wanted to stress test this, and verify that moving to xlsx won’t give us frequent OutOfMemory exceptions. Any pointers, on how we can effectively record the memory footprints, while we stress test this functionality with larger excel(xlsx) files.
Thanks!
A simple approach is to use a tool such as jconsole
or jvisualvm
(which is shipped with the JVM) to manually monitor the memory consumption.
You could also periodically use the runtime
API to measure memory consumption.
As @Johan mentioned, you can use a profiler or leverage some combination of the methods maxMemory,
totalMemory,
and freeMemory
from the Runtime
. If those results indicate that memory footprint is indeed a problem, Apache POI does offer another option with lighter footprint for XSSF. It's harder to use, so I wouldn't recommend using it unless your profiling results indicate that you have to, but it could help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With