| In 2014,the network live broadcast came into the public’s view and developed rapidly.The existing live broadcast system generally adopts RTMP protocol,but its hardware requirements are high,the development is difficult,and the stability is difficult to guarantee in massive concurrency.Compared with the newly emerging Web RTC protocol in recent years,its delay is relatively high,and the effect is not satisfactory in real-time communication with strong interaction.Web RTC protocol is a kind of point-to-point real-time communication technology between browser and browser,which has good compatibility and cross platform,low communication delay,security and convenience.In recent years,with the rapid development of live network,Web RTC technology will have a broader development space.Web RTC technology is often used for one-to-one video call or multi person meeting,which requires developers to realize signaling interaction function independently and NAT penetration through stun or turn server.However,if a more complex real-time communication system is to be realized,an intermediate media server is also needed for media forwarding and processing.When designing a live broadcast system based on Web RTC architecture,there are usually higher requirements for concurrency and stability.It is necessary to establish a media server cluster and study the high concurrency load balancing strategy.This paper studies the common load balancing strategies and algorithms of media servers,designs and implements a new dynamic load balancing algorithm.The algorithm in this paper calls the weighted consistency hash algorithm in nginx,and uses the user IP address as the key word to hash,so that the user requests of the same IP are allocated to the same server,and the consistency of the session is maintained.At the same time,the dynamic weight adjustment algorithm and the dynamic cycle algorithm are designed and implemented to dynamically calculate the weight and the weight update period of the nodes in the cluster.Compared with the existing algorithm,the dynamic weight algorithm in this paper is different from only calculating the weight according to the current load,but using heuristic simulated annealing algorithm,taking the weight vector as the initial solution,to find a new solution to reduce the total load of the cluster,and probability jump out of the local optimal solution,and finally tend to the global optimal.At the same time,this algorithm realizes the dynamic change of the weight update cycle.Compared with the current fixed cycle dynamic weight algorithm,it improves the efficiency of the weight update,and can modify the number of server nodes at any time,without affecting the stability of the whole cluster,and realizes the good adaptive adjustment of the cluster to the real-time load condition.Based on the above load balancing strategy,a live broadcast system based on Web RTC is designed and implemented.Signaling interaction is independently designed.By building a kurento media server cluster,media processing and forwarding are carried out to ensure the communication quality and security.According to the demand analysis of the live broadcast system,the necessity of a pair of n-broadcast,beamlink interaction,filter sticker and other video live broadcast systems is designed and implemented To function.Finally,this paper tests the function of the live system and the algorithm of high parallel transmission.The test results show that the live system and load balancing algorithm can meet the design requirements in function and performance. |