600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > java导出excel组件alibaba easyexcel和apache poi性能对比

java导出excel组件alibaba easyexcel和apache poi性能对比

时间:2021-08-20 10:12:42

相关推荐

java导出excel组件alibaba easyexcel和apache poi性能对比

java导出excel组件alibaba easyexcel和apache poi性能对比

背景

开发中出现web页面导出记录到excel导致服务oom奔溃,代码中使用apache poi组件导出,准备使用alibaba easyexcel组件进行优化,所以进行性能测试比较参数如下:

其他参数:导出excel是xlsx文本,20列,单个数据长度10英文字符或数字alibaba easyexcel执行jvm打印

HeapPSYoungGentotal 142336K, used 65723K [0x00000000f5980000, 0x0000000100000000, 0x0000000100000000)eden space 114176K, 56% used [0x00000000f5980000,0x00000000f98a6de8,0x00000000fc900000)from space 28160K, 3% used [0x00000000fc900000,0x00000000fca08000,0x00000000fe480000)to space 28160K, 0% used [0x00000000fe480000,0x00000000fe480000,0x0000000100000000)ParOldGen total 341504K, used 17083K [0x00000000e0c00000, 0x00000000f5980000, 0x00000000f5980000)object space 341504K, 5% used [0x00000000e0c00000,0x00000000e1caee98,0x00000000f5980000)Metaspace used 17673K, capacity 17908K, committed 18048K, reserved 1064960Kclass space used 2073K, capacity 2148K, committed 2176K, reserved 1048576K

apache poi 执行jvm打印

HeapPSYoungGentotal 157696K, used 145408K [0x00000000f5980000, 0x0000000100000000, 0x0000000100000000)eden space 145408K, 100% used [0x00000000f5980000,0x00000000fe780000,0x00000000fe780000)from space 12288K, 0% used [0x00000000fe780000,0x00000000fe780000,0x00000000ff380000)to space 12288K, 0% used [0x00000000ff400000,0x00000000ff400000,0x0000000100000000)ParOldGen total 341504K, used 341325K [0x00000000e0c00000, 0x00000000f5980000, 0x00000000f5980000)object space 341504K, 99% used [0x00000000e0c00000,0x00000000f59536b8,0x00000000f5980000)Metaspace used 11751K, capacity 11862K, committed 12160K, reserved 1060864Kclass space used 1317K, capacity 1367K, committed 1408K, reserved 1048576KException in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceededat org.apache.xmlbeans.impl.store.Saver$TextSaver.resize(Saver.java:1700)at org.apache.xmlbeans.impl.store.Saver$TextSaver.preEmit(Saver.java:1303)at org.apache.xmlbeans.impl.store.Saver$TextSaver.emit(Saver.java:1190)at org.apache.xmlbeans.impl.store.Saver$TextSaver.emitElement(Saver.java:962)at org.apache.xmlbeans.impl.store.Saver.processElement(Saver.java:476)at org.apache.xmlbeans.impl.store.Saver.process(Saver.java:307)at org.apache.xmlbeans.impl.store.Saver$TextSaver.saveToString(Saver.java:1864)at org.apache.xmlbeans.impl.store.Cursor._xmlText(Cursor.java:546)at org.apache.xmlbeans.impl.store.Cursor.xmlText(Cursor.java:2436)at org.apache.xmlbeans.impl.values.XmlObjectBase.xmlText(XmlObjectBase.java:1500)at org.apache.poi.xssf.model.SharedStringsTable.getKey(SharedStringsTable.java:135)at org.apache.poi.xssf.model.SharedStringsTable.addEntry(SharedStringsTable.java:181)at org.apache.poi.xssf.usermodel.XSSFCell.setCellValue(XSSFCell.java:453)at org.apache.poi.xssf.usermodel.XSSFCell.setCellValue(XSSFCell.java:417)at algorithm.cache.excel.poi.ExcelExportUtil.export(ExcelExportUtil.java:117)at algorithm.cache.excel.poi.ExcelExportUtil.main(ExcelExportUtil.java:226)

结论:

开发web后台导出记录10W条,easyexcel可以很好支持,apache poi会出现oom,jvm参数设置不足时可能导致程序崩溃。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。