Exploiting Structure in Regular Expression Queries
-
Published:2023-06-13
Issue:2
Volume:1
Page:1-28
-
ISSN:2836-6573
-
Container-title:Proceedings of the ACM on Management of Data
-
language:en
-
Short-container-title:Proc. ACM Manag. Data
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
Cited by
1 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
|
|