perf: dedicated 500-worker thread pool for ubridge batch I/O

Replace the default asyncio executor (capped at ~32 threads) with a
dedicated ThreadPoolExecutor sized for large-topology parallelism.
When 500 nodes each call _connect_nio, up to 500 OS threads can now
send blocking ubridge commands in parallel — no longer serialised by
either the event loop or a small thread pool.

- ubridge_hypervisor: module-level _ubridge_sync_pool (max_workers=500)
- docker_vm._connect_nio: dispatches to the dedicated pool instead of
  the default executor
This commit is contained in:
YueGuobin committed 2026-08-10 23:11:23 +08:00
1 parent 05934fa8e8
commit b155980402
2 files changed
+13 -1

No files matched your search

+2 -1
View File
@@ -38,6 +38,7 @@ from gns3server.utils.hostname import is_rfc1123_hostname_valid
from gns3server.utils import macaddress_to_int, int_to_macaddress
from gns3server.compute.ubridge.ubridge_error import UbridgeError, UbridgeNamespaceError
from gns3server.compute.ubridge.ubridge_hypervisor import _ubridge_sync_pool
from ..base_node import BaseNode
from ..adapters.ethernet_adapter import EthernetAdapter
@@ -1242,7 +1243,7 @@ class DockerVM(BaseNode):
async with getattr(self, lock_name):
loop = asyncio.get_running_loop()
await loop.run_in_executor(
None, # default thread-pool executor
_ubridge_sync_pool, # dedicated 500-worker thread pool
self._ubridge_hypervisor.send_batch_sync,
commands,
)