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

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

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]

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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值