前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ClickHouse系列--Exception: Memory limit (total) exceeded: would use

ClickHouse系列--Exception: Memory limit (total) exceeded: would use

作者头像
IT云清
发布2021-12-06 14:23:15
2K0
发布2021-12-06 14:23:15
举报
文章被收录于专栏:IT云清IT云清

批量写入clickhouse出错,内存溢出,报错信息如下:

代码语言:javascript
复制
2021-07-20 13:59:14.291  INFO 12719 --- [pool-9-thread-1] c.t.r.c.c.consumer.ClickHouseConsumer    : ------>>>>>>The 10 times write,Receive messages size is 74593
2021-07-20 13:59:24.401  INFO 12719 --- [pool-8-thread-1] c.t.r.c.c.consumer.ClickHouseConsumer    : ------>>>>>>The 9 times write to default.roc_activity_base end.【Assemble takes 10164 ms,Insert takes 6033 ms】
2021-07-20 13:59:46.842 ERROR 12719 --- [pool-9-thread-1] c.t.r.c.c.consumer.ClickHouseConsumer    : The 10 times write,Insert into clickhouse error:ClickHouse exception, code: 241, host: 10.58.10.243, port: 8123; Code: 241, e.displayText() = DB::Exception: Memory limit (total) exceeded: would use 3.33 GiB (attempt to allocate chunk of 4219140 bytes), maximum: 3.33 GiB (version 21.5.6.6 (official build))


ru.yandex.clickhouse.except.ClickHouseException: ClickHouse exception, code: 241, host: 10.58.10.243, port: 8123; Code: 241, e.displayText() = DB::Exception: Memory limit (total) exceeded: would use 3.33 GiB (attempt to allocate chunk of 4219140 bytes), maximum: 3.33 GiB (version 21.5.6.6 (official build))

	at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:58) ~[clickhouse-jdbc-0.2.4.jar:na]
	at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:28) ~[clickhouse-jdbc-0.2.4.jar:na]
	at ru.yandex.clickhouse.ClickHouseStatementImpl.checkForErrorAndThrow(ClickHouseStatementImpl.java:875) ~[clickhouse-jdbc-0.2.4.jar:na]
	at ru.yandex.clickhouse.ClickHouseStatementImpl.sendStream(ClickHouseStatementImpl.java:851) ~[clickhouse-jdbc-0.2.4.jar:na]
	at ru.yandex.clickhouse.ClickHouseStatementImpl.sendStream(ClickHouseStatementImpl.java:824) ~[clickhouse-jdbc-0.2.4.jar:na]
	at ru.yandex.clickhouse.ClickHouseStatementImpl.sendStream(ClickHouseStatementImpl.java:817) ~[clickhouse-jdbc-0.2.4.jar:na]
	at ru.yandex.clickhouse.ClickHousePreparedStatementImpl.executeBatch(ClickHousePreparedStatementImpl.java:335) ~[clickhouse-jdbc-0.2.4.jar:na]
	at ru.yandex.clickhouse.ClickHousePreparedStatementImpl.executeBatch(ClickHousePreparedStatementImpl.java:320) ~[clickhouse-jdbc-0.2.4.jar:na]
	at cn.java4all.core.consumer.consumer.ClickHouseConsumer.onBulkMessage(ClickHouseConsumer.java:88) ~[classes/:na]
	at cn.java4all.core.consumer.consumer.AbstractConsumer.doConsume(AbstractConsumer.java:69) [classes/:na]
	at cn.fraudmetrix.module.kafka.consumer.ConcurrentPoller.lambda$handle$1(ConcurrentPoller.java:98) [module-kafka-3.2.3-20210716.082922-62.jar:na]
	at java.util.concurrent.CompletableFuture$AsyncRun.run$$$capture(CompletableFuture.java:1626) ~[na:1.8.0_211]
	at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java) ~[na:1.8.0_211]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_211]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_211]
	at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_211]
Caused by: java.lang.Throwable: Code: 241, e.displayText() = DB::Exception: Memory limit (total) exceeded: would use 3.33 GiB (attempt to allocate chunk of 4219140 bytes), maximum: 3.33 GiB (version 21.5.6.6 (official build))

	at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:53) ~[clickhouse-jdbc-0.2.4.jar:na]
	... 15 common frames omitted

2021-07-20 13:59:46.843 ERROR 12719 --- [pool-9-thread-1] c.t.r.c.c.consumer.AbstractConsumer      : Consume the message error,topic is roc_dev_api_raw_activity,ClickHouse exception, code: 241, host: 10.58.10.243, port: 8123; Code: 241, e.displayText() = DB::Exception: Memory limit (total) exceeded: would use 3.33 GiB (attempt to allocate chunk of 4219140 bytes), maximum: 3.33 GiB (version 21.5.6.6 (official build))


ru.yandex.clickhouse.except.ClickHouseException: ClickHouse exception, code: 241, host: 10.58.10.243, port: 8123; Code: 241, e.displayText() = DB::Exception: Memory limit (total) exceeded: would use 3.33 GiB (attempt to allocate chunk of 4219140 bytes), maximum: 3.33 GiB (version 21.5.6.6 (official build))

	at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:58) ~[clickhouse-jdbc-0.2.4.jar:na]
	at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:28) ~[clickhouse-jdbc-0.2.4.jar:na]
	at ru.yandex.clickhouse.ClickHouseStatementImpl.checkForErrorAndThrow(ClickHouseStatementImpl.java:875) ~[clickhouse-jdbc-0.2.4.jar:na]
	at ru.yandex.clickhouse.ClickHouseStatementImpl.sendStream(ClickHouseStatementImpl.java:851) ~[clickhouse-jdbc-0.2.4.jar:na]
	at ru.yandex.clickhouse.ClickHouseStatementImpl.sendStream(ClickHouseStatementImpl.java:824) ~[clickhouse-jdbc-0.2.4.jar:na]
	at ru.yandex.clickhouse.ClickHouseStatementImpl.sendStream(ClickHouseStatementImpl.java:817) ~[clickhouse-jdbc-0.2.4.jar:na]
	at ru.yandex.clickhouse.ClickHousePreparedStatementImpl.executeBatch(ClickHousePreparedStatementImpl.java:335) ~[clickhouse-jdbc-0.2.4.jar:na]
	at ru.yandex.clickhouse.ClickHousePreparedStatementImpl.executeBatch(ClickHousePreparedStatementImpl.java:320) ~[clickhouse-jdbc-0.2.4.jar:na]

原因:批量写入时内存不够。 解决:调整扩大可用内存阈值。

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2021-07-20 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档