Fixing Memory Issues in Large Excel Export and Import with Apache POI SXSSF
When building admin or B2B back-office systems, Excel download and upload are pretty much required features. In Java, Apache POI is the standard library, and at first I just implemented it with XSSFWorkbook without thinking too much. On local with a few hundred test rows, it worked fine. The problem showed up in production after real data piled up. A user clicked download for tens of thousands of rows, the screen froze for a long time, and the server crashed with OutOfMemoryError: Java heap space....