...
详细说明请参考:高速缓存库
5.7、smartbi-mpp调优配置参考
默认安装完成后的smartbi-mpp配置比较简单,如果需要进行相关的参数调优,可以参考以下示例进行配置安装完成后,如果需要进行相关的参数调优,可以参考以下示例进行配置
5.7.1 config.xml调优参考
调优配置项说明
配置项 | 默认值 | 建议值 | 说明 | |
level | trace | error | 配置日志级别 | |
size | 1000M | 100M | 配置日志文件大小 | |
listen_host | - | 0.0.0.0 | 限制来源主机的请求 <listen_host>::</listen_host> :支持IPv6和IPv4网络 <listen_host>0.0.0.0</listen_host> :不支持IPV6网络 ifconfig 查看 是否有inet6表示是否支持IPV6 | |
keep_alive_timeout | 3 | 300 | 关闭连接之前等待传入请求的秒数, 默认为3秒 注:推荐300,解决大数据了插入时 broken write问题 | |
max_concurrent_queries | 100 | 300 | 最大并发处理的请求数(包含 select,insert 等) Maximum number of concurrent queries | |
query_log | - | - | 配置存储数据库名,表名,分区字段,刷新频率和采集频率等相关信息 建议增加TTL 只保留30天之内数据,减少系统空间占用 1)query_log 2)trace_log 3)query_thread_log 4)query_views_log 5)part_log <ttl>event_date + INTERVAL 30 DAY DELETE</ttl> | |
trace_log | - | - | ||
query_thread_log | - | - | ||
query_views_log | - | - | ||
part_log | - | - | ||
openSSL | - | - | SSL客户端/服务器配置 | |
timezone | - | Asia/Shanghai | 时区配置 | |
database_atomic_delay_before_drop_table_sec | 480 | 0 | 解决删除副本表立马重建会报错的问题 | |
inactive_parts_to_throw_insert | - | 0 | 当表中非活跃部分(未参与合并的部分)数量超过此值时,新插入操作会抛出异常 | MergeTree引擎配置 <merge_tree> <inactive_parts_to_throw_insert>0</inactive_parts_to_throw_insert> <inactive_parts_to_delay_insert>0</inactive_parts_to_delay_insert> <non_replicated_deduplication_window>0</non_replicated_deduplication_window> <execute_merges_on_single_replica_time_threshold>0</execute_merges_on_single_replica_time_threshold> <try_fetch_recompressed_part_timeout>7200</try_fetch_recompressed_part_timeout> <replicated_fetches_http_connection_timeout>1</replicated_fetches_http_connection_timeout> <replicated_fetches_http_send_timeout>0</replicated_fetches_http_send_timeout> <replicated_fetches_http_receive_timeout>0</replicated_fetches_http_receive_timeout> <max_partitions_to_read>-1</max_partitions_to_read> <allow_nullable_key>FALSE</allow_nullable_key> <min_bytes_to_rebalance_partition_over_jbod>0</min_bytes_to_rebalance_partition_over_jbod> <min_marks_to_honor_max_concurrent_queries>0</min_marks_to_honor_max_concurrent_queries> <detach_old_local_parts_when_cloning_replica>TRUE</detach_old_local_parts_when_cloning_replica> <always_fetch_merged_part>TRUE</always_fetch_merged_part> <max_suspicious_broken_parts>10000</max_suspicious_broken_parts> <parts_to_throw_insert>300</parts_to_throw_insert> <parts_to_delay_insert>150</parts_to_delay_insert> <max_delay_to_insert>256</max_delay_to_insert> <max_parts_in_total>100000</max_parts_in_total> <replicated_deduplication_window>100</replicated_deduplication_window> <replicated_deduplication_window_seconds>604800</replicated_deduplication_window_seconds> <max_replicated_logs_to_keep>1000</max_replicated_logs_to_keep> <min_replicated_logs_to_keep>10</min_replicated_logs_to_keep> <prefer_fetch_merged_part_time_threshold>3600</prefer_fetch_merged_part_time_threshold> <prefer_fetch_merged_part_size_threshold>10737418240</prefer_fetch_merged_part_size_threshold> <max_files_to_modify_in_alter_columns>75</max_files_to_modify_in_alter_columns> <max_files_to_remove_in_alter_columns>50</max_files_to_remove_in_alter_columns> <replicated_max_ratio_of_wrong_parts>0.5</replicated_max_ratio_of_wrong_parts> <replicated_max_parallel_fetches_for_host>15</replicated_max_parallel_fetches_for_host> <replicated_can_become_leader>TRUE</replicated_can_become_leader> <zookeeper_session_expiration_check_period>1</zookeeper_session_expiration_check_period> <old_parts_lifetime>480</old_parts_lifetime> <max_bytes_to_merge_at_max_space_in_pool>161061273600</max_bytes_to_merge_at_max_space_in_pool> <max_bytes_to_merge_at_min_space_in_pool>1048576</max_bytes_to_merge_at_min_space_in_pool> <merge_max_block_size>8192</merge_max_block_size> <max_part_loading_threads>16</max_part_loading_threads> </merge_tree> |
inactive_parts_to_delay_insert | - | 0 | 当表中非活跃部分数量超过此值时,新插入操作会被延迟 | |
non_replicated_deduplication_window | - | 0 | 非复制表的去重窗口大小 | |
execute_merges_on_single_replica_time_threshold | - | 0 | 在单个副本上执行合并的时间阈值(秒),超过此值后会在其他副本上执行 | |
try_fetch_recompressed_part_timeout | - | 7200 | 尝试从其他副本获取重新压缩部分的超时时间(秒) | |
replicated_fetches_http_connection_timeout | - | 1 | 副本间通过HTTP获取数据时的连接超时时间(秒) | |
replicated_fetches_http_send_timeout | - | 0 | 副本间通过HTTP发送数据的超时时间(秒) | |
replicated_fetches_http_receive_timeout | - | 0 | 副本间通过HTTP接收数据的超时时间(秒) | |
max_partitions_to_read | - | -1 | 单次查询可读取的最大分区数 (默认-1=无限制) | |
allow_nullable_key | - | FALSE | 是否允许主键或排序键使用Nullable类型 | |
min_bytes_to_rebalance_partition_over_jbod | - | 0 | 在JBOD(多磁盘)配置中,重新平衡分区所需的最小字节数 | |
min_marks_to_honor_max_concurrent_queries | - | 0 | 考虑最大并发查询限制所需的最小标记数 | |
detach_old_local_parts_when_cloning_replica | - | TRUE | 克隆副本时是否分离旧的本地部分 | |
always_fetch_merged_part | - | TRUE | 是否总是从其他副本获取合并后的部分 | |
max_suspicious_broken_parts | - | 10000 | 允许的最大可疑损坏部分数 | |
parts_to_throw_insert | - | 300 | 当表中未合并部分数量超过此值时,新插入操作会抛出异常 | |
parts_to_delay_insert | - | 150 | 当表中未合并部分数量超过此值时,新插入操作会被延迟 | |
max_delay_to_insert | - | 256 | 插入操作的最大延迟秒数 | |
max_parts_in_total | - | 100000 | 表中允许的最大分区数量上限 | |
replicated_deduplication_window | - | 100 | 复制表去重窗口大 | |
replicated_deduplication_window_seconds | - | 604800 | 复制表去重时间窗口(秒) | |
max_replicated_logs_to_keep | - | 1000 | 保留的最大复制日志数 | |
min_replicated_logs_to_keep | - | 10 | 保留的最小复制日志数 | |
prefer_fetch_merged_part_time_threshold | - | 3600 | 超过此时间阈值(秒)后,优先获取合并后的部分 | |
prefer_fetch_merged_part_size_threshold | - | 10737418240 | 超过此大小阈值后,优先获取合并后的部分 | |
max_files_to_modify_in_alter_columns | - | 75 | ALTER COLUMN操作中允许修改的最大文件数 | |
max_files_to_remove_in_alter_columns | - | 50 | ALTER COLUMN操作中允许删除的最大文件数 | |
replicated_max_ratio_of_wrong_parts | - | 0.5 | 允许错误部分的最大比例 | |
replicated_max_parallel_fetches_for_host | - | 15 | 从单个主机并行获取的最大数量 | |
replicated_can_become_leader | - | TRUE | 该副本是否可以成为leader | |
zookeeper_session_expiration_check_period | - | 1 | ZooKeeper会话过期检查周期(秒) | |
old_parts_lifetime | - | 480 | 旧部分保留时间(秒) | |
max_bytes_to_merge_at_max_space_in_pool | - | 161061273600 | 合并任务最大字节数(默认150G) | |
max_bytes_to_merge_at_min_space_in_pool | - | 1048576 | 合并任务最小字节数(默认1M) | |
merge_max_block_size | - | 8192 | 合并操作时的最大块大小 | |
max_part_loading_threads | - | 16 | 加载部分的最大线程数 |
配置示例config.xml:调优的都配置示例在<!-- smartbi begin -->和<!-- smartbi end →之间
...
5.7.2 user.xml调优参考
调优配置项说明
配置项 | 默认值 | 建议值 | 说明 |
background_pool_size | 16 | cpu 线程数的 2 倍 | 后台线程池的大小 允许的前提下建议改成 cpu 线程数的 2 倍 |
background_schedule_pool_size | 128 | cpu 线程数的 2 倍 | 执行后台任务(复制表、Kafka 流、DNS 缓存更新)的线程数 允许的前提下建议改成 cpu 线程数的 2 倍 |
background_distributed_schedule_pool_size | 16 | cpu 线程数的 2 倍 | 设置为分布式发送执行后台任务的线程数 允许的前提下建议改成 cpu 线程数的 2 倍 |
background_fetches_pool_size | 8 | cpu 线程数的 2 倍 | 将用于从后台 *MergeTree 引擎表的另一个副本获取数据部分的最大线程数 |
background_common_pool_size | 8 | cpu 线程数的 2 倍 | 将用于在后台对 *MergeTree 引擎表执行各种操作(主要是垃圾回收)的最大线程数 |
max_threads | 当前服务器CPU核数 | - | 设置单个查询所能使用的最大 cpu 个数 |
max_memory_usage | 0 | 物理内存的*80% | 单次 Query 占用内存最大值,默认为0,表示不限制 该值可以设置的比较大,这样可以提升集群查询的上限,一般留操作系统20%。 |
max_bytes_before_external_group_by | 0 | max_memory_usage*50% | 分组最大内存,当 group 使用内存超过阈值后会刷新到磁盘进行,,默认为0,表示不限制 按照 max_memory_usage 的一半设置内存 |
max_bytes_before_external_sort | 0 | max_memory_usage*50% | 排序最大内存,默认是0表示不限制,但是如果内存不够时直接抛错,设置了该值 order by 可以正常完成,但是速度慢 按照 max_memory_usage 的一半设置内存 |
max_memory_usage_for_user | 0 | 0 | 单个用户在运行查询时,限制使用的最大内存用量,默认值为0,即不做限制 |
max_partitions_per_insert_block | 100 | 1000 | 在单次INSERT写入的时候,限制创建的最大分区个数,默认值为100个 如果超出这个阈值数目,将会得到异常; |
max_rows_to_group_by | 0 | 0 | 在执行GROUP BY聚合查询的时候,限制去重后的聚合KEY的最大个数,默认值为0,即不做限制 当超过阈值数量的时候,其处理方式由group_by_overflow_mode参数决定; |
group_by_overflow_mode | throw | throw | 当max_rows_to_group_by熔断规则触发的时候,有三种处理形式: throw抛出异常,此乃默认值; break立即停止查询,并返回当前部分的数据; any仅以当前已存在的聚合KEY,继续完成聚合查询; |
max_query_size | 262144 | 26214400 | sql语句最大长度,默认是256K 建议设置为25M |
max_ast_elements | 50000 | 10000000 | 查询语法树中的最大元素数,默认值下为50000 建议设置为10000000 |
max_expanded_ast_elements | 50000 | 10000000 | 查询语法树中的最大元素数。默认值下为50000 建议设置为10000000 |
http_receive_timeout | 180 | 3600 | 接收超时时间,适量增大方式插入数据时出现 Broken pipe |
http_send_timeout | 180 | 3600 | 发送超时时间,适量增大方式插入数据时出现 Broken pipe |
配置示例user.xml:调优的都配置示例在<!-- smartbi begin -->和<!-- smartbi end →之间end -->之间
注意 | ||||
---|---|---|---|---|
| 调优参数的配置可以根据实际环境进行调整||||
1、调优参数的配置可以根据实际环境进行调整 2、user.xml的其他调优参数,可以添加添加在<!-- smartbi begin --><!-- smartbi end -->之间 |
代码块 | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0"?> <clickhouse> <profiles> <default> <!-- smartbi begin 数据接收和发送时间,默认180s,适量增大方式插入数据时出现 Broken pipe--> <http_send_timeout>3600</http_send_timeout> <http_receive_timeout>3600</http_receive_timeout> <max_query_size>26214400</max_query_size> <max_ast_elements>10000000</max_ast_elements> <max_expanded_ast_elements>10000000</max_expanded_ast_elements> < <!-- 其他user.xml调优参数添加在此处即可 --> <!-- smartbi end end →--> <load_balancing>random</load_balancing> </default> <readonly> <readonly>1</readonly> </readonly> </profiles> <users><!--用户配置--> <default> <!--用户名--> <password></password> <!--置登录密码 免密码登入,支持明文、SHA256加密和double_sha1加密三种形式--> <networks> <ip>::/0</ip> </networks> <profile>default</profile> <quota>default</quota> </default> </users> <quotas><!--限制资源被过度使用,当使用的资源数量达到阈值时,那么正在进行的操作会被自动中断--> <default><!--自定义名称,全局唯一--> <interval><!--配置时间间隔,每个时间内的资源消耗限制--> <duration>3600</duration><!--表示累积的时间周期,单位是秒--> <queries>0</queries><!--表示在周期内允许执行的查询次数,0表示不限制--> <errors>0</errors><!--表示在周期内允许发生异常的次数,0表示不限制--> <result_rows>0</result_rows> <!--表示在周期内允许查询返回的结果行数,0表示不限制--> <read_rows>0</read_rows><!--表示在周期内在分布式查询中,允许远端节点读取的数据行数,0表示不限制。--> <execution_time>0</execution_time><!--表示周期内允许执行的查询时间,单位是秒,0表示不限制。--> </interval> </default> </quotas> </clickhouse> |
...