Skip to content

Conversation

@gsanchietti
Copy link
Member

@gsanchietti gsanchietti commented Jan 29, 2026

Speedup the tunnel list of ~ 190x

For a list of 100 tunnel peers:

  • original time ~17 seconds
  • current times ~0.85 seconds

See https://community.nethserver.org/t/wireguard-small-details/26885?u=giacomo

Speedup the tunnel list of ~ 190x
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes WireGuard server and peer listing in ns.wireguard by reducing redundant configuration lookups and expensive subprocess calls, significantly improving listing performance at scale.

Changes:

  • list_servers now reuses a single EUci instance and a pre-fetched __active_peers() snapshot across all servers.
  • Refactored peer configuration generation into __generate_peer_config that accepts pre-computed server data, avoiding repeated wg pubkey and UCI lookups per peer.
  • Introduced __get_server_configuration to build server objects and their peers in one pass using utils.get_all_by_type, replacing the previous O(n²)-like pattern over UCI sections.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gsanchietti gsanchietti requested a review from Tbaile January 29, 2026 08:48
@Tbaile Tbaile added this to the NethSecurity 8.8 milestone Jan 29, 2026
@Tbaile Tbaile moved this to In Progress 🛠 in NethSecurity Jan 29, 2026
@gsanchietti gsanchietti marked this pull request as ready for review January 29, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress 🛠

Development

Successfully merging this pull request may close these issues.

3 participants