Skip to content

Performance optimizations in console parser and FindUniq#139

Open
jason-ni-0 wants to merge 1 commit into
bstansell:masterfrom
jason-ni-0:optimizations_connect_speed
Open

Performance optimizations in console parser and FindUniq#139
jason-ni-0 wants to merge 1 commit into
bstansell:masterfrom
jason-ni-0:optimizations_connect_speed

Conversation

@jason-ni-0

Copy link
Copy Markdown

On configs with larger cardinality of consoles, ReReadCfg blocks the master's select loop for minutes per SIGHUP, hanging all new client connects. Two independent O(N^2) bottlenecks in the parse path: (1) ConsoleEnd calls FindParserDefaultOrConsole on the growing parserConsoles list for duplicate name detection; added a parallel hash table keyed on ->server for O(1) lookup, populated/cleared alongside the existing list. (2)

In the IPv6 path, FindUniq did a recursive O(N^2) dedup with two getaddrinfo() calls per pair; rewrote iteratively to resolve each unique master hostname once and track uniqHead via a parallel index array for O(uniqCount) inner lookup.

This change also fixes a latent bug in the original sockaddr compare which memcmp &rp->ai_addr (pointer-to-pointer) against sizeof(sockaddr_storage) instead of *rp->ai_addr with the family-appropriate length. Both changes are pure speedups with semantically identical output, so shouldnt have functionality changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant