Skip to content

Commit

Permalink
- direct-rdata-storage, move notes to header file comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
wcawijngaards committed Jan 14, 2025
1 parent e487187 commit a296b49
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 48 deletions.
52 changes: 52 additions & 0 deletions dns.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,58 @@ struct nsd_rdata_descriptor {
// >> we'll see!
};

/*
RDATA minimization is outlined in https://github.com/k0ekk0ek/database-case.
The basic premise is that RDATA is directly allocated with the RR structure
and that pointers to domains are directly stored (likely unaligned) in the
RDATA. We do this primarily to save memory, but as the RDATA is directly
stored with the RR, it is likely that data is cached with the RR which should
have a positive impact on performance. When paired with direct conversion
routines we are very likely to improve performance when importing zones and
writing RRs out to the wire.
The original idea was to implement conversion routines for type, but upon
propagating changes throughout the codebase it turns out we have to do
convert between more formats that just wire-to-internal, internal-to-wire,
and internal-to-text. The result is an explosion in code.
Consider the following matrix.
* compressed wire format
* uncompressed wire format
* internal format
* presentation format
* generic presentation format (though mostly important for loading)
For incremental zone transfers we convert from presentation format to
uncompressed wire format to internal format to uncompressed wire format on
loading. When writing out to the network we convert from uncompressed wire
format to compressed wire format.
The idea is that we can at least skip uncompressed wire format to internal
format on loading, though we do have to normalize the domain names in the
data (or assume that users won't update the on-disk data in which case we
may trust the data gets written in normalized fashion). However, the
uncompressed wire format to compressed wire format remains necessary.
For conversion from uncompressed/compressed wire format to internal we make
the interface such that a packet buffer is required and use
dname\_make\_from\_packet so that the same import routines can be used.
For internal to compressed wire format we implement a specialized routine so
that answering of queries is as optimal as can be.
For all other conversions, speed is not as important so the proposal is that
we keep the descriptor table more-or-less as-is.
For converting to (generic) presentation format, I propose we move that code
to simdzone. The benefit there being that support for everything presentation
format is in one place. The idea is that the interface is uncompressed wire
format, so writing data out, the internal representation must replace the
domain pointers by the uncompressed domain name in wire format.
*/


typedef struct nsd_type_descriptor nsd_type_descriptor_t;
struct nsd_type_descriptor;

Expand Down
48 changes: 0 additions & 48 deletions doc/RDATA-MINIMIZATION.md

This file was deleted.

0 comments on commit a296b49

Please sign in to comment.