ClickHouse卡夫卡性能

问题描述 投票:3回答:1

继从文档的例子:https://clickhouse.yandex/docs/en/table_engines/kafka/

我创建了卡夫卡引擎和物化视图,将资料一MergeTree表的表。

在这里我表的结构:

CREATE TABLE games (
    UserId UInt32,
    ActivityType UInt8,
    Amount Float32,
    CurrencyId UInt8,
    Date String
  ) ENGINE = Kafka('XXXX.eu-west-1.compute.amazonaws.com:9092,XXXX.eu-west-1.compute.amazonaws.com:9092,XXXX.eu-west-1.compute.amazonaws.com:9092', 'games', 'click-1', 'JSONEachRow', '3');


CREATE TABLE tests.games_transactions (
    day Date,
    UserId UInt32,
    Amount Float32,
    CurrencyId UInt8,
    timevalue DateTime,
    ActivityType UInt8
 ) ENGINE = MergeTree(day, (day, UserId), 8192);


  CREATE MATERIALIZED VIEW tests.games_consumer TO tests.games_transactions
    AS SELECT toDate(replaceRegexpOne(Date,'\\..*','')) as day, UserId, Amount, CurrencyId, toDateTime(replaceRegexpOne(Date,'\\..*','')) as timevalue, ActivityType
    FROM default.games;

在卡夫卡的话题我得到大约每秒150条消息。

一切都很好,一部分的数据更新表中的一个大的延迟,绝对不是实时的。

似乎从卡夫卡发送到表中的数据只有当我达到65536个准备在卡夫卡消费新消息

我应该设置一些特定的配置?

我试图从CLI更改配置:

SET max_insert_block_size=1048
SET max_block_size=655
SET stream_flush_interval_ms=750

但是,有没有改善

我应该改变任何特定的配置? 我应该改变上述配置之前创建的表?

apache-kafka clickhouse
1个回答
5
投票

有关于ClickHouse github上这个问题 - https://github.com/yandex/ClickHouse/issues/2169

基本上你需要设置max_block_size(http://clickhouse-docs.readthedocs.io/en/latest/settings/settings.html#max-block-size)在创建表之前,否则将无法正常工作。

我用压倒一切users.xml中的解决方案:

<yandex>
    <profiles>
        <default>
           <max_block_size>100</max_block_size>
        </default>
    </profiles>
</yandex>

我删除了我的表和数据库,并重新创建它们。它为我工作。现在可以得到表每100个记录更新。

© www.soinside.com 2019 - 2024. All rights reserved.