连接到 MSSQL 消耗太多内存
Connection to MSSQL consumes too much memory
我在 6.4.0-jre8 版本中使用 mssql-jdbc 驱动程序。
我执行一个简单的 SELECT *
查询,可能 return 数百万行。为了避免 OOM 错误,我定义了 responseBuffering=adaptive
和 fetchSize=10000
。我还确保 ResultSet
是 type_fetch_only
和 concur_read_only
。尽管如此,我仍然收到 OOM 错误。堆大小立即飙升到XMX限制。
下面是内存转储分析。我想知道为什么 TDSPackets 没有被足够早地释放?
对于如何避免 OOM 错误的任何建议,我将不胜感激。谢谢!
问题是我同时在同一个连接上执行多个查询。
Avoid executing more than one statement on the same connection simultaneously. Executing another statement before processing the results of the previous statement may cause the unprocessed results to be buffered into the application memory.
我在 6.4.0-jre8 版本中使用 mssql-jdbc 驱动程序。
我执行一个简单的 SELECT *
查询,可能 return 数百万行。为了避免 OOM 错误,我定义了 responseBuffering=adaptive
和 fetchSize=10000
。我还确保 ResultSet
是 type_fetch_only
和 concur_read_only
。尽管如此,我仍然收到 OOM 错误。堆大小立即飙升到XMX限制。
下面是内存转储分析。我想知道为什么 TDSPackets 没有被足够早地释放?
对于如何避免 OOM 错误的任何建议,我将不胜感激。谢谢!
问题是我同时在同一个连接上执行多个查询。
Avoid executing more than one statement on the same connection simultaneously. Executing another statement before processing the results of the previous statement may cause the unprocessed results to be buffered into the application memory.