磐维标准 JDBC driver获取数据慢 700w数据1小时+
语句:select * from table a;
在gsql中执行explain analyze 30s。
server执行执行会快,但是没有数据fetch的模拟,正确的测试步骤,把700w输出到日志中。肯定会大于30s。
手动写程序测试通过JDBC获取并写入到client 700w数据
connection.setAutoCommit(false);
Statement stmt = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.FETCH_FORWARD);
stmt.setFetchSize(1000);
ResultSet rs = stmt.executeQuery(sql);
connection.setAutoCommit(true);
100w数据100s 200w数据 300w数据OOM
设置fetchsize,磐维的fetchsize使用有限制,要结合autocommit false共同使用
在连接串里配置autocommit也会被程序中的代码覆盖,最好能改在代码中
业务设置了足够大的JAVA memory+业务JDBC处理内存异常机制,会掩盖原来OOM可能存在的隐患,导致程序内存处理的问题隐藏的很深
类似这样的机制:
2024/06/24 09:20:22 http-nio-8080-exec-104_1719192020714_page_content_Project_Task_details_inquiry_report/project.cpt ERROR [standard] Project_Task_details_inquiry_report/project.cpt 服务器压力过大,触发保护机制,请刷新该页面。若您是管理员,还可在智能运维-内存管理-智能释放中更改此项保护机制。
com.fr.web.session.FinePackedException: 服务器压力过大,触发保护机制,请刷新该页面。若您是管理员,还可在智能运维-内存管理-智能释放中更改此项保护机制。
at com.fr.restriction.MemoryAlarmException.createIfEmpty(MemoryAlarmException.java) ~[fine-core-11.0.jar:?]
at com.fr.decision.system.monitor.interrupt.IntellijInterrupt.interruptMemoryOverLoad(IntellijInterrupt.java:74) ~[fine-decision-11.0.jar:?]
at com.fr.decision.system.monitor.interrupt.IntellijInterrupt.interruptIfMeetCondition(IntellijInterrupt.java:52) ~[fine-decision-11.0.jar:?]
at com.fr.decision.system.monitor.EstimateMonitor.interruptIfConditionMet(EstimateMonitor.java:46) ~[fine-decision-11.0.jar:?]
at com.fr.decision.system.monitor.MemoryAlarm.interruptIfConditionMet(MemoryAlarm.java:46) ~[fine-decision-11.0.jar:?]
at com.fr.stable.monitor.MemoryHelper.checkMemoryCondition(MemoryHelper.java) ~[fine-core-11.0.jar:?]
kettle抽取磐维的时候也会有类似问题,需要在kettle连接池中配置defaultAutoCommit false再结合fetchsize