ClickHouse UDF 运行速度慢问题

一、环境版本

环境版本
docker clickhouse22.3.10.22

二、UDF运行速度时快时慢

udf配置文件xxx_function.xml
type- 可执行类型。如果type设置为executable则启动单个命令。如果设置为,executable_pool则创建命令池。
pool_size- 命令池的大小。可选参数,默认值为16。

<type>executable_pool</type>
<pool_size>60</pool_size>

三、UDF超时

udf配置文件xxx_function.xml
max_command_execution_time- 处理数据块的最大执行时间(以秒为单位)。该设置仅对命令有效executable_pool。可选参数,默认值为10。
command_termination_timeout- 管道关闭后命令应完成的时间(以秒为单位)。此后时间SIGTERM被发送到执行命令的进程。可选参数,默认值为10。
command_read_timeout- 从命令标准输出读取数据的超时时间(以毫秒为单位)。默认值 10000。可选参数。
command_write_timeout- 将数据写入命令 stdin 的超时(以毫秒为单位)。默认值 10000。可选参数。

<max_command_execution_time>120</max_command_execution_time>
<command_termination_timeout>120</command_termination_timeout>
<command_read_timeout>120000</command_read_timeout>
<command_write_timeout>120000</command_write_timeout>

四、完整xml配置

<functions>
    <function>
        <type>executable_pool</type>
        <name>demo_clickhouse_udf</name>
        <max_command_execution_time>120</max_command_execution_time>
        <command_termination_timeout>120</command_termination_timeout>
        <command_read_timeout>120000</command_read_timeout>
        <command_write_timeout>120000</command_write_timeout>
        <pool_size>60</pool_size>
        <return_type>String</return_type>
        <argument>
            <type>UInt64</type>
            <name>argument_1</name>
        </argument>
        <argument>
            <type>UInt64</type>
            <name>argument_2</name>
        </argument>
        <format>JSONEachRow</format>
        <execute_direct>0</execute_direct>
        <command>/usr/bin/java -jar /var/lib/clickhouse/user_scripts/demo_clickhouse_udf-1.0-SNAPSHOT-jar-with-dependencies.jar</command>
    </function>
</functions>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值