| 引用本文: | 袁巩生,杜晨路,朱阅岸,陈育兴,唐秀,姚畅,陈刚.JIT编译技术在可插拔存储引擎数据库中的应用.软件学报,2026,37(3):1225-1239 |
| |
|
| |
|
|
| 本文已被:浏览 688次 下载 732次 |
 码上扫一扫! |
|
|
| JIT编译技术在可插拔存储引擎数据库中的应用 |
|
袁巩生1,2, 杜晨路1, 朱阅岸3, 陈育兴4, 唐秀1,2, 姚畅1,2, 陈刚5
|
|
1.浙江大学 软件学院, 浙江 宁波 315100;2.杭州高新区(滨江)区块链与数据安全研究院, 浙江 杭州 310059;3.嘉应学院 计算机学院, 广东 梅州 514215;4.深圳市腾讯计算机系统有限公司, 广东 深圳 518063;5.浙江大学 计算机科学与技术学院, 浙江 杭州 310027
|
|
| 摘要: |
| 数据库系统作为数据存储与处理的基础设施, 其性能对现代社会的运行效率具有重要影响. 随着内存技术的进步及SSD (solid state drive)的广泛应用, 磁盘数据库的性能瓶颈逐渐转向CPU的利用率和内存管理的优化. 现代数据库系统通常采用解释执行的方式处理查询, 造成了大量虚函数调用、上下文切换和高速缓存未命中, 不能充分发挥现代CPU的流水线和缓存机制, 导致低效的查询执行效率, 尤其是在大数据量和复杂查询的场景中表现更为明显. 为了解决上述问题, 针对传统数据库解释执行提供若干JIT (just-in-time)编译优化方案, 并在MySQL数据库中进行验证. 首先给出利用LLVM (low level virtual machine)编译器将SQL谓词在运行时转换为机器码的方案代替解释执行, 以减少虚函数调用和系统上下文切换的开销. 接着提出混合编译与解释执行的方案, 扩展了JIT编译执行的适用范围. 最后针对日益流行的可插拔数据库系统架构设计了一种将JIT机器码推送至存储引擎层的查询下推方案, 避免不必要的数据传输和计算开销. 实验结果表明, 启用JIT编译后, MySQL的查询性能显著提升, 尤其在处理复杂查询和大数据量的场景, JIT编译系统能够有效降低解释执行带来的开销, 显著提高系统的响应速度和吞吐量. 在类TPC-H的测试中, 对比原生MySQL, 采用JIT编译执行的系统性能提升可达148%. |
| 关键词: JIT编译 混合编译执行 查询优化 谓词下推 可插拔架构优化 |
| DOI:10.13328/j.cnki.jos.007467 |
| 分类号:TP311 |
| 基金项目:国家重点研发计划(2023YFC3603103); 浙江省“尖兵领雁+X”研发攻关计划(2024C01019) |
|
| Applications of JIT Compilation Technology in Databases with Pluggable Storage Engines |
|
YUAN Gong-Sheng1,2, DU Chen-Lu1, ZHU Yue-An3, CHEN Yu-Xing4, TANG Xiu1,2, YAO Chang1,2, CHEN Gang5
|
|
1.School of Software Technology, Zhejiang University, Ningbo 315100, China;2.Hangzhou High-tech Zone (Binjiang) Institute of Blockchain and Data Security, Hangzhou 310059, China;3.School of Computer Science, Jiaying University, Meizhou 514215, China;4.Shenzhen Tencent Computer System Co. Ltd., Shenzhen 518063, China;5.College of Computer Science and Technology, Zhejiang University, Hangzhou 310027, China
|
| Abstract: |
| Database systems serve as the foundational infrastructure for data storage and processing, with their performance playing a critical role in the efficiency of modern society. With the advancement of memory technologies and the widespread adoption of SSDs (solid state drives), the performance bottleneck in disk-based databases has shifted towards optimizing CPU utilization and memory management. However, current database query execution often relies on interpreted methods, leading to numerous virtual function calls, context switches, and cache misses. This limits the ability of modern CPUs to fully utilize their pipelines and cache mechanisms, resulting in inefficient query execution, particularly in scenarios involving large datasets and complex queries. To address these issues, this study proposes several just-in-time (JIT) compilation optimization strategies for traditional interpreted database execution, validated through experiments on MySQL. First, an approach is presented wherein the LLVM (low level virtual machine) compiler is used to convert SQL predicates into machine code at runtime, replacing the interpretation method to reduce the overhead of virtual function calls and context switching. Next, a hybrid compilation and interpretation approach is introduced to extend the applicability of JIT execution. Finally, a query pushdown strategy is designed for pluggable database system architectures, enabling the transfer of JIT-compiled machine code to the storage engine layer to reduce unnecessary data transfer and computational overhead. Experimental results show that enabling JIT compilation significantly enhances MySQL’s query performance. Notably, for complex queries and large datasets, the JIT-compiled system reduces CPU load and memory usage, leading to substantial improvements in system response speed and throughput. In TPC-H-like tests, compared to the native MySQL version, the optimized system shows performance gains of up to 148%. |
| Key words: just-in-time (JIT) compilation hybrid compilation and execution query optimization predicate pushdown pluggable architecture optimization |
|
|
|
|