Skip to main content

Availability

This page covers the Edge-to-Control communication system that allows plugins running on Edge Gateway (edge) instances to send data back to plugins running on AI Studio (control plane).

Overview

In the hub-and-spoke architecture:
  • AI Studio is the control plane (hub)
  • Edge Gateway instances are edge nodes (spokes)
Edge plugins may need to send data back to the control plane for:
  • Cache statistics aggregation
  • Shared state synchronization
  • Audit log centralization
  • Custom analytics collection
  • Alert and notification routing
The Edge-to-Control system provides a reliable, batched mechanism for this communication.

Architecture

Data Flow

  1. Edge Plugin calls SendToControl() or SendToControlJSON()
  2. Payload is queued to SQLite database (survives gateway restarts)
  3. During heartbeat (every 30s), pending payloads are batched
  4. Batch is sent via gRPC SendPluginControlBatch RPC
  5. Control Server routes each payload to the target plugin
  6. Studio plugin’s AcceptEdgePayload() is called with the data

Edge Plugin: Sending Data

SDK Functions

The Edge Gateway SDK provides two functions for sending data to the control plane:

SendToControl

Send raw byte payloads:
Expandable

SendToControlJSON

Convenience function for JSON payloads:
Expandable

Function Signatures

Expandable

Payload Limits

Queue Behavior

  • Persistence: Payloads are stored in SQLite and survive gateway restarts
  • Batching: Payloads are batched during heartbeat (default: every 30s)
  • Batch size: Up to 100 payloads per batch
  • Retention: Successfully sent payloads are deleted; failed payloads are retried
  • Cleanup: Payloads older than 24 hours are automatically cleaned up

Example: Complete Edge Plugin

Expandable

Control Plane Plugin: Receiving Data

EdgePayloadReceiver Interface

AI Studio plugins implement EdgePayloadReceiver to receive payloads from edge instances:

EdgePayload Structure

Example: Complete Control Plane Plugin

Expandable

Plugin ID Matching

The control plane routes payloads based on plugin ID. When an edge plugin sends a payload, it’s associated with that plugin’s numeric ID. The control plane then delivers it to the AI Studio plugin with the same ID.

Configuration

  1. Create AI Studio plugin (control plane receiver)
  2. Note the plugin ID (e.g., 42)
  3. Deploy Edge Gateway plugin with the same ID configuration
  4. Edge payloads from plugin 42 will be routed to AI Studio plugin 42

Example Setup

Expandable

Error Handling

Edge Plugin Errors

Expandable

Control Plane Plugin Errors

Expandable

Best Practices

Edge Plugins

  1. Batch locally first: Aggregate data before sending to reduce payload count
  2. Use correlation IDs: For request/response matching or debugging
  3. Include metadata: Add context like metric type, source, timestamp
  4. Handle errors gracefully: Queue failures shouldn’t crash your plugin
  5. Monitor pending count: High pending counts may indicate connectivity issues

Control Plane Plugins

  1. Check metadata first: Return handled=false quickly for irrelevant payloads
  2. Validate payloads: Don’t trust edge data - validate before processing
  3. Use KV for persistence: Store aggregated data for dashboard/API access
  4. Log with context: Include edge ID and correlation ID in logs
  5. Handle duplicates: Network issues may cause duplicate deliveries

Performance

  1. Keep payloads small: Smaller payloads = faster transmission
  2. Aggregate at edges: Send summaries, not individual events
  3. Use appropriate intervals: Balance freshness vs. overhead
  4. Monitor queue depth: Alert on growing queues

Troubleshooting

  1. Check edge connectivity: Verify edge can reach control plane
  2. Check plugin IDs: Edge and control plugins must have matching IDs
  3. Check logs: Look for errors in both edge and control logs
  4. Verify plugin loaded: Ensure control plane plugin is active
  1. Check batch interval: Default is 30s heartbeat
  2. Check payload size: Large payloads take longer to transmit
  3. Check network: Latency between edge and control
  4. Check queue depth: High pending count = backlog
  1. Check payload size: Must be under 1MB
  2. Check queue capacity: Queue may be full
  3. Check retention: Payloads older than 24h are cleaned up
  4. Check errors: Processing errors may cause drops