README.md
1 
2 [](https://scan.coverity.com/projects/nlnetlabs-simdzone)
3 [](https://fosstodon.org/@nlnetlabs)
4
5 # simdzone: Parsing zone files really fast
6
7 Fast and standards compliant DNS presentation format parser.
8
9 DNS resource records (RRs) can be expressed in text form using the
10 presentation format. The format is most frequently used to define a zone in
11 master files, more commonly known as zone files, and is best considered a
12 tabular serialization format with provisions for convenient editing.
13
14 The format is originally defined in [RFC1035 section 5][rfc1035-section-5] and
15 [RFC1034 section 3.6.1][rfc1034-section-3-6-1], but as the DNS is
16 intentionally extensible, the format has been extended over time too.
17
18 This project provides a lightning fast presentation format deserializer (and
19 serializer eventually) for other projects to leverage. Learn more about
20 simdzone by reading the [documentation](https://simdzone.docs.nlnetlabs.nl/).
21
22 ## Research paper
23
24 * Jeroen Koekkoek and Daniel Lemire, [Parsing Millions of DNS Records per Second](https://arxiv.org/abs/2411.12035), Software: Practice and Experience (to appear)
25
26
27
28
29 ## Motivation
30 Zone files can become quite large (.com ~24G, .se ~1.3G) and the parser in
31 NSD left something to be desired. simdjson demonstrates that applying SIMD
32 instructions for parsing structured text can significantly boost performance.
33 simdzone, whose name is a play on [simdjson][simdjson], aims to achieve a
34 similar performance boost for parsing zone data.
35
36 > Currently SSE4.2 and AVX2 are supported, a fallback is used otherwise.
37
38 > simdzone copies some code from the [simdjson][simdjson] project, with
39 > permission to use and distribute it under the terms of
40 > [The 3-Clause BSD License][bsd-3-clause].
41
42 [rfc1035-section-5]: https://datatracker.ietf.org/doc/html/rfc1035#section-5
43 [rfc1034-section-3-6-1]: https://datatracker.ietf.org/doc/html/rfc1034#section-3.6.1
44 [nsd]: https://nlnetlabs.nl/projects/nsd/about/
45 [simdjson]: https://github.com/simdjson/simdjson
46 [bsd-3-clause]: https://opensource.org/license/bsd-3-clause/
47
48 ## Results
49 Running `zone-bench` on my system (Intel Core i7-1065G7) against an older
50 `.com` zone file of 12482791271 bytes under Linux (Fedora 39).
51
52 clang version 17.0.6, release mode:
53 ```
54 $ time ./zone-bench parse ../../zones/com.zone
55 Selected target haswell
56 Parsed 341535548 records
57
58 real 0m13.533s
59 user 0m12.355s
60 sys 0m1.160s
61 ```
62
63 There are bound to be bugs and quite possibly smarter ways of implementing
64 some operations, but the results are promising.
65
66 ## Compiling
67 Make sure the following tools are installed:
68 * C toolchain (the set of tools to compile C code)
69 * [cmocka](https://cmocka.org/) (if configured with `-DBUILD_TESTING=on`)
70 * [Doxygen](https://www.doxygen.nl/) (if configured with `-DBUILD_DOCUMENTATION=on`)
71 * [Sphinx](https://www.sphinx-doc.org/en/master/) (if configured with `-DBUILD_DOCUMENTATION=on`)
72
73 To compile in release mode:
74 ```
75 $ cd zone-parser
76 $ mkdir build
77 $ cd build
78 $ cmake -DCMAKE_BUILD_TYPE=Release ..
79 $ cmake --build .
80 ```
81
82 To compile in debug mode with testing:
83 ```
84 $ cd zone-parser
85 $ mkdir build
86 $ cd build
87 $ cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=on ..
88 $ cmake --build .
89 ```
90
91 ## Contributing
92 Contributions in any way, shape or form are very welcome! Please see
93 [CONTRIBUTING.md](CONTRIBUTING.md) to find out how you can help.
94
95 Design decisions and notes on the [FORMAT](FORMAT.md).
96