不同于其它服务组件,Presto 对配置项采取严格校验的策略,只要配置项的变更没有通过 Presto 校验(例如配置项的名称或值不能被识别、配置项冗余等),都会导致服务无法正常启动。因此在变更配置前,您需要仔细检查配置项是否正确,一旦出现因为服务参数变更导致的服务启动异常可以先回滚操作,检查正确后再重新配置。
通常 keystore 证书的变更对用户而言是透明,平台会在每次启动 Presto 服务时校验 keystore 证书的有效性,如果出现如下情况将会重新生成新的 keystore 证书:
如果您是将 keystore 证书文件拷贝到其它节点或本地使用,当 keystore 证书被刷新后需要您主动同步更新后的 keystore 证书文件。
当集群级别内存限制耗尽时会出现此问题,解决方法是调大 query.max-memory
参数值。该参数是集群级别的限制,表示查询可以在所有节点上聚合的最大内存。
解决方法是将参数 query.max-memory-per-node
值增加到工作节点所在实例内存的 40%,该参数决定查询可以在节点上使用的最大内存。
以下是避免内存问题的建议:
Presto 在 LAS 版本引入了多项优化,包括:Broadcast Join 策略优化和 Reorder Join 优化,能够提升 Join 相关的查询性能;Metastore Client 连接复用,节省查询计划耗时;分区字段 Filter Predicate 消除,加速查询过滤操作等等。本文为您介绍详细优化内容。
整体说明 | Config | Session | Default | Comment |
---|---|---|---|---|
Table rowcount 统计fallback HDFS 和缓存优化 | hive.metastore-cbo-cache.enabled | 无 | false | cbo cache 开关 |
hive.metastore-cbo-cache.cache-ttl | 无 | 60m | cbo cache ttl | |
hive.metastore-cbo-cache.max-entries | 无 | 10000 | cbo cache max entries | |
hive.table-statistics-fallback-hdfs-enabled | hive.statistics_fallback_hdfs_enabled | false | hms fallback 开关 | |
hive.hdfs-statistics-timeout | hive.hdfs_statistics_timeout | 30 | The timeout for getting table statistics(rowcount) from hdfs, unit: seconds | |
hive.file-statistics-sample-size | hive.file_statistics_sample_size | 5 | 统计 Partition 行数时文件采样大小 | |
Broadcast Join 选择策略优化 | use-broadcast-join-first | use_broadcast_join_first | false | 在 DetermineJoinDistributionType 基础上与join_distribution_type=AUTOMATIC 结合使用,两表 join 时,只要包含小表就会选择 Broadcast |
Join 顺序优化 | optimizer.enable-emr-reorder-joins | emr_reorder_joins | false | 优化 join 顺序,与join_reordering_strategy=AUTOMATIC 结合使用,能够尽早过滤数据,减少中间结果传输 |
连接复用,避免了建立连接的开销,优化了Plan Time
config: hive.metastore.connection-pool-enabled=false hive.metastore.connection-pool-min-size=1 hive.metastore.connection-pool-refresh-interval=120s hive.metastore.connection-pool-life-span=1200s
修复了 hadoop configuration 在代码中没有复用的问题
where 子句中如果分区字段的 filter 条件包含某些函数计算,会导致这些 filter 条件在 table scan 时重复计算。通过将这些分区字段的 filter 进行消除,减少在分区过滤后,还会对分区内的所有分区字段进行row by row 的计算。
session: set session enable_partition_predicate_eliminate=true;
在与 HDFS 存算分离的场景(Presto 与 HDFS 分开部署在不同节点)开启开关后可以减少 HDFS NameNode 访问提升性能。
config: hive.location-unaware-directory-listing=false session: Set session hive.location_unaware_directory_listing=false;