Streams distribution

The Luna-Video-Manager service distributes streams provided by users to agents.

Choosing a distribution algorithm:

You can choose one of the following algorithms using LUNA_VIDEO_MANAGER_STREAMS_DISTRIBUTION_ALGORITHM setting:

simple:

  • A random agent is selected from among the available agents for the stream (or part of it).

percent:

  • Among the available agents for the stream (or part of it), an agent is selected whose percentage of free slots is higher than that of others.

Streams groups

Each stream may be linked to one or more groups.

During stream creation it is possible to create stream linked to one group. After stream creation it is possible to link/unlink stream to group.

During agent registration it is possible to specify some groups which agent will be linked to (see Luna-Video-Agent LUNA_VIDEO_AGENT_GROUPS configuration parameter or other agent documentation/parameters for details).

Each agent linked to any group(s) will take into processing only streams linked to these group(s), but if stream linked to group(s), it can be processed by agent linked to these groups or by agent which not linked to any groups, not only agent linked to these group(s).

If stream already taken into processing, it will not be reassigned to another agent automatically, to reassign such stream, it is possible to pause and resume stream using stream patch request, replace stream or delete stream and create it again.

Note

If agent is not external, all streams groups will be available for such agent, if agent is external, only groups of this account will be available for such agent. For more information about external agents behavior, see internal and external analytics chapter and Luna-Video-Agent documentation.

For not splittable streams:

  • select all streams that required processing (the only streams with pending status assume processing, for more information about streams statuses see streams statuses chapter)

  • select all available agents (for more information about agents interaction see agents interaction chapter) which current streams processing number does not reach the maximum number of streams available to it for simultaneous processing for agent

  • in order of time the streams were created select an agent for each stream satisfying the following conditions:

    For not splittable streams

    • agent can process analytics specified for stream

    • there is free slot for stream (agent provides max_stream_count - maximum number of streams available to it for simultaneous processing, so the number of simultaneous streams for agent cannot exceed this number)

    For splittable streams (calculates for each stream analytic which processing is in pending)

    • agent can process one or more analytics specified for stream

    • there is free slot for stream

  • makes necessary records in database to reply to agent request according to previous logic

  • agent receives streams via stream request - streams that need to be processed. The stream once mentioned in response to the request, it will no longer be mentioned in responses to this request.

  • agent make feedback requests and receive responses which will contain which contain information what agent must do with streams - continue processing or stop processing.

Note

Splittable streams feedbacks and other logic works in the same way for each part of splittable stream as for not splittable stream.

The described procedure will be executed as periodical background task of master instance. The period of execution can be configured using LUNA_VIDEO_MANAGER_STREAMS_AGENT_SEARCH_INTERVAL setting. It is highly not recommended to change this value without understanding the consequences.