
Popular cloud hosting DigitalOcean has recently launched its new marketplace selling preconfigured images that can help to quickly deploy an application server. It’s much like AWS, but DO is for those already using this provider’s services. Let’s see how to deploy a simple server for WebRTC streaming with a DO account for a $10/month fee based on Flashphoner WebCallServer and how such a server can be of use.
流行的云托管DigitalOcean最近启动了其新市场,销售预配置的映像,这些映像可以帮助快速部署应用服务器。 这很像AWS,但DO适用于已经使用此提供程序服务的用户。 让我们看看如何基于Flashphoner WebCallServer部署一个简单的服务器用于WebRTC流,并带有一个DO帐户,每月收费10美元,以及如何使用这种服务器。
部署方式 (Deployment)
Enter the DO account, choose the Flashphoner WebCallServer image in Marketplace and press "Create Flashphoner Web Call Server Droplet".
输入DO帐户,在Marketplace中选择Flashphoner WebCallServer图像,然后按“创建Flashphoner Web呼叫服务器Droplet”。

Choose the server performance and the pricing plan. DO will automatically offer a mid-segment product, but we are interested in the minimum price.
选择服务器性能和定价计划。 DO会自动提供中端产品,但我们对最低价格感兴趣。

Choose the datacenter location region, for example, Frankfurt.
选择数据中心位置区域,例如,法兰克福。

Choose the authentication type, for example, one-time password.
选择身份验证类型,例如一次性密码。

Specify the number of servers (we are interested in one server for now) and name the server. This name will be registered among other locations in /etc/hostname.
指定服务器数量(我们现在对一台服务器感兴趣)并命名服务器。 该名称将在/ etc / hostname中的其他位置中注册。
Press "Create droplet"
按“创建小滴”

As soon as the server is created, it will start automatically. Now we can connect to it through SSH, and modify the password if one-time password has been chosen as authentication method. A short description of Flashphoner WebCallServer with links to documentation will be displayed in the console.
创建服务器后,它将自动启动。 现在,我们可以通过SSH连接到它,如果选择了一次性密码作为身份验证方法,则可以修改密码。 控制台中将显示Flashphoner WebCallServer的简短说明以及文档链接。

“这是一个考验。你能看到我吗?” ("This Is a Test. Can You See Me?")
By the time Flashphoner WebCallServer is started, it is in full ready-to-work mode, a 30-day trial license is activated automatically. Web interface is used to test the key functions. We will just check the publication and WebRTC stream playback.
在Flashphoner WebCallServer启动时,它已经处于完全准备工作状态,并且会自动激活30天的试用许可证。 Web界面用于测试关键功能。 我们将只检查发布和WebRTC流的回放。
Open in the browser the page https://droplet_ip:8444/admin/. The server is shipped with self-signed certificate by default; therefore we will need to confirm security exception. The certificates can be replaced later with your own. Enter the username and password (demo by default).
在浏览器中打开页面https:// droplet_ip:8444 / admin / 。 默认情况下,服务器随附自签名证书; 因此,我们需要确认安全异常。 以后可以用您自己的证书替换证书。 输入用户名和密码(默认为demo )。

Choose the Two-Way Streaming example in the sidebar, press "Connect", then "Publish". To play the stream press "Play".
在边栏中选择双向流示例,按“连接”,然后按“发布”。 要播放流,请按“播放”。

几美元 (For a Handful of Dollars)
What can a $10/month server do as hardware platform for WebRTC streaming? Let’s see what Digital Ocean offers in terms of processor
每月10美元的服务器可以用作WebRTC流的硬件平台吗? 让我们看看Digital Ocean在处理器方面提供了什么
lscpu

and memory
和记忆
free -h

By running load tests on the server, we can see that the server performance capabilities are not so small.
通过在服务器上运行负载测试,我们可以看到服务器的性能不是那么小。
As an example, we are going to publish one stream sample and see how many users will be able to publish this stream simultaneously not exceeding 90% of the processor resources:
作为示例,我们将发布一个流样本,并查看有多少用户将能够同时发布此流,但不会超过处理器资源的90%:
Resolution | Bitrate, Kbps | Number of publications | Number of viewers |
---|---|---|---|
360p | 1300 | 1 | 70 |
480p | 1800 | 1 | 70 |
720p | 3000 | 1 | 50 |
解析度 | 比特率,Kbps | 出版物数量 | 观众人数 |
---|---|---|---|
360p | 1300 | 1个 | 70 |
480p | 1800 | 1个 | 70 |
720p | 3000 | 1个 | 50 |
With several simultaneous publications the maximum number of processed streams remains the same; when 7 streams are published, up to 10 viewers are able to subscribe to each.
在同时发布多个出版物的情况下,已处理流的最大数量保持不变; 当发布7个视频流时,每个流媒体最多可以订阅10个观众。
Suppose we need to transcode the stream on the server in order to reduce the resolution or align the FPS. To do this, we are going to check the maximum number of publications:
假设我们需要对服务器上的流进行转码,以降低分辨率或对齐FPS。 为此,我们将检查最大出版物数量:
Resolution | Bitrate, Kbps | Number of streams |
---|---|---|
360p | 1300 | 5 |
480p | 1800 | 3 |
720p | 3000 | 2 |
解析度 | 比特率,Kbps | 流数 |
---|---|---|
360p | 1300 | 5 |
480p | 1800 | 3 |
720p | 3000 | 2 |
In this manner, the server with the lowest price on DO with the parameters 1 CPU core, 2 Gb RAM, 2 TB traffic is suitable not only for testing WebRTC streaming but also for small projects. For example, it is possible to
以这种方式,具有1 CPU内核,2 Gb RAM和2 TB流量参数的DO最低价格的服务器不仅适合于测试WebRTC流,而且适合于小型项目。 例如,可以
- deliver a stream via WebRTC from an IP camera in order to ensure basic in-house video surveillance; 通过WebRTC从IP摄像机提供流,以确保基本的内部视频监控;
- organize a webinar for a small company staff; 为小型公司员工举办网络研讨会;
- deploy your own internet-radio (audio streams require less processor resources). 部署自己的互联网无线电(音频流需要更少的处理器资源)。
Besides, this server can be viewed as reference platform for scaling estimation. This is what we will deal with further on.
此外,该服务器可以作为规模估算的参考平台。 这是我们将进一步处理的。
“我应该得到更多!” ("I Deserve More!")
For the most part, the rules are quite simple: there’s no such thing as too many cores as well as too much memory. Depending on the intended number of users, DO configuration recommendations will be the following:
在大多数情况下,规则非常简单:没有太多的内核以及太多的内存。 根据预期的用户数量,DO配置建议如下:
Number of users | vCPUs | RAM, Gb | Traffic, TB | Use case |
---|---|---|---|---|
up to 200 | 4 | 8 | 5 | Video surveillance system |
up to 500 | 8 | 16 | 6 | Webinars |
up to 1000 | 16 | 64 | 9 | Video chat |
up to 2000 | 20 | 96 | 10 | HD video streaming |
用户数 | 虚拟CPU | 内存,Gb | 流量,TB | 用例 |
---|---|---|---|---|
高达200 | 4 | 8 | 5 | 视频监控系统 |
高达500 | 8 | 16 | 6 | 网络研讨会 |
高达1000 | 16 | 64 | 9 | 视像通讯 |
高达2000 | 20 | 96 | 10 | 高清视频流 |
If further increase in number of users is planned, we will need to deploy the CDN projecting 1 Edge server per 2000 users. Suppose we need to deliver an HD video, the intended number of viewers is 10000. In this case, 2 Origin servers for publishing and 5 Edge servers for viewing will be required.
如果计划进一步增加用户数量,我们将需要在每2000个用户中部署计划1个Edge服务器的CDN。 假设我们需要交付高清视频,则观看者的预期数量为10000。在这种情况下,将需要2个用于发布的Origin服务器和5个用于观看的Edge服务器。

Setup example:
设置示例:
- Origin 1 起源1
cdn_enabled=true
cdn_ip=origin1.flashponer.com
cdn_nodes_resolve_ip=false
cdn_role=origin
- Origin 2 起源2
cdn_enabled=true
cdn_ip=origin2.flashponer.com
cdn_point_of_entry=origin1.flashponer.com
cdn_nodes_resolve_ip=false
cdn_role=origin
Edge 1 — Edge 5 (here we change only the server address in the
cdn_ip
parameter)Edge 1-Edge 5(此处我们仅更改
cdn_ip
参数中的服务器地址)
cdn_enabled=true
cdn_ip=edge1.flashphoner.com
cdn_point_of_entry=origin1.flashponer.com
cdn_nodes_resolve_ip=false
cdn_role=edge
CDN can also be of use if the users are geographically dispersed. For example, our target audiences are based in Europe and America.
如果用户在地理位置上分散,CDN也可以使用。 例如,我们的目标受众位于欧洲和美洲。

Setup example:
设置示例:
- Origin EU 欧盟原产地
cdn_enabled=true
cdn_ip=origin_eu.flashponer.com
cdn_nodes_resolve_ip=false
cdn_role=origin
cdn_groups=EU
- Origin US 原产美国
cdn_enabled=true
cdn_ip=origin_us.flashponer.com
cdn_point_of_entry=origin_eu.flashponer.com
cdn_nodes_resolve_ip=false
cdn_role=origin
cdn_groups=US
- Edge 1 EU 优势1欧盟
cdn_enabled=true
cdn_ip=edge1_eu.flashphoner.com
cdn_point_of_entry=origin_eu.flashponer.com
cdn_nodes_resolve_ip=false
cdn_role=edge
cdn_groups=EU
- Edge 1 US Edge 1美国
cdn_enabled=true
cdn_ip=edge1_us.flashphoner.com
cdn_point_of_entry=origin_eu.flashponer.com
cdn_nodes_resolve_ip=false
cdn_role=edge
cdn_groups=US
The bigger the number of viewers is, the more diverse the devices for playback and the channels to these devices are. To provide good broadcast quality to various devices, it will most likely be needed to transcode the video, which can be imposed on special Transcoder servers.
观看者数量越多,用于回放的设备和这些设备的频道就越多样化。 为了向各种设备提供良好的广播质量,很可能需要对视频进行转码,并将其强加在特殊的转码器服务器上。

Setup example:
设置示例:
- Origin 起源
cdn_enabled=true
cdn_ip=origin.flashponer.com
cdn_nodes_resolve_ip=false
cdn_role=origin
cdn_groups=default
- Transcoder EU 转码器欧盟
cdn_enabled=true
cdn_ip=transcoder_eu.flashponer.com
cdn_point_of_entry=origin.flashponer.com
cdn_nodes_resolve_ip=false
cdn_role=transcoder
cdn_groups=EU
- Edge 1 EU 优势1欧盟
cdn_enabled=true
cdn_ip=edge1_eu.flashphoner.com
cdn_point_of_entry=origin.flashponer.com
cdn_nodes_resolve_ip=false
cdn_role=edge
cdn_groups=EU
As we have found during the test, the number of processor cores is essential for the purposes of transcoding. The most suitable configuration in CPU-optimized configuration line is the most expensive one — 32 vCPU, 64 Gb RAM. At the same time the prices for CPU configurations similar in quantity and with bigger memory in other lines can be significantly higher. Unfortunately, one does not get to save money on transcoders: as the video is encoded frame by frame, there has to be enough memory space for all the images and enough processors for processing all the streams.
正如我们在测试期间发现的那样,处理器内核的数量对于代码转换至关重要。 CPU优化的配置线中最合适的配置是最昂贵的配置-32 vCPU,64 Gb RAM。 同时,数量相似且其他行中的内存更大的CPU配置的价格可能会高得多。 不幸的是,人们并没有在转码器上省钱:由于视频是逐帧编码的,因此必须有足够的存储空间来存储所有图像和足够的处理器来处理所有流。
During CDN deployment, the simultaneous creation of several servers with the same configuration will come in useful. However, in the case of geographically dispersed CDN same-type Edge and Transcoder servers will need to be hosted in different data centers.
在CDN部署期间,同时创建具有相同配置的多台服务器将很有用。 但是,在CDN地理位置分散的情况下,相同类型的Edge和Transcoder服务器将需要托管在不同的数据中心中。
结论 (Conclusion)
To conclude, we have deployed and tested a small server for low latency WebRTC video streaming on Digital Ocean and have found that a server with minimum configuration is a good fit not only for testing but also for small projects. We have obtained the scaling data depending on the intended number of viewers and have touched upon the subject of CDN deployment, which as such deserves to be discussed in a separate article. To be continued, please stay with us.
总而言之,我们已经在Digital Ocean上部署并测试了用于低延迟WebRTC视频流的小型服务器,并且发现配置最少的服务器不仅适合于测试,而且还适合于小型项目。 我们已经根据观看者的预期数量获得了缩放数据,并涉及CDN部署的主题,因此值得在单独的文章中进行讨论。 要继续,请与我们在一起。
相关链接 (Related links)
Flashphoner WebCallServer image in DigitalOcean Marketplace — image of Web Call Server in DigitalOcean.
DigitalOcean Marketplace中的Flashphoner WebCallServer图像 — DigitalOcean中的Web Call Server图像。
CDN for low latency WebRTC streaming — Web Call Server-based content delivery network.
用于低延迟WebRTC流的CDN-基于Web呼叫服务器的内容交付网络。