Skip to content

Peering overlap validation: reduce complexity #1217

@qmonnet

Description

@qmonnet

When checking peerings for overlap between exposed IPs, we're looping over prefixes in exposes in all other peerings for the VPC, for each prefix in the exposes in all peerings in the VPC... That's 7 nested loops, and we're comparing with a naive linear approach.

3e19d2c#diff-fad44583357d049b8ecd22159c9e8f7e5362f3e872bc2b6c7b26c38325756ce0R161

We should try to improve it. A typical alternative could be to insert entries into a data structure as we go, and see if we get a match from entries in that structure when looking at a new prefix; but "getting a match", here, means finding overlapping entries, and there's no trivial solution for that, especially when considering IP prefixes + accompanying port ranges.

Metadata

Metadata

Assignees

No one assigned

    Labels

    performanceRelated to performance issues or improvements

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions