perf: batch marker-def fan-out to one PUT /nios/batch per compute

When a marker definition is created (or re-applied on data_link_type
change), the fan-out used to call inherit_marker -> update() on every
link, issuing one PUT /nio per link end (5000+ round-trips on a 2500-link
project). On started nodes each round-trip also reconfigured uBridge.

Two-phase fan-out:
- inherit_marker/start_marker gain memory_only: writes the marker into
  link._markers and refreshes _link_data without any HTTP/emit/dump.
- _apply_def_to_all_links applies memory-only to every link, then
  _batch_update_link_nios groups the updated NIO specs by compute and
  sends a single PUT /projects/{id}/nios/batch per compute.

compute: new PUT /projects/{id}/nios/batch endpoint with _get_existing_nio
+ _update_nio_binding dispatch (mirrors create_batch_nios), re-applies
filters+markers to uBridge on started nodes.

Precise per-marker operations (update_marker bpf change, stop_marker on
def delete) are untouched — they deliberately avoid a full reapply to
preserve sibling marker pcaps.
This commit is contained in:
YueGuobin committed 2026-08-11 08:44:57 +08:00
1 parent c877ed87a6
commit 48991f2d29
4 files changed
+167 -10

No files matched your search

+2 -1
View File
@@ -114,7 +114,7 @@ class Link:
"""
return self._markers
async def inherit_marker(self, def_name, marker_def, dump=True):
async def inherit_marker(self, def_name, marker_def, dump=True, memory_only=False):
"""
Apply a project-level marker definition to this link.
@@ -148,6 +148,7 @@ class Link:
enabled=not marker_def.get("paused", False),
inherited_from=def_name,
dump=dump,
memory_only=memory_only,
)
def _persist_markers(self):