18 February 2008
If you want to incorporate audio, video, or both into your web applications, you should first develop a bandwidth strategy. The purpose of it is to ensure that the total amount of bandwidth served by Flash Media Server and consumed by each client is sufficient to deliver the quality of service you want, is in line with the physical hardware limitations and software licenses you have, and can accommodate various levels of traffic. Like any good functional specification, a bandwidth strategy should highlight any problem areas up front before you purchase systems or develop your application.
If you have not developed your bandwidth strategy yet, this article will help you out. It examines ways you can estimate your application's bandwidth to help determine your software license needs for Flash Media Server.
The amount of peak bandwidth used by Flash Media Server depends on a number of factors, such as the bandwidth that users connect at, the bandwidth in your pipeline, the bandwidth of the audio and video streams, and, of course, the type of application you develop—is it a one-way streaming application or a two-way/multi-way chat application?
To estimate the bandwidth that your Flash Media Server application will use, you will need to know the following:
At this point you should also have a relatively firm idea of the functionality of your application and how users will be interacting with it. Now you need to figure out how to calculate your application's overall bandwidth.
You can easily estimate bandwidth for two different types of applications: a one-to-many application, such a video-on-demand system; and a many-to-many application, such as a video conferencing application. For each example you can follow a simple formula for calculating both the server bandwidth (required to determine the number of software licenses you need) and the client bandwidth (calculated as part of your bandwidth strategy to ensure good quality of service to each client).
This sample application is a one-way video-on-demand system that streams recorded video at the user's request. Flash Media Server serves only one stream to each user (see Figure 1).
Here are the bandwidth calculations you would make:
Calculate the overall server bandwidth needed to stream video encoded at 500 Kbps to 1000 simultaneous users:
500 Mbps = 1000 × 500 Kbps
This calculation determines the overall bandwidth and can help you determine how many servers and licenses are needed. For example, if your server hardware configuration is capable of 600 Mbps throughput, you would need only one server and license.
Of course, if you wanted to stream to more users, you would need as many servers and licenses as are required to cover your overall server bandwidth. For example, 10,000 simultaneous users will require the following:
5000 Mbps = 10,000 × 500 Kbps
Assuming each server configuration is capable of 600 Mbps, you would need:
8.3 = 5000 Mbps ÷ 600 Mbps
This rounds up to nine servers and licenses.
The preceding calculations assume that content is encoded at a constant bitrate. Most often, however, you will vary the bitrate of the content to suit the viewing audience. This affects your bandwidth needs at both the client and server level.
For example, suppose in the previous example you estimated that half of the 1000 simultaneous users were going to connect via 350 Kbps DSL modem and the other half via 3 Mbps cable modem. Suppose further that while the video encoded at 500 Kbps was appropriate for the cable viewers, you wanted to encode a separate video at 150 Kbps for the DSL modem users.
In this case, the total bandwidth required of the system is lowered to 325 Mbps:
325 Mbps = (500 Kbps × 500) + (150 Kbps × 500)
This example shows a number of people connect to an online conference room. While in the conference room, each person is broadcasting their own audio and video (via a webcam, for example) while receiving the audio and video broadcasts from others in the room (see Figure 2).
Calculating the bandwidth estimates here is very similar to Example 1. However, the number of streams increases exponentially. In this case, Flash Media Server needs to serve x2 number of streams where x is the number of simultaneous users in a room.
For example, if there were four people in a room, the first person would send (publish) one stream and receive three other streams for a total of four streams. Likewise, the second, third, and fourth persons would also consume four streams each. Therefore the total number of streams that Flash Media Server serves in this case is 16—four people using four streams each, or (thought about in a slightly different manner) four publishers of streams and four consumers or subscribers of streams.
Here are the bandwidth calculations you would make:
Server bandwidth needed for a four-person webcam chat using 100 Kbps streams:
4.8 Mbps = (4 × 4) × 300 Kbps
Client bandwidth needed for a four-person webcam chat using 100 Kbps streams:
900 Kbps = 3 × 300 Kbps downstream
300 Kbps = 1 × 300 Kbps upstream
How many users can you support on a single server? In this example, each video conference room generates a bandwidth of 4.8 Mbps. Again assuming 600 Mbps server machine throughput, you can have 600 Mbps ÷ 4.8 Mbps = 125 rooms. Because each room has four participants, you can get 125 × 4 = 500 simultaneous users on one server.
This example illustrates another important aspect of Flash Media Server: there is no limit on the number of streams it can serve. Each user of your application (or, said another way, each connection) can publish or subscribe to an unlimited number of streams as long as the total peak bandwidth-per-second limit is not reached.
Conducting calculations in your bandwidth strategy document, such as those in the previous section, helps you identify important bandwidth considerations for your application. However, it's worth exploring two important considerations that are highlighted in this last many-to-many example.
Your bandwidth strategy document should help you deliver the correct amount of information to each client. In the last many-to-many calculation example discussed, note that even though it was a relatively simple application with a relatively small video stream, each client received 900 Kbps of information and published 300 Kbps. This is a lot of bandwidth—in fact, too much if your user is on a dial-up modem or, in some cases, even on DSL. Users connecting to this application with connections less than 400 Kbps will most likely encounter pauses for rebuffering and suffer other poor-quality effects.
Here are two things to keep in mind concerning client connections:
You can find good online tools for testing upload and download connection speeds. One useful test is at the Broadband Tests and Tools page from BroadbandReports.com.
In the previous example, you estimated that you would be able to add 500 total simultaneous participants to one server (125 rooms with four people each). What if you were to change the design of the application and, instead of allowing four people to connect to one conference room, you allowed only two people to connect to a particular room? Or you only have one big conference room and everyone connects?
In the scenario where you have many rooms but limit each room to only two participants, the server bandwidth drops to 1.2 Mbps per room:
1.2 Mbps = (2 × 2) × 300 Kbps
You can now accommodate 1000 total simultaneous participants across 500 rooms on one server. Note also that the required client bandwidth drops to 300 Kbps upstream and downstream, which opens up the app to more possible users. It's still not a good application for dial-up users, but most DSL users should now be able to use this application.
These examples illustrate that the design of the application plays a very important role in bandwidth utilization and, ultimately, in the user experience.
By now you should have a good idea of how to calculate the server bandwidth requirements for your application. What if your estimates require the server to serve up 800 Mbps of audio/video? Is it realistic to push this much bandwidth on one physical server machine? Two servers? Three servers?
Besides knowing the server bandwidth requirements, you should also have the information you need to estimate the bandwidth utilization of your application and the appropriate Flash Media Server licenses you will need—and some ballpark information about when you can expect to start thinking about adding another server as your traffic grows.
The last but most important piece of advice is to be sure that you thoroughly test your application yourself. Ultimately the only way to know for sure how what type of server resources your application will take is to test it in real-world conditions.
Tutorials & Samples