|
Configure the server for live video delivery
Configure the server for vod deliveryTo configure the server to deliver recorded media, complete
the following tasks:
Configure the recorded media cacheWhen
a stream is requested from the server, segments of the stream are
stored in a cache on the server. As long as the cache has not reached
capacity, the server places segments in the cache. Each time a stream
attempts to access a segment, the server checks the cache. If the
segment is available, the server gives the stream a reference to
the segment for playback. If the segment is not available, the server
retrieves the segment from its source, inserts it into the cache,
and returns a reference to that segment to the stream.
When the cache is full, the server removes unused segments, starting
with the least recently used. After removing all unused segments,
if there still isn’t enough room for a new segment, the server notifies
the client that the stream is not available and makes an entry in
the core log file.
If you have cache-full events in the core log file, increase
the size of the cache or limit the number of streams playing. For
more information about the core log file, see Monitoring and Managing Log Files.
Open the RootInstall/conf/fms.ini file.
Edit the SERVER.FLVCACHE_MAXSIZE parameter.
This
is the maximum size of the cache, in megabytes. The default value
is 500. This value shares memory with the running process and has
a limit of 2 GB in Windows and 3 GB in Linux.
The size of
the cache limits the number of unique streams the server can publish.
To increase the probability that a requested stream will be located
in the recorded media cache, increase the value of SERVER.FLVCACHE_MAXSIZE.
To decrease the amount of memory the server process uses, decrease
the value of SERVER.FLVCACHE_MAXSIZE. While a large
cache size is useful, Adobe recommends that you ensure that your
total system memory usage does not exceed the process limit of your
OS. Consider memory limits and desired memory and stream performance
when utilizing the memory cache.
Note: Cache settings have no effect on live streams, as live streams do not need or utilize the cache.
Restart the server.
Configure the size of stream chunksStreams
break into chunks as they are written to the network. You can specify
the size of a chunk. Large values reduce CPU usage because there
are fewer writes. However, large values can delay other content
on lower bandwidth connections. The larger the content size and
the higher the bandwidth of the receiving connection, the more benefit
is gained from larger chunk sizes.
Open the Application.xml file.
In the Client element, set the OutChunkSize element
to a value between 128 and 65536 bytes. The default value is 4096
bytes.
For more information, see Application.xml file.
Restart the server.
Send aggregate messagesSending
aggregate messages reduces CPU usage and increases server capacity. You
can configure applications to deliver aggregate messages to clients
running on Flash Player 9.0.60.0 and above. When this setting is
disabled, the server breaks up aggregate messages into individual
messages before delivering them to clients.
Open the Application.xml file.
Locate the following XML code:
<Client>
...
<AggregateMessages enabled="true"></AggregateMessages>
<Client>
Make sure that the enabled attribute is
set to true (the default).
Validate the XML and save the Application.xml file.
Restart the server.
Combine audio samplesTo
handle more connections while broadcasting a live stream, combine
audio samples.
Important: Do not combine audio samples if you are also using the live aggregation message feature.
Open the RootInstall/conf/fms.ini file.
Edit the following parameters:
APP.SUBSCRIBERS: If
there are more than this number of subscribers to a stream, audio
samples are combined. The default value is 8. To increase live streaming
capacity, set this value to 1.
APP.COMBINESAMPLES_LOCPU: If the CPU is
lower than this value, audio samples are not combined. The default
value is 60. To increase live streaming capacity, set this value
to 1.
APP.COMBINESAMPLES_HICPU: If the CPU is
higher than this value, audio samples are not combined. The default
value is 80. To increase live streaming capacity, set this value
to 1.
APP.COMBINESAMPLES_MAXSAMPLES: Combine this
many samples into one message. The default value is 4. To increase
live streaming capacity, set this value to 8.
Restart the server.
Limit connection requestsA
high connection rate to the server can negatively impact the experience
of users already connected to the server.
Locate the following code in the Server.xml configuration
file:
<Root>
<Server>
...
<Protocol>
<RTMP>
<Edge>
<MaxConnectionRate>100</MaxConnectionRate>
Element
|
Description
|
Impact
|
MaxConnectionRate
|
The maximum number of incoming connections per
second the server accepts, per listener. Listeners are defined in
the HostPort element in the Adaptor.xml file. Each
port the server is configured to listen on represents a listener.
You can set a fractional maximum connection rate, such as 12.5.
A value of 0 or -1 disables this feature.
The value of this
element is a global setting for all listeners. If the element is
set to 10 connections per second, each listener has a limit of 10
connections per second. If there are three listeners and the MaxConnectionRate is
set to 10, the server imposes a maximum total combined rate of 30 connections
per second.
|
Connections requested at a rate above this value
remain in the TCP/IP socket queue and are silently discarded by
the operating system whenever the queue becomes too long.
|
Validate the XML and save the XML file.
Restart the server.
Close idle connectionsSometimes users abandon their connections to
an application. To reclaim these resources for new and active clients,
the server can close the idle clients.
A client is active when it is sending (e.g., publishing) or receiving
(e.g., subscribing to) data. Elements in the Server.xml, Vhost.xml,
and Application.xml configuration files specify how often the server
should check for idle clients. When a client has been idle longer
than the maximum idle time (10 minutes, by default), the server
sends a status message to the NetConnection object (the client)
with the code property set to NetConnection.Connect.Idle followed
by NetConnection.Connect.Closed. The server closes
the client connection to the server and writes an x-status code
of 432 in the access log. The server also writes a message such
as “Client x has been idle for y seconds” in the core
and event logs.
To close idle connections, enable the feature in the Server.xml
file. Once you enable the feature in the Server.xml file, you can
disable the feature for individual virtual hosts or individual applications
in the Vhost.xml files and Application.xml files. The values defined
in the Server.xml configuration file apply to all clients connected
to the server, unless the values are defined in the Vhost.xml file
(the Vhost.xml values override the Server.xml values). The values
defined in the Application.xml file override the values defined
in the Vhost.xml file.
Enable closing idle connectionsLocate the following
code in the Server.xml file:
<AutoCloseIdleClients enable="false">
<CheckInterval>60</CheckInterval>
<MaxIdleTime>600</MaxIdleTime>
</AutoCloseIdleClients>
Edit the following elements.
Element
|
Description
|
Impact
|
AutoCloseIdleClients
|
Set the enable attribute
to true to close idle clients. If the enable attribute
is omitted or not set to true, the feature is disabled.
The default value is false.
|
|
CheckInterval
|
Specifies the interval, in seconds, at which the
server checks for active client connections. The default interval
is 60 seconds.
|
A client is disconnected the first time
the server checks for idle connections if the client has exceeded
the MaxIdleTime value. A shorter interval results in more reliable
disconnection times but can also result in decreased server performance.
|
MaxIdleTime
|
Specifies the maximum idle time allowed,
in seconds, before a client is disconnected. If this element is
0 or less, the default idle time is used. The default idle time
is 600 seconds (10 minutes).
|
A low value may cause unneeded disconnections. When
you configure this element, consider the type of applications running
on the server. For example, if you have an application allowing users
to watch short video clips, a user might leave the window to idle
out.
|
Configure settings for virtual hostsYou can disable this feature
for a virtual host or specify a different maximum idle time for
a virtual host in the Vhost.xml file.
Locate the following
code in the Vhost.xml file and remove the comments:
<VirtualHost>
<AutoCloseIdleClients enable="false">
<MaxIdleTime>600</MaxIdleTime>
</AutoCloseIdleClients>
</VirtualHost>
Edit the following elements.
Element
|
Description
|
AutoCloseIdleClients
|
Disable this feature for an individual virtual
host by setting the enable attribute to false.
If this element is disabled in Server.xml, the feature is disabled
for all virtual hosts, even if you specify true in
the Vhost.xml file.
|
MaxIdleTime
|
Specifies the maximum idle time allowed,
in seconds, before a client is disconnected. The default idle time
is 600 seconds (10 minutes). You can set a different value for each
virtual host.
If no value is set for this element, the server
uses the value set in the Server.xml. file.
The value of the MaxIdleTime element
in the Vhost.xml file overrides the value of the MaxIdleTime element
in the Server.xml file.
|
Restart the server.
Configure settings for applicationsYou can disable this feature
for an application or specify a different maximum idle time for
an application in the Application.xml file.
Locate
the following code in the Application.xml file and remove the comments:
<VirtualHost>
<AutoCloseIdleClients enable="false">
<MaxIdleTime>600</MaxIdleTime>
</AutoCloseIdleClients>
</VirtualHost>
Edit the following elements.
Element
|
Description
|
AutoCloseIdleClients
|
Disable this feature for an individual application
by setting the enable attribute to false.
If this element is disabled in Server.xml, the feature is disabled
for all applications, even if you specify true in
the Application.xml file.
|
MaxIdleTime
|
Specifies the maximum idle time allowed,
in seconds, before a client is disconnected. The default idle time
is 600 seconds (10 minutes). You can set a different value for each
application.
If no value is set for this element, the server
uses the value set in the Vhost.xml. file. If no value is set for
this element in the Vhost.xml file, the server uses the value in
the Server.xml file.
The value of the MaxIdleTime element
in the Vhost.xml file overrides the value of the MaxIdleTime element
in the Server.xml file.
|
Restart the server.
Configure how applications are assigned to server processesNote: This section is only applicable to Flash
Media Interactive Server and Flash Media Development Server. Flash
Media Streaming Server doesn’t support multiple processes.
In some scenarios, you might want to change how applications
are assigned to server processes. When you start the server, you
are starting a process called FMSMaster.exe (Windows) or fmsmaster
(Linux). Application instances run in processes called FMSCore.exe
(Windows) and fmscore (Linux). The master process is a monitor that
starts core processes when necessary. There can be only one master
process running at a time, but there can be many core processes running
at a time.
Note: The number of core processes you can run is
limited by system memory. Do not run more than 100, and you probably
won’t need more than 20. If you are configuring the number of core
processes and using the reloadApp() Administration
API or HTTP command, see Tech Note kb403044.
You can configure how applications are assigned to server processes
in the Process section of the Application.xml configuration
file. Settings in an Application.xml file in a virtual host folder
(for example, RootInstall/conf/_defaultRoot_/_defaultVHost_/Application.xml)
apply to all the applications running in that virtual host. Settings
in an Application.xml file in an application’s folder (for example, RootInstall/applications/myApp/Application.xml)
apply only to that application. The following is the XML structure:
<Application>
<Process>
<Scope>vhost</Scope>
<Distribute numprocs="3"></Distribute>
<LifeTime>
<RollOver></RollOver>
<MaxCores></MaxCores>
</LifeTime>
<MaxFailures>2</MaxFailures>
<RecoveryTime>300</RecoveryTime>
</Process>
...
</Application>
Configure a process scope The Scope tag
specifies at which level application instances are assigned to core
processes. An application instance can run by itself in a process
or it can run in a process with other instances. Enter one of the
following values for the Scope element.
Value
|
Description
|
adaptor
|
All application instances in an adaptor
run together in a process.
|
vhost
|
All application instances in a virtual host
run together in a process. This is the default value.
|
app
|
All instances of a single application run
together in a process.
|
inst
|
Each application instance runs in its own
process. This provides the best application isolation and uses the most
system resources.
Running every instance in its own process
can create many processes. You can set the Distribute numprocs attribute
to a value greater than 1 to distribute instances
across that number of processes.
|
Distribute a process scope among multiple core processesThe four process scopes don’t
provide a good distribution for all scenarios. For example, if you
have one application and want to run 25 instances of that application,
you could either distribute those instances to one core process (<Scope>app</Scope>)
or three core processes (<Scope>inst</Scope>).
In this scenario, you could set Scope to app and Distribute numprocs to
3 to distribute the application instances among three core processes.
Note: There is no limit to the value of the numprocs attribute,
but you should never need more than 40. Depending on available RAM,
a number between 3 and 11 is realistic for most cases. Adobe recommends
using prime number values because they result in a more even distribution
of connections to processes.
Scopes have an enclosing relationship
with a strict ordering: adaptors contain virtual hosts, which contain
applications, which contain instances, which contain clients. The
value of the Distribute tag must be a scope that
is lower in order than the value in the Scope tag.
In other words, if the value of Scope is adaptor,
the value of Distribute can be vhosts, apps, insts,
or clients. If the value of Scope is app,
the value of Distribute can be insts or clients.
By default, the server uses the value immediately lower than the
one specified in the Scope tag.
Set
the scope value.
Set the numprocs value to a value higher
than 1. The default value of numprocs is 3, which
means that the default behavior is to distribute application instances
to three core processes.
Enter one of the following values for the Distribute element.
Value
|
Description
|
vhosts
|
All instances of applications in a virtual
host run together in a process.
|
apps
|
All instances of an application run together
in a process.
|
insts
|
Each application instance runs in its own
process. This is the default value. If you choose this value, you
must also set the Distribute numprocs attribute
to a value greater than 1.
|
clients
|
Each client connection runs in its own process.
Use
this value for stateless applications only. Stateless applications
don’t require clients to interact with other clients and don’t have
clients accessing live streams. Most vod (video on demand) applications
are stateless because each client plays content independently of
all other clients. Chat and gaming applications are not stateless
because all clients share the application state. For example, if
a shared chat application were set to client, the
messages wouldn't reach everyone in the chat because they’d be split
into separate processes.
|
Configure the number of core processes and how long each process runs Specify the number of
core processes in the MaxCores tag (the maximum number
of core processes that can exist concurrently) and the number of seconds
that a core process can run in the RollOver tag.
When a core process reaches the limit, any new connections roll
over to a new core process. The following diagram depicts
the way in which the server rolls over processes. In the XML, the
rollover time is set to 3600 seconds (1 hour), indicating that every
hour a new process should start, and the maximum core processes
value is set to 3, indicating that the maximum number of processes at
any given time is 3:
<Process>
<Scope>app</Scope>
<LifeTime>
<RollOver>3600</RollOver>
<MaxCores>3</MaxCores>
</LifeTime>
...
View full size graphic A. Client connections B. Process 1 starts C. Process 2 starts
D. Process 3 starts E. Process 4 starts; Process 1 ends, because
the maximum core processes limit was reached When
each process starts, it accepts new connections until the next process starts:
that is, when process 1 starts, it accepts new client connections
to the application until process 2 starts; process 2 then accepts
new client connections until process 3 starts; and so on.
Note
that the duration of process 1 might or might not be the full duration specified
by the rollover value, because rollover values are calibrated to
the real clock time. The duration of process 1 is partially determined
by the current time when process 1 starts. For example, as shown
in the diagram, when process 1 starts, the current time is 12:20,
so the duration of process 1 is only 40 minutes (because it is 40
minutes until the beginning of the hour in real time). The duration
of the first process is determined by the clock time; subsequent
processes have a duration equal to the specified rollover time.
To
disable this feature, set RollOver to 0. This feature
is disabled by default.
Note: If you have multiple
VHosts with Process/Scope set to adaptor,
you must set an identical RollOver value for each
VHost.
In stateless applications, such as vod applications,
old core processes continue to serve earlier connections. In this
case, you can specify a value in the MaxCores tag
to limit the maximum number of core processes that can run simultaneously.
If the application is not stateless, the server ignores any value you
assign to MaxCores and sets it to 1.
This ensures that an application instance is not split across multiple
processes, but clients are disconnected periodically. To disable
this feature, set MaxCores to 0. This feature is
disabled by default.
Note: An application is considered
stateless if you configure it to distribute clients over multiple
processes. To do this, set the Distribute numprocs attribute to
a value greater than 1, then set the Distribute tag
to clients or set the Scope tag
to inst.
Check for process failuresEnter a value in the MaxFailures tag
to specify the maximum number of process failures allowed before
a core process is disabled. The default value is 2.
Once disabled, a master process will not launch a core process
until a minimum recovery time elapses. Enter a value in the RecoveryTime tag
to specify the minimum recovery time for contained elements; set
the tag to 0 to disable checking for process failures.
Use
this feature to guard against a behavior in which a faulty core
process can use the entire CPU by being repeatedly launched very
quickly.
Note: Applications that are loaded using
the Administration API (including applications loaded using the
Administration Console) are not checked for process failures.
|
|
|