In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
The purpose of this article is to share with you the practice of how to test the performance of the backend server of Now LVB application. The editor finds it very practical, so I share it with you. I hope you can learn something after reading this article. Let's take a look at it with the editor.
The popularity of live streaming has not only brought a large number of users, but also brought a large number of server concurrency. The following is an analysis of the difficulties existing in the LVB industry, starting from NOW LVB, Tencent's new LVB product, to understand the things behind the LVB application.
Live broadcast has suddenly become one of the most popular words on the Internet in China. According to the data in the in-depth investigation and Investment Prospect Forecast report of China's webcast Industry from 2016 to 2020, there were nearly 200 online live streaming platforms in China in 2015, of which the market size of webcast was about 9 billion. The number of users of the webcast platform has reached 200 million, the number of large-scale live streaming platforms is close to 4 million during the daily peak hours, and the number of live rooms at the same time is more than 3000. This figure is still rising at an extremely rapid rate.
What is the concept of 200 million users of live streaming platform? According to the 2016 version of Wechat Digital report, Wechat users have reached 697 million, that is, one of your 3-4 friends of the same age is likely to be a webcast user.
Live streaming is not popular, just look at the users, but whether the live broadcast has a prospect depends on the attitude of the tech giants towards it.
The Facebook live launched by foreign Facebook brings a new experience to its users, which not only increases the stickiness of users, but also brings a new source of income to Facebook. The business model of the combination of YouTube live and TV-on-demand has also brought new video experience to users.
In China, professional live broadcast platforms such as Douyu, Huya, Panda, Longzhu, Qixiu and Zanthoxylum bungeanum have sprung up like bamboo shoots after a spring rain. Alibaba, Baidu, Tencent and other giants have launched their own live broadcast platforms. The industry areas involved in live broadcasting have also widely emerged from various industries such as e-sports, social networking, e-commerce and so on.
Server pressure under live broadcasting
With such a large number of users, LVB applications have higher requirements for servers than ordinary applications. Let's take a look at what more challenges LVB applications have to servers.
A larger amount of data
Video data and text data are concepts of two orders of magnitude. If there are 5000 people in an LVB room and 60K of video data per second, then 5000*60=300000KB=292.97MB is required, which is basically the size of 2-3 mobile games, and this is only the traffic generated by one room. In April this year, Liu Tao entered the live broadcast field and created data with 170000 simultaneous online users and 710000 total viewers. If this number is used, the server will generate the bandwidth of 9.73Gbps. At present, a famous webcast app has more than 800W daily active users, and the server will bear the bandwidth pressure of 458Gbps.
Higher concurrency
Different from ordinary applications and games, the use of live applications is very concentrated. Generally speaking, social live app time is concentrated from 20:00 to 23:00 before going to bed, game App active time is concentrated at 18: 20 after work, show App is concentrated at 13:00 and 18 (lunch break and off work time), so in just a few hours, a large number of users will pour in. A large V LVB usually causes millions of users to log in. APP needs detailed policies of flow restriction, diversion and load balancing to ensure that the server will not be washed down.
(source: big data analyzes how popular the webcast market is.)
A more realistic user login scenario
Compared with ordinary applications, live broadcast applications have many interactive functions, including not only the server pressure of live video stream, but also the data interaction pressure of user message push, chat, gift, payment and statistics system. The server needs to identify different business fields in order to accurately determine whether the user's behavior is completed successfully. From the point of view of interaction frequency, live broadcast applications It's more like a game than an app.
Lower latency
Live broadcasting needs a strong immediacy. If the VJ's behavior cannot be synchronized with the user's comments, it will give the user a very bad experience. If a user finds that other users are cheering and applauding, but when the VJ on the screen has no movement, the live broadcast application can basically stop using it, so live broadcast applications not only need to face a larger amount of data and higher concurrency. It also ensures a lower latency. Usually, it is necessary to ensure that the data processing speed of the server is fast and have a strong enough bandwidth; in addition, it is necessary to ensure the rationality of data sharing through P2P algorithms to ensure that the data of the server and P2P data can be balanced.
Server preparation before live broadcast
The server cost under LVB applications is closely related to the traffic to be borne. Different LVB applications with different frequency and depth of interaction will have different bandwidth pressure. Let's make an account together and prepare the server for the live streaming application. How much will it cost?
First of all, we need to buy a server. How big a server do you buy? The bandwidth of the server needs to meet the bandwidth requirements of LVB applications. Here, let's take a look at what the bandwidth looks like:
The commonly used unit of bandwidth is bps (bits per second). 8 bits is usually equal to 100Mbps. When converting to the file size we are familiar with, divide it by 8, that is, under the bandwidth of 100Mbps, you can download 12.5MB files per second. Generally speaking, how much bandwidth does LVB need? See the following figure:
LVB applications generally use resolutions of 360p, 720p and 1080p. In order to see more clearly, people usually choose 720p, so under the definition of 720p, LVB applications need the bandwidth of 1024kbps, that is, the amount of data transmitted per second is 1024/8=128KB. To put it simply, if you enable LVB in APP and use a resolution of 720p, a user needs to transmit 128KB data every second (of course, in reality, LVB applications also have behaviors such as message push, gift giving, payment, LVB image resolution, compression ratio and other differences, which will actually consume more data).
So, how many users do live streaming applications need to carry now?
Take the most popular live broadcast platforms as an example. The number of online users of Douyu TV can exceed 10 million, the number of Zhanqi TV online is about 5 million, the number of Longzhu online is about 4 million, and that of Huya online is about 1 million. The bandwidth cost of live broadcast platform is usually in the form of monthly peak bandwidth. If the maximum number of simultaneous online users in that month is 200W, that is, the amount of data to be transmitted per second is as high as 244GB. Then in theory, the bandwidth consumed is about 2T, and the monthly cost is about 4000W RMB.
For LVB applications, the most difficult link for the server to deal with is high-frequency and high-bandwidth scenarios such as video traffic and user interaction. User behavior is difficult to predict, and there is often a sudden surge, usually when carrying out activities. traffic may be dozens of times higher than usual. On July 11, 2016, a live broadcast of Papi Jiang brought more than 2000 users to visit, which is unaffordable for most live streaming applications. This is why more and more LVB applications are seeking support from CVM. Currently, cloud service providers such as Tencent Cloud, Aliyun, Baidu Cloud, Jinshanyun, etc., are less and less different in hardware.
Therefore, live streaming applications need to conduct targeted tests on a variety of user operations before launching. Registration, chat, gifts, payment and other behaviors need to be tested with different interfaces, and NOW Live is one of them.
Generation of testing requirements for live broadcast server
Tencent NOW LVB is a fast-growing LVB application of Tencent. It has gained access to the LVB interface directly through QQ, which shows its importance. In an online event, NOW LVB needs to carry out stress tests on all APIs of the event to expose and solve problems in advance to ensure the smooth implementation of the activity. To this end, NOW LVB cooperates with Tencent WeTest server performance testing to systematically test the business backend of the application and a complete set of scenarios for the activities. (for high-frequency and high-bandwidth scenarios such as video traffic and user interaction, you can also use the advanced mode of WeTest server performance testing. Please look forward to the follow-up information. )
Carding the train of thought before testing
In general, for active functional nodes, there are usually two points to focus on during testing:
Single interface pressure test, exposing the problems of the core module in advance.
In the problem of multi-interface architecture, the scene stress test simulates the real user behavior as far as possible, which makes the stress test result more convincing.
For this event, the idea of NOW LVB is also to use simple HTTP single-interface and complex multi-interface scenarios to add stressors to backend and client APP through stress testing tools to help find problems.
Execution of the test
Single interface pressure test-step by step, iterative step by step
The principle of single-interface stress testing is very simple, that is, keep pressurizing a functional interface until the limit of the problem is found. In the performance test of Tencent WeTest server, the operation is as follows:
1) Click the shortcut entry on the home page of the pressure test product: HTTP direct pressure. The mode chooses the simple mode, and the name and description can be filled in by yourself. (the starting number of the sample in the picture is 50, which is increased by 50 every 60 seconds, and the upper limit is 200)
2) create a new client request. The interface stress test includes the read-write interface. The read interface is basically GET request, and the write interface is basically POST request. GET request uses url request parameters, and POST request uses x-www-form-urlencoded to pass parameters. Here, select GET for NOW LVB method and enter the URL you want to test.
3) Edit the test model and add a scene name. The single-interface test only tests one functional interface, so the mode selects "single scenario" and the pressure percentage is set to 100%.
Through this stress testing method, the pressure on the server continues to increase until the bottleneck is found. Tencent WeTest implements the concurrency of 2W/s for NOW LVB, which meets the concurrent needs of NOW LVB.
Multi-interface pressure measurement-- real simulation, positioning problem
The main logic of multi-interface stress testing is to build different functional interfaces to simulate the real behavior of users, so as to help developers locate interface problems.
The test method of NOW LVB is to call a function API through GET request, randomly generate robots with different behavior logic through this function interface, simulate real QQ users, and then perform specific business actions through POST requests, so as to find logic problems between functions.
The read interface of NOW LVB test team is basically GET request, and the write interface is basically POST request. GET requests use url request parameters, and POST requests use x-www-form-urlencoded to pass parameters.
In the performance test of Tencent WeTest server, we can do the following:
1) first, read the "landing state" of a user through the GET request, randomly generate robots with different behavior logic through this functional interface, and simulate the real QQ user; then execute the specific business behavior in turn through the POST request, thus finding the logic problems between the functions.
2) enter the name of the scenario in the test scenario, and NOW LVB tests three operations such as "login-enter the room-like", then select "context" in "mode", click "stress test scenario", and select different function APIs to call.
Currently, Tencent WeTest server performance testing supports accessing 8 scenarios at the same time, and more scenarios can more realistically simulate users' behavior.
Through the cooperation between NOW Live and Tencent WeTest in server performance testing, it can be seen that the current live broadcast applications pay great attention to two pieces of content: one is the carrying capacity of single interface, and the other is the architecture of multi-interface. For developers, the problem of the former is easy to solve and can be optimized by parallel expansion, but the problem of the latter needs to be constantly located among multiple functional interfaces. Keep trying new stress tests in order to find that hidden danger.
Based on the requirements of NOW LVB, Tencent WeTest has also improved the number of scenario APIs that can be called at the same time, from 4 to 8, and will continue to increase since then. It also continues to increase the number of concurrency that can be achieved, providing users with greater concurrency pressure and more real behavior scenarios, thus saving more testing costs.
Only by doing this well can we make a better LVB application.
Tencent WeTest uses more than 10 years of internal practical experience to conduct stress tests based on real business scenarios and user behavior to help game developers find server-side performance bottlenecks, make targeted performance tuning, reduce server procurement and maintenance costs, and improve user retention and conversion rates.
The above is the practice of how to test the performance of the backend server of Now LVB application. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.