Exploiting Structure in Regular Expression Queries

Author:

Zhang Ling1ORCID,Deep Shaleen2ORCID,Floratou Avrilia3ORCID,Gruenheid Anja4ORCID,Patel Jignesh M.1ORCID,Zhu Yiwen5ORCID

Affiliation:

1. University of Wisconsin-Madison, Madison, WI, USA

2. Microsoft Gray Systems Lab, Madison, WI, USA

3. Microsoft Gray Systems Lab, Sunnyvale, CA, USA

4. Microsoft Gray Systems Lab, Zurich, Switzerland

5. Microsoft Gray Systems Lab, Redmond, WA, USA

Abstract

Regular expression, or regex, is widely used to extract critical information from a large corpus of formatted text by finding patterns of interest. In tasks like log processing, the speed of regex matching is crucial. Data scientists and developers regularly use regex libraries that implement optimized regular expression matching using modern automata theory. However, computing state transitions in the underlying regex evaluation engine can be inefficient when a regex query contains a multitude of string literals. This inefficiency is further exasperated when analyzing large data volumes. This paper presents BLARE, Blazingly Fast Regular Expression, a regular expression matching framework that is inspired by the mechanisms that are used in database engines, which use a declarative framework to explore multiple equivalent execution plans, all of which produce the correct final result. Similarly, BLARE decomposes a regex into multiple regex and string components and then creates evaluation strategies in which the components can be evaluated in an order that is not strictly a left-to-right translation of the input regex query. Rather than using a cost-based optimization approach, BLARE uses an adaptive runtime strategy based on a multi-armed bandit approach to find an efficient execution plan. BLARE is also modular and can be built on top of any existing regex library. We implemented BLARE on four commonly used regex libraries, RE2, PCRE2, Boost Regex, and ICU Regex, and evaluated it using two production workloads and one open-source workload. BLARE was 1.6× to 3.7× faster than RE2 and 3.4× to 7.9× faster than Boost Regex. PCRE2 did not finish on one of the workloads, but on the remaining two workloads, BLARE improved the performance of PCRE2 by 3.1× to over 100×. For the open-source dataset, BLARE provided a speed up of 61.7× for ICU Regex. BLARE code is publicly available at https://github.com/mush-zhang/Blare.

Funder

National Science Foundation

Publisher

Association for Computing Machinery (ACM)

Reference105 articles.

1. Alfred V. Aho and Margaret J . Corasick . 1975 . Efficient string matching: an aid to bibliographic search. Commun. ACM , 18, 6, (June 1975), 333--340. doi: 10.1145/360825.360855. 10.1145/360825.360855 Alfred V. Aho and Margaret J. Corasick. 1975. Efficient string matching: an aid to bibliographic search. Commun. ACM, 18, 6, (June 1975), 333--340. doi: 10.1145/360825.360855.

2. Exscind: Fast pattern matching for intrusion detection using exclusion and inclusion filters

3. Deterministic Finite Automaton for scalable traffic identification: The power of compressing by range

4. Rafael Antonello , Stenio Fernandes , Djamel Sadok , Judith Kelner , and Géza Szabó . 2015. Design and optimizations for efficient regular expression matching in dpi systems. Computer Communications, 61, (May 2015 ), 103--120. doi: 10.1016/j.comcom.2014.12.011. 10.1016/j.comcom.2014.12.011 Rafael Antonello, Stenio Fernandes, Djamel Sadok, Judith Kelner, and Géza Szabó. 2015. Design and optimizations for efficient regular expression matching in dpi systems. Computer Communications, 61, (May 2015), 103--120. doi: 10.1016/j.comcom.2014.12.011.

5. Time and area efficient pattern matching on FPGAs

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3