Using Flash Media Server Edge Servers
Trademarks 1 Step RoboPDF, ActiveEdit, ActiveTest, Authorware, Blue Sky Software, Blue Sky, Breeze, Breezo, Captivate, Central, ColdFusion, Contribute, Database Explorer, Director, Dreamweaver, Fireworks, Flash, FlashCast, FlashHelp, Flash Lite, FlashPaper, Flash Video Encoder, Flex, Flex Builder, Fontographer, FreeHand, Generator, HomeSite, JRun, MacRecorder, Macromedia, MXML, RoboEngine, RoboHelp, RoboInfo, RoboPDF, Roundtrip, Roundtrip HTML, Shockwave, SoundEdit, Studio MX, UltraDev, and WebHelp are eith
Contents Using Edge and Origin Servers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Introducing edge servers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 How edge servers work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Caching data in edge servers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Deploying edge servers in the DMZ . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents
Using Edge and Origin Servers This chapter describes the various strategies for deploying Flash Media Server with edge and origin servers. Introducing edge servers Until this release of Flash Media Server, clients always connected directly to the computer where the application was running. These applications were running locally, since their execution occurred on the same computer that the clients were connected to.
Deploying edge servers lets administrators distribute the incoming connection requests for Flash Media Server services. Traffic between clients and the origin server uses the existing bandwidth and system resources more efficiently. More traffic occurs locally between the clients’ computers and the edge server. Without edge servers, all clients have to connect to a Flash Media Server origin server, no matter where that server is located.
Such constraints may prompt the Flash Media Server and network administrators to consider a different deployment strategy. The strategy involves configuring Flash Media Server to redistribute the load on system and bandwidth resources by running some virtual hosts as edge servers and other virtual hosts as origin servers.
Users in these zones always access the origin server through their assigned edge servers. These edge servers receive the responses from the origin server, then distribute them back to the clients (the users’ computers) in their respective zones: Paris or Tokyo. The edge also stores the data received from the origin server in a cache, and makes it available to other clients that connect to this edge server. Recycling the data is one more way that edge servers use resources efficiently.
Caching data in edge servers An edge server is designed to intercept the requests for Flash Media Server services from users in a particular zone, collect or aggregate these requests, and transmit them to the origin server. The origin server returns the results to the edge server, which in turn sends the data back to the user’s client computer. The edge server also stores this information in its cache, where other users or clients assigned to the same edge server can access it.
With the edge servers sitting in the DMZ, the network operators can open access to port 1936, avoiding the system overhead and risk of HTTP tunneling. Because the edge server performs stream splitting and stream caching, it uses the connection to the origin server efficiently, reducing the Internet bandwidth cost. The user also benefits from the more reliable connectivity.
Administrators can explicitly specify that any connection request to an origin server be automatically routed through an edge or proxy server. For example, if your applications are running on fms.foo.com, you can redirect the connection request from the users’ computers to another server (or virtual host) called fmsproxy.foo.com, which is configured to run in remote mode. Instead of making the usual connection to the applications with the following connection string: rtmp://fms.foo.
For example, if your applications are running on fms-secure.foo.com, you can direct the connection requests from clients’ devices or computers to the proxy server (or virtual host) called fms.foo.com, which makes the connection to fms-secure.foo.com, where your applications are running. The client is not aware that its request is being sent to another server.
Detecting the presence of proxy servers Flash Player 8 automatically detects any edge servers in its proximity. When an edge server is available, Flash Player automatically routes the connection from the client to the origin server through the proxy server. These edge servers are defined as implicit proxies since the client is generally unaware that its communication with Flash Media Server is being routed through a proxy.
A second problem surfaces when RTMPT is specified in the URI. You may specify this protocol only for the first prefix. The following are valid URIs: rtmpt://foo/?rtmp://bar/app/inst rtmpt://foo:443/?rtmp://bar/app/inst The following are invalid URIs: rtmpt://foo/?rtmpt://bar/app/inst rtmp://foo/?rtmpt://bar/app/inst Configuring edge servers All Flash Media Server functionalities—live streaming, on-demand streaming, messaging, shared object handling, scripting—take place as application instances.
You can find examples of the configuration files, their tag structures, detailed information about the tags, including cross references to associated tags, syntax, and examples in Chapter 3, “Configuration Files” in Managing Flash Media Server. Deploying a cluster of edge servers You can also deploy a group of connected edge servers as a cluster. Each edge server in a cluster can access the origin server.
Connecting to a cluster of edge servers When edge servers are configured into a cluster, the clients probably do not know that edge servers are present and servicing their connection requests. This is a secure and desirable strategy for disguising the address of the origin server. A different scheme for connecting clients to Flash Media Server is required. With a cluster of proxies in place, when the client attempts to connect to Flash Media Server, the call to the NetConnection.
When the load on an edge starts to scale down, so does its affinity value. Because the client always looks to connect to the edge with the lowest affinity value, this edge begins to take back connections that had spilled over into the next edge. The objective is to balance the number of connection requests to the available resources, and have all connections to the same application instance again pass through the same edge.
7. The client then uses the information to make an explicit connection: first to the edge, then to the origin server using a wrapped URI: nc = new NetConnection(); nc.onStatus = function(info) { trace(info.code); } uri = "rtmp://yourcompany.com/app/inst"; myXML = new XML(); myXML.onLoad = function(success) { if (success) { var proxy = this.childNodes[1].childNodes[1].firstChild.nodeValue; uri = "rtmp://" + proxy + "/?" + uri; } nc.connect(uri); } myXML.load("http://yourcompany.
■ Locate the origin server and those edge servers nearest to it on the same subnet. ■ If you are licensed to deploy a cluster, make sure all proxies in the cluster are configured identically. ■ ■ Configure the conf directory on one proxy. ■ Place a copy of this conf directory in the same location on the other proxies. Use a load balancer when you deploy more than one proxy. ■ Place the load balancer between the clients and the proxies.
Clearing the edge server cache Macromedia recommends that you create a weekly scheduled task to clear the edge server cache. To create a scheduled cache clearance: 1. Create a cache.bat file to empty the cache directory. The entry in the cache.bat file has the following syntax: del /Q /S \*.* 2. Run the cache.bat file and verify that it deletes files in the cache directory. ■ ■ Note that the directory structure remains; this is an expected behavior.