- Notifications
You must be signed in to change notification settings - Fork21
Fast and standards compliant DNS zone parser
License
NLnetLabs/simdzone
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Fast and standards compliant DNS presentation format parser.
DNS resource records (RRs) can be expressed in text form using thepresentation format. The format is most frequently used to define a zone inmaster files, more commonly known as zone files, and is best considered atabular serialization format with provisions for convenient editing.
The format is originally defined inRFC1035 section 5 andRFC1034 section 3.6.1, but as the DNS isintentionally extensible, the format has been extended over time too.
This project provides a lightning fast presentation format deserializer (andserializer eventually) for other projects to leverage. Learn more aboutsimdzone by reading thedocumentation.
- Jeroen Koekkoek and Daniel Lemire,Parsing Millions of DNS Records per Second, Software: Practice and Experience (to appear)
Zone files can become quite large (.com ~24G, .se ~1.3G) and the parser inNSD left something to be desired. simdjson demonstrates that applying SIMDinstructions for parsing structured text can significantly boost performance.simdzone, whose name is a play onsimdjson, aims to achieve asimilar performance boost for parsing zone data.
Currently SSE4.2 and AVX2 are supported, a fallback is used otherwise.
simdzone copies some code from thesimdjson project, withpermission to use and distribute it under the terms ofThe 3-Clause BSD License.
Runningzone-bench
on my system (Intel Core i7-1065G7) against an older.com
zone file of 12482791271 bytes under Linux (Fedora 39).
clang version 17.0.6, release mode:
$ time ./zone-bench parse ../../zones/com.zoneSelected target haswellParsed 341535548 recordsreal 0m13.533suser 0m12.355ssys 0m1.160s
There are bound to be bugs and quite possibly smarter ways of implementingsome operations, but the results are promising.
Make sure the following tools are installed:
- C toolchain (the set of tools to compile C code)
- cmocka (if configured with
-DBUILD_TESTING=on
) - Doxygen (if configured with
-DBUILD_DOCUMENTATION=on
) - Sphinx (if configured with
-DBUILD_DOCUMENTATION=on
)
To compile in release mode:
$ cd zone-parser$ mkdir build$ cd build$ cmake -DCMAKE_BUILD_TYPE=Release ..$ cmake --build .
To compile in debug mode with testing:
$ cd zone-parser$ mkdir build$ cd build$ cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=on ..$ cmake --build .
Contributions in any way, shape or form are very welcome! Please seeCONTRIBUTING.md to find out how you can help.
Design decisions and notes on theFORMAT.
About
Fast and standards compliant DNS zone parser