1

My program generate some Excel using apache POI.

This part take up 50% of CPU for 1 excel..

If users generate at the same time multiple excel the server is out...

How can i reduce it ?

            final Workbook workbook = new HSSFWorkbook();
            initDataFormat(workbook);

            EnumMap<BomXlsSheetEnum, Sheet> sheetMap = sheetMap = BomXlsSheetEnum.getSheetMap(workbook);

            buildBomSheet(sheetMap, bom, productModelIds, listSizes, false);

            workbook.write(response.getOutputStream());
Alexandre
  • 105
  • 1
  • 2
  • 7
  • 2
    At first determine what exactly is that much resource consuming. Then optimize the code behind either `initDataFormat` or `BomXlsSheetEnum.getSheetMap` or `buildBomSheet`, dependent on your results from the first step. – Axel Richter Jan 19 '18 at 11:42
  • This method create just the excel. With createRow createCell etc.. I don't know how i can do that otherwise.. Any tricks to reduce memory consumption / cpu consumption with the POI library ? – Alexandre Jan 19 '18 at 13:05
  • Use profiler such as yourkit or visualvm – ThomasEdwin Jan 20 '18 at 11:12

0 Answers0