开发者

Memory footprint for a java application

In our application, we allow users t开发者_如何学Co 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜