mirror of
http://git.haproxy.org/git/haproxy.git
synced 2026-02-23 12:14:35 +02:00
MEDIUM: resolvers: replace the answer_list with a (flat) tree
With SRV records, a huge amount of time is spent looking for records by walking long lists. It is possible to reduce this by indexing values in trees instead. However the whole code relies a lot on the list ordering, and even implements some round-robin on it to distribute IP addresses to servers. This patch starts carefully by replacing the list with a an eb32 tree that is still used like a list, with a constant key 0. Since ebtrees preserve insertion order for duplicates, the tree walk visits the nodes in the exact same order it did with the lists. This allows to implement the required infrastructure without changing the behavior.
This commit is contained in:
@@ -119,13 +119,13 @@ struct resolv_answer_item {
|
||||
unsigned int last_seen; /* When was the answer was last seen */
|
||||
struct resolv_answer_item *ar_item; /* pointer to a RRset from the additional section, if exists */
|
||||
struct list attached_servers; /* attached server head */
|
||||
struct list list;
|
||||
struct eb32_node link; /* linking node */
|
||||
};
|
||||
|
||||
struct resolv_response {
|
||||
struct dns_header header;
|
||||
struct list query_list;
|
||||
struct list answer_list;
|
||||
struct eb_root answer_tree;
|
||||
/* authority ignored for now */
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user