diff --git a/dns.h b/dns.h index 27654e3d1..8fa406a66 100644 --- a/dns.h +++ b/dns.h @@ -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; diff --git a/doc/RDATA-MINIMIZATION.md b/doc/RDATA-MINIMIZATION.md deleted file mode 100644 index efd314a72..000000000 --- a/doc/RDATA-MINIMIZATION.md +++ /dev/null @@ -1,48 +0,0 @@ -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.