Shared-nothing architecture has been widely adopted in various commercial distributed RDBMSs. Thanks to the architecture, query can be processed in parallel and accelerated by scaling up the cluster horizontally on demand. In spite of that, load balancing has been a challenging issue in all distributed RDBMSs, including shared-nothing ones, which suffers much from skewed data distribution. In this work, we focus on one of the representative operator, namely Hash Join, and investigate how skewness among the nodes of a cluster will affect the load balance and eventual efficiency of an arbitrary query in shared-nothing RDBMSs. We found that existing Distributed Hash Join (Dist-HJ) solutions may not provide satisfactory performance when a value is skewed in both the probe and build tables. To address that, we propose a novel Dist-HJ solution, namely Partition and Replication (PnR). Although PnR provide the best efficiency in some skewness scenario, our exhaustive experiments over a group of shared-nothing RDBMSs show that there is not a single Dist-HJ solution that wins in all (data skew) scenarios. To this end, we further propose a self-adaptive Dist-HJ solution with a builtin sub-operator cost model that dynamically select the best Dist-HJ implementation strategy at runtime according to the data skew of the target query. We implement the solution in our commercial shared-nothing RDBMSs, namely KaiwuDB (former name ZNBase) and empirical study justifies that the self-adaptive model achieves the best performance comparing to a series of solution adopted in many existing RDBMSs.
翻译:无共享架构已广泛部署于各类商业分布式关系型数据库。依托该架构,查询可通过水平扩展集群实现并行处理与加速。然而,负载均衡始终是包括无共享架构在内的所有分布式数据库面临的挑战性难题,尤其受数据分布倾斜影响。本研究聚焦代表性算子——哈希连接,探究集群节点间的数据倾斜如何影响无共享数据库中任意查询的负载均衡性与执行效率。我们发现,当探测表与构建表中均存在值倾斜时,现有分布式哈希连接方案可能无法提供令人满意的性能。为此,我们提出新型分布式哈希连接方案——分区与复制。尽管该方案在特定倾斜场景下能实现最优效率,但通过对多组无共享关系数据库的全面实验表明,没有任何单一分布式哈希连接方案能在所有数据倾斜场景中均胜出。针对此问题,我们进一步提出自适应分布式哈希连接方案,其内置子操作符成本模型,可根据目标查询的数据倾斜情况,在运行时动态选择最优的分布式哈希连接实现策略。我们在商业无共享关系数据库KaiwuDB(原名ZNBase)中实现了该方案,实证研究表明,相比现有多种关系型数据库采用的系列解决方案,该自适应模型实现了最优性能。