基于钢铁物流数据的索引与查询技术研究

打开文本图片集
摘要:随着钢铁物流的数字化转型发展,钢铁物流数据的规模也迎来快速增长,传统的关系型数据库已无法满足海量钢铁物流数据的存储与查询需求.考虑分布式 NoSQL (Not Only Structured Query Language)数据库具有扩展简单、读写速度快且成本低的特点,本文利用分布式云存储与 NoSQL 技术,对海量钢铁物流数据进行存储并构建索引,以提高对物流数据的存储能力与查询性能.首先,利用 Spark 对不同来源的数据进行关联与融合,再将货运平台产生的历史数据与实时数据分级存储管理;然后,针对钢铁运输中主要涉及的3类查询构建时空索引和属性索引,实现对多源物流数据的高效查询;最后,基于钢铁物流真实数据的实验结果表明,本文所提出的方案在数据写入、存储和查询等方面优于传统关系型数据库的索引查询方法,能够有效支撑海量物流数据的存储和查询.
关键词:钢铁物流数据; 分布式数据库; 时空索引; 查询
中图分类号: TP311 文献标志码: A DOI:10.3969/j.issn.1000-5641.2022.05.016
Indexing and query technology for steel logistic data
ZOU Tao, QIANRongtao, MAO Jiali
(School of Data Science and Engineering, East China Normal University, Shanghai 200062, China)
Abstract: With digital transformation and the development of iron and steel logistics, the scale of iron and steel logistic data has rapidly expanded, and traditional relational databases can no longer meet the storage and query needs. Considering that a distributed not only structured query language (NoSQL) database has a simple expansion capability, fast reading and writing speeds, and low cost, in this study, distributed cloud storage and NoSQL technologies are used to store and build indexes for massive steel logistic data, improving the accuracy of the storage capacity and query performance of the logistic data. First, Spark is used to associate and fuse the data from different sources, and then store and manage the historical and real-time data generated by the freight platform in a hierarchical manner. It then builds spatiotemporal and attribute indexes for the three types of queries mainly involved in steel transportation to achieve an efficient query of multi-source logistic data. Finally, the experimental results based on real steel logistic data show that the proposed scheme is superior to traditional relational database methods in terms of data writing, storage, and querying, and can effectively support the storage and querying of massive logistic data.
Keywords: steel logistic data; HBase; spatio-temporal index; query
0 引言
随着大数据时代的发展,钢铁物流也迎来了数字化转型,越来越多的网络货运平台应运而生,由此产生了大规模的多源物流数据.这些数据作为网络货运平台的基础,为司机画像、车货匹配、车辆调度以及运输监控等关键任务提供支撑,因此,研究面向物流数据的索引与查询是极为重要的.
然而,使用传统的关系型数据库对物流数据进行管理面临一系列挑战.首先,货运数据类型繁多且来源复杂.以山东省某钢铁集团下属的物流企业—京创智汇物流科技有限公司(以下简称京创)为例,在其研发的网络货运平台上每天产生的数据类型包括购买和销售场景中的订单数据,仓储场景中的库存数据,运输场景中的运单数据和轨迹数据等.然而,京创在使用关系型数据库管理这些数据时,对不同场景中的数据存储在不同表中管理,仅在每列数据上构建索引,并不能直接满足物流数据复杂查询的需求.这体现在:①对于不同表中数据的连接查询是最常用的查询类型之一,京创通过多表连接构建宽表的方式来完成连接查询,这导致了大量的冗余查询与计算,从而影响查询性能;②面对以轨迹数据为代表的时空数据的快速更新与动态增长,传统关系型数据库由于存储容量和平台可扩展性的影响,无法很好应对海量时空数据的存储与查询.例如,随着单表中轨迹数据的增长,仅通过 B 树索引会存在大量冗余计算,使得时空查询性能随着数据的增多而降低.而选择各类 R 树进行索引则存在频繁插入导致 R 树分裂,更新索引开销过大的问题.综上所述,面向钢铁物流数据,进行数据融合,并设计合理的存储方式、高效的索引与查询方案是亟待解决的实际问题.表1给出该货运平台货运物流数据量情况,可以发现轨迹数据总量最大、相应的增长速度也最大.随着业务的增多和对更高质量(采样间隔更低)轨迹的需求,轨迹数据的增长速度会大大提高.而京创现行的管理方式无法很好管理这些仍在快速增长的轨迹数据。(剩余15221字)