Stream Distribution & Routing

Overview

The Stream Distribution & Routing (SDR) consists of two components: Workload Distribution Agent and Workload Routing Agent

  • Workload Distribution Agent

    • It receives stream events initiated by Video Storage Toolkit (VST)

    • It compiles the workloads and evenly distributes them to underlying microservices by invoking their webhooks

    • It writes the distribution mapping into a cache

  • Workload Routing Agent

    • It intercepts a HTTP or GPRC call from an upstream caller and extract the stream identifier from the request header

    • It looks up the distribution mapping with the stream identifier

    • it routes requests to the specific processing replica of a microservice

The rule of thumb is that a microservice should be integrated with SDR if it satisfies both of following criteria:

  • It needs to be notified when a stream event occurs at VST

  • It is a stateful service that requires the incoming request to be consistently routed to the same processing replica.

Currently the following services are integrated with SDR, chat-controller, anim-graph, and ds-visionai, and renderer

Configuring the Agent

Parameters to the agent can be passed at install time if necessary. Default parameters are sufficient for functioning of the application on a single node.

List of Parameters

Parameters

Description

WDM_WL_SPEC

Data cache file used for state management

WDM_WL_THRESHOLD

Max number of sensor stream a pod can manage

WDM_CONSUMER_GRP_ID

Unique consumer group ID used to listen for messages from Redis

WDM_WL_OBJECT_NAME

Name of the work load object managed by the agent (statefulset name)

WDM_MAX_REPLICAS

Maximum number of replicas that the agent scale the pods horizontally.

WDM_MSG_KEY

Topic or key where Redis is publishing the event messages

WDM_WL_REDIS_SERVER

Address of the Redis server

WDM_WL_REDIS_PORT

Redis server port number

WDM_WL_CONFIG_PORT

REST API Port to send the event message received from VST.

WDM_WL_ADD_URL

REST URL end-point to route the “add” event messages

WDM_WL_DELETE_URL

REST URL end-point to route the “delete” event messages

WDM_TARGET_PORT_MAPPING

A JSON string describing the port mapping to send requests. Eg: {“default”: 8011, “grpc”: 50064}

ENVOY_ROUTE_URL_PREFIX

Prefix for the incoming API request for Envoy to do routing

ENVOY_ROUTE_URL_PREFIX_REWRITE

Proxy rewrite prefix for envoy to send to target pod in the cluster of pods