CN110248211B - Live broadcast room message current limiting method and device, electronic equipment and storage medium - Google Patents
Live broadcast room message current limiting method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN110248211B CN110248211B CN201810189283.7A CN201810189283A CN110248211B CN 110248211 B CN110248211 B CN 110248211B CN 201810189283 A CN201810189283 A CN 201810189283A CN 110248211 B CN110248211 B CN 110248211B
- Authority
- CN
- China
- Prior art keywords
- message
- current limiting
- live broadcast
- broadcast room
- messages
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 57
- 230000003139 buffering effect Effects 0.000 claims abstract description 10
- 238000004422 calculation algorithm Methods 0.000 claims description 28
- 230000005540 biological transmission Effects 0.000 description 10
- 230000008569 process Effects 0.000 description 9
- 238000010586 diagram Methods 0.000 description 8
- 230000006870 function Effects 0.000 description 5
- 230000000903 blocking effect Effects 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 230000006837 decompression Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 230000002452 interceptive effect Effects 0.000 description 2
- 238000010295 mobile communication Methods 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/215—Flow control; Congestion control using token-bucket
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/50—Queue scheduling
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/231—Content storage operation, e.g. caching movies for short term storage, replicating data over plural servers, prioritizing data for deletion
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/234—Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
- H04N21/23406—Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving management of server-side video buffer
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/238—Interfacing the downstream path of the transmission network, e.g. adapting the transmission rate of a video stream to network bandwidth; Processing of multiplex streams
Landscapes
- Engineering & Computer Science (AREA)
- Signal Processing (AREA)
- Multimedia (AREA)
- Computer Networks & Wireless Communication (AREA)
- Information Transfer Between Computers (AREA)
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
Abstract
The embodiment of the invention discloses a method and a device for limiting message flow in a live broadcast room, electronic equipment and a storage medium, relates to the technical field of network live broadcast, and can improve the stability of a live broadcast service system to a certain extent. The live broadcast room message flow limiting method comprises the following steps: receiving a first-level current limiting message, wherein the first-level current limiting message is obtained after first-level current limiting is carried out on a live broadcast message when the message quantity of the live broadcast message is larger than a first preset threshold value; if the message quantity of the live broadcast messages after the first-stage current limiting is larger than a second preset threshold value, performing second-stage current limiting on the received first-stage current limiting messages to obtain second-stage current limiting messages; and sending the second-stage current limiting message to a message queue for buffering. The invention is suitable for the network video live broadcast system.
Description
Technical Field
The invention relates to the technical field of network live broadcast, in particular to a live broadcast room message current limiting method and device, electronic equipment and a storage medium.
Background
In the mobile internet environment, generally, for a sudden mass data request, such as a second kill, a time-limited rush purchase, and the like, service current limitation is required to be performed, so as to avoid service avalanche, that is, the whole service is unavailable due to instantaneous traffic.
In a video live broadcast system, the message volume is usually over a million messages per second, and the maximum message volume of a single live broadcast room is about hundreds of thousands of messages. Thus, for the server, the instant bandwidth pressure causes great impact on the service, which easily causes unstable conditions of the service, such as jamming and downtime, and even causes the service to be unavailable.
Disclosure of Invention
In view of this, embodiments of the present invention provide a live broadcast room message current limiting method and apparatus, an electronic device, and a storage medium, which can improve stability of a live broadcast service system to a certain extent.
In a first aspect, an embodiment of the present invention provides a live broadcast room message throttling method, including: receiving a first-level current limiting message, wherein the first-level current limiting message is obtained after first-level current limiting is carried out on a live broadcast message when the message quantity of the live broadcast message is larger than a first preset threshold value; if the message quantity of the live broadcast messages after the first-stage current limiting is larger than a second preset threshold value, performing second-stage current limiting on the received first-stage current limiting messages to obtain second-stage current limiting messages, wherein the second-stage current limiting messages are obtained after performing second-stage current limiting on the live broadcast messages after the first-stage current limiting; and sending the second-stage current limiting message to a message queue for buffering.
With reference to the first aspect, in a first implementation manner of the first aspect, the received first-level current limiting messages are messages belonging to the same live broadcast room; the messages of the same live broadcast room are obtained according to identification of live broadcast room identifications carried in the messages of the live broadcast rooms, and the messages of the same live broadcast room carry the same live broadcast room identifications.
With reference to the first aspect, in a second implementation manner of the first aspect, after the second level current limiting message is sent to a message queue for buffering, the method further includes: and obtaining the cached message from the message queue, and if the message quantity of the cached message obtained from the message queue is greater than a third preset threshold value, performing third-level current limiting on the message obtained from the message queue to obtain a third-level current limiting message.
With reference to the second implementation manner of the first aspect, in a third implementation manner of the first aspect, after performing third-level current limiting on the acquired message, the method further includes: and sending the third-level current limiting message to a long-connection server so as to be pushed to the terminal equipment of a user through the long-connection server, so that the live broadcasting room message passing through the first-level current limiting, the second-level current limiting and the third-level current limiting is displayed in a live broadcasting room displayed on a display screen of the terminal equipment.
With reference to the first aspect, in a fourth implementation manner of the first aspect, the performing second-level current limiting on the received first-level current limiting message to obtain a second-level current limiting message includes: and carrying out secondary current limiting on the received primary current limiting message by adopting a token bucket algorithm to obtain a secondary current limiting message.
With reference to the second implementation manner of the first aspect, in a fifth implementation manner of the first aspect, the performing third-level throttling on the message obtained from the message queue includes: and performing third-stage current limiting on the messages acquired from the message queue by adopting a token bucket algorithm.
In a second aspect, an embodiment of the present invention provides a live broadcast room message flow limiting apparatus, including: the message receiving module is used for receiving a first-level current limiting message, wherein the first-level current limiting message is obtained after first-level current limiting is carried out on a live broadcast message when the message quantity of the live broadcast message is larger than a first preset threshold value; the second-stage current limiting module is used for carrying out second-stage current limiting on the received first-stage current limiting message to obtain a second-stage current limiting message if the message quantity of the live broadcast message subjected to the first-stage current limiting is larger than a second preset threshold value, wherein the second-stage current limiting message is obtained after the second-stage current limiting is carried out on the live broadcast message subjected to the first-stage current limiting; and the first message sending module is used for sending the second-level current limiting message to a message queue for caching.
With reference to the second aspect, in a first implementation manner of the second aspect, the received first-level current limiting messages are messages belonging to the same live broadcast room; the messages of the same live broadcast room are obtained according to identification of live broadcast room identifications carried in the messages of the live broadcast rooms, and the messages of the same live broadcast room carry the same live broadcast room identifications.
With reference to the second aspect, in a second implementation manner of the second aspect, the apparatus further includes: and the third-stage current limiting module is used for carrying out third-stage current limiting on the messages acquired from the message queue to obtain third-stage current limiting messages if the message quantity of the cached messages acquired from the message queue is greater than a third preset threshold value, wherein the third-stage current limiting is the messages obtained after carrying out third-stage current limiting on the live broadcast room messages after the second-stage current limiting.
With reference to the second embodiment of the second aspect, in a third embodiment of the second aspect, the apparatus further comprises: and the second message sending module is used for sending the third-level current limiting message to the long-connection server so as to be pushed to the terminal equipment of the user through the long-connection server, so that the live broadcasting room message after the first-level current limiting, the second-level current limiting and the third-level current limiting is displayed in a live broadcasting room displayed on a display screen of the terminal equipment.
With reference to the second aspect, in a fourth implementation manner of the second aspect, the secondary current limiting module is specifically configured to perform secondary current limiting on the received primary current limiting message by using a token bucket algorithm, so as to obtain a secondary current limiting message.
With reference to the second implementation manner of the second aspect, in a fifth implementation manner of the second aspect, the third-level throttling module is specifically configured to obtain a buffered message from the message queue, and perform third-level throttling on the obtained message by using a token bucket algorithm.
In a third aspect, an embodiment of the present invention provides an electronic device, where the electronic device includes: the device comprises a shell, a processor, a memory, a circuit board and a power circuit, wherein the circuit board is arranged in a space enclosed by the shell, and the processor and the memory are arranged on the circuit board; a power supply circuit for supplying power to each circuit or device of the electronic apparatus; the memory is used for storing executable program codes; the processor executes a program corresponding to the executable program code by reading the executable program code stored in the memory, for performing any of the methods described above.
In a fourth aspect, embodiments of the invention also provide a computer readable storage medium storing one or more programs, the one or more programs being executable by one or more processors to implement the method of any preceding claim.
In a fifth aspect, the embodiment of the present invention further provides an application program, where the application program is executed to implement the method provided in any embodiment of the present invention.
According to the live broadcast room message current limiting method, the live broadcast room message current limiting device, the electronic equipment and the storage medium, if the message quantity of the live broadcast room message is larger than a first preset threshold value, the message quantity of the live broadcast room message (namely, a first current limiting message) obtained after the first-stage current limiting is carried out on the live broadcast room message is larger than a second preset threshold value, the second-stage current limiting is carried out on the received first-stage current limiting message, and a second-stage current limiting message is obtained; the second-level current limiting message is sent to the message queue for caching, so that the situation that live broadcast service is unstable due to the fact that the live broadcast system is easily impacted greatly when the message amount of the live broadcast message is large can be reduced or avoided by conducting multi-level current limiting on the live broadcast message, the second-level current limiting message is sent to the message queue for caching, peak flow buffering can be further achieved, live broadcast service pressure is relieved, and therefore stability of the live broadcast service system can be improved to a certain extent.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic structural diagram of a live broadcast system applied in the embodiment of the present invention;
fig. 2 is a schematic flow chart of a message throttling method in a live broadcast room according to an embodiment of the present invention;
fig. 3 is a schematic flow chart illustrating a message throttling method in a live broadcast room according to another embodiment of the present invention;
fig. 4 is a schematic structural diagram of a message flow limiting device in a live broadcast room according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a message flow limiting apparatus in a live broadcast room according to another embodiment of the present invention;
fig. 6 is a schematic structural diagram of an embodiment of an electronic device according to the present invention.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
It should be understood that the described embodiments are only some embodiments of the invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment provides a live broadcast room message current limiting method, a live broadcast room message current limiting device, electronic equipment and a storage medium, which are applied to a live broadcast room server in a network video live broadcast system. Fig. 1 is a schematic structural diagram of a live broadcast system applied in the embodiment of the present invention. Referring to fig. 1, the live system includes a user, a long connection server, a live room server, and a message queue. The users, namely the users watching the live broadcast, are mostly mobile phone end or web end users; in order to push a live broadcast message, a terminal device of a user needs to access a long connection server to establish a long connection, and the message is submitted to the long connection server first when being sent. Similarly, the message is pushed by the long connection server when being received. The live broadcast room server is a service processing server of the live broadcast room information, the information content is transmitted to the live broadcast room server through the long connection server, and relevant operations such as anti-yellow filtering and storage of the information are carried out in the live broadcast room server. The message queue is a buffer queue of the message, and in order to avoid overlarge pressure, the buffer is used for buffering the message queue to perform the functions of reducing the pressure of the service, reducing the peak of the flow and the like.
In a live broadcast system, if the message amount of the live broadcast system per second is counted by 100 ten thousand, then a large amount of messages are reported to a long connection server at the same time, and the long connection server needs to be pushed to a live broadcast room server for processing at the same time, so that the computer room bandwidth and the CPU computing capacity are hard to bear, and for the server, the instant bandwidth pressure causes great impact on the service, and unstable conditions such as jamming and downtime easily occur to the service. For a client live broadcast room, instant massive messages are quickly refreshed, which causes great confusion for a user during browsing and causes abnormal browsing of application messages. The experience and interaction of the product are influenced.
Therefore, in order to guarantee system stability or high availability, the embodiment of the invention adopts a multi-stage current limiting strategy. The current limiting mode adopts a non-blocking mode, namely, the operation of the main thread service is not hindered in the current limiting process.
In a first aspect, the present embodiment provides a live broadcast room message throttling method, which improves stability of a live broadcast service system to a certain extent.
Fig. 2 is a schematic flow chart of a live broadcast room message throttling method according to an embodiment of the present invention, and referring to fig. 2, the method of the embodiment includes:
In a live broadcast system, the amount of text messages at a server end is usually large, and can reach millions or even tens of millions of text messages per second, which causes certain impact on the bandwidth of the server, and meanwhile, because too many messages are received at a client end at the same time, the user experience is influenced to a certain extent. Therefore, in this embodiment, the message is controlled in a certain safe traffic range at the server side, i.e., message throttling is performed.
The first-stage current-limiting message is obtained after first-stage current limiting is carried out on the live broadcast room message when the message quantity of the live broadcast room message is larger than a first preset threshold value. The live broadcast room message refers to text content in a live broadcast system, and comprises the following steps: and interactive chatting and other contents of the bullet screen and the characters.
In this embodiment, after the user watching the live broadcast establishes the long connection with the long connection server, the message sent by the user is submitted to the long connection server. The long connection server performs first-level current limiting on a message sent by a user to obtain a first-level current limiting message, and transmits the obtained first-level current limiting message to a live broadcast room server (refer to reference numeral 1 in fig. 1), and the live broadcast room server receives the first-level current limiting message.
In one embodiment, the long connection server may employ a leaky bucket algorithm to first level throttle messages sent by users.
In another embodiment, the long connection server may employ a token bucket algorithm to first level throttle messages sent by users. The principle of the token bucket algorithm is that tokens are put into a token bucket at a constant speed, if a service processing request occurs, the tokens need to be obtained from the token bucket, if the tokens can be obtained, the next operation is continued, otherwise, the set speed is exceeded, and the service of the service processing request exceeding the set speed is rejected. In the live broadcast application of the embodiment, the leaky bucket algorithm is used for limiting the flow of messages sent by the user, which can limit the average transmission rate of data and also allow some degree of burst transmission.
In a specific example, when the message amount of the live broadcast messages is greater than a first preset threshold, for example, 100 ten thousand messages per second, in the long connection server, the live broadcast messages may be subjected to first current limiting, for example, current limiting may be performed according to a proportion of 90% of the message amount per second, and the live broadcast messages subjected to the first-stage current limiting may be pushed to the live broadcast server. In this embodiment, the long connection server performs current limiting on 100 ten thousand live broadcast messages per second according to a proportion of 90% of the message amount per second, and then remains 10 ten thousand messages per second, and only needs to push 10 ten thousand messages per second to the live broadcast server.
And if the message quantity of the live broadcast messages after the first-stage current limiting is larger than a second preset threshold value, executing the step 102, otherwise, no further current limiting can be performed on the live broadcast messages, and the live broadcast messages can be directly sent to a message queue for caching.
And 102, carrying out second-stage current limiting on the received first-stage current limiting message to obtain a second-stage current limiting message.
In this embodiment, after receiving the first-stage current limiting message, the live broadcast room server performs second-stage current limiting on the received first-stage current limiting message to obtain a second-stage current limiting message if the message amount of the live broadcast room message subjected to the first-stage current limiting is greater than a second preset threshold, where the second-stage current limiting message is obtained by performing second-stage current limiting on the live broadcast room message subjected to the first-stage current limiting.
In one embodiment, the live room server may perform a second level of throttling on the received first level of throttling messages using a leaky bucket algorithm.
In another embodiment, the live room server may employ a token bucket algorithm to second level throttle the received first level throttled messages. And performing secondary current limiting on the first-stage current limiting message by adopting a leaky bucket algorithm, so that the average transmission rate of data can be limited, and certain degree of burst transmission can be allowed.
In the above specific example, after the message reaches the live broadcast room server, if the live broadcast room server pushes the message queue according to the message amount of 10 ten thousand messages per second, the message amount is still large and is greater than a second preset threshold, for example, 8 ten thousand messages per second, and before the live broadcast room server pushes the message queue, the second current limiting is performed according to a proportion of 90% of the message amount per second. After the second stage of current limiting is completed, 1 ten thousand messages per second still remain to be pushed into the message queue.
And 103, sending the second-level current limiting message to a message queue for caching.
In this embodiment, the live broadcast room server sends the second-level current limiting message to a message queue (refer to reference numeral 2 in fig. 1) for caching, so as to perform functions of service decompression, traffic peak clipping, and the like.
In the live broadcast message throttling method of this embodiment, if the message amount of the live broadcast message is greater than the first preset threshold, the message amount of the live broadcast message (namely the first current limiting message) obtained after the first-stage current limiting is carried out on the live broadcast message is larger than a second preset threshold value, then the second level current limiting is carried out to the received first level current limiting message to obtain a second level current limiting message, the second level current limiting message is sent to a message queue for caching, thus, the multi-stage current limiting of the live broadcast messages can reduce or avoid the unstable live broadcast service caused by the large impact on the live broadcast system when the message amount of the live broadcast messages is large, the second stage current limiting messages are sent to the message queue and cached, the method can further buffer peak flow and reduce the pressure of live broadcast service, thereby improving the stability of the live broadcast service system to a certain extent.
In a second aspect, the present embodiment provides a live broadcast room message current limiting method, which improves stability of a live broadcast service system to a certain extent.
Fig. 3 is a schematic flow chart of a live broadcast room message throttling method according to another embodiment of the present invention, and referring to fig. 3, the method of the present embodiment includes:
The first-stage current-limiting message is obtained after first-stage current limiting is carried out on the live broadcast room message when the message quantity of the live broadcast room message is larger than a first preset threshold value. The live broadcast room message refers to text content in a live broadcast system, and comprises the following steps: and interactive chatting and other contents of the bullet screen and the characters.
In this embodiment, after the user watching the live broadcast establishes the long connection with the long connection server, the message sent by the user is submitted to the long connection server. The long connection server performs first-level current limiting on a message sent by a user to obtain a first-level current limiting message, and transmits the obtained first-level current limiting message to a live broadcast room server (refer to reference numeral 1 in fig. 1), and the live broadcast room server receives the first-level current limiting message.
In one embodiment, the long connection server may employ a leaky bucket algorithm to first level throttle messages sent by users.
In another embodiment, the long connection server may employ a token bucket algorithm to first level throttle messages sent by users. The principle of the token bucket algorithm is that tokens are put into a token bucket at a constant speed, if a service processing request occurs, the tokens need to be obtained from the token bucket, if the tokens can be obtained, the next operation is continued, otherwise, the set speed is exceeded, and the service of the service processing request exceeding the set speed is rejected. In the live broadcast application of the embodiment, the leaky bucket algorithm is used for limiting the flow of messages sent by the user, which can limit the average transmission rate of data and also allow some degree of burst transmission.
In a specific example, when the message amount of the live broadcast messages is greater than a first preset threshold, for example, 100 ten thousand messages per second, in the long connection server, the live broadcast messages may be subjected to first current limiting, for example, current limiting may be performed according to a proportion of 90% of the message amount per second, and the live broadcast messages subjected to the first-stage current limiting may be pushed to the live broadcast server. In this embodiment, the long connection server performs current limiting on 100 ten thousand live broadcast messages per second according to a proportion of 90% of the message amount per second, and then remains 10 ten thousand messages per second, and only needs to push 10 ten thousand messages per second to the live broadcast server.
In one embodiment, the live broadcast system is a distributed system, and there are multiple long connection servers and live room servers, and the messages in the live room may be on any long connection server. Because the messages in the same live broadcast room carry the same live broadcast room identification, the messages belonging to the same live broadcast room can be obtained by identifying the live broadcast room identification carried in the messages in each live broadcast room. In order to realize more accurate current limiting of the messages in the live broadcast room, the long-connection server adopts a strategy of classifying and identifying live broadcast room IDs (identification numbers) carried in the messages in the live broadcast room, and the messages in the same live broadcast room are only pushed to one live broadcast room server to be processed. Therefore, the first-level current limiting message received by the live broadcast room server is a message belonging to the same live broadcast room, so that more accurate current limiting can be conveniently carried out.
If the message amount of the live broadcast messages after the first-stage current limiting is larger than a second preset threshold value, the step 202 is executed, otherwise, the live broadcast messages can not be subjected to advanced current limiting any more, and the messages can be directly sent to a message queue for buffering.
In this embodiment, after receiving the first-stage current limiting message, the live broadcast room server performs second-stage current limiting on the received first-stage current limiting message to obtain a second-stage current limiting message if the message amount of the live broadcast room message subjected to the first-stage current limiting is greater than a second preset threshold, where the second-stage current limiting message is obtained by performing second-stage current limiting on the live broadcast room message subjected to the first-stage current limiting.
In one embodiment, the live room server may perform a second level of throttling on the received first level of throttling messages using a leaky bucket algorithm.
In another embodiment, the live room server may employ a token bucket algorithm to second level throttle the received first level throttled messages. And performing secondary current limiting on the first-stage current limiting message by adopting a leaky bucket algorithm, so that the average transmission rate of data can be limited, and certain degree of burst transmission can be allowed.
In the above specific example, after the message reaches the live broadcast room server, if the live broadcast room server pushes the message queue according to the message amount of 10 ten thousand messages per second, the message amount is still large and is greater than a second preset threshold, for example, 8 ten thousand messages per second, and before the live broadcast room server pushes the message queue, the second current limiting is performed according to a proportion of 90% of the message amount per second. After the second stage of current limiting is completed, 1 ten thousand messages per second still remain to be pushed into the message queue.
And 203, sending the second-level current limiting message to a message queue for buffering.
In this embodiment, the live broadcast room server sends the second-level current limiting message to a message queue (refer to reference numeral 2 in fig. 1) for caching, so as to perform functions of service decompression, traffic peak clipping, and the like.
And 204, obtaining the cached message from the message queue, and performing third-level current limiting on the obtained message to obtain a third-level current limiting message.
In this embodiment, the live broadcast room server obtains the cached message from the message queue (refer to reference numeral 3 in fig. 1), and if the message amount of the cached message obtained from the message queue is greater than a third preset threshold, performs a third level current limiting on the message obtained from the message queue, where the third level current limiting is a message obtained by performing a third level current limiting on the live broadcast room message that has passed through the second level current limiting. If the message amount of the cached messages acquired from the message queue is not greater than a third preset threshold, no further current limiting processing can be performed on the messages acquired from the message queue.
In one embodiment, the live room server may use a leaky bucket algorithm to perform a third level of throttling on the captured messages.
In another embodiment, the live room server may employ a token bucket algorithm to second level throttle the received first level throttled messages. And the third-stage current limiting is carried out on the acquired messages by adopting a leaky bucket algorithm, so that the average transmission rate of data can be limited, and certain degree of burst transmission can be allowed.
And step 205, sending the third-level current limiting message to a long-connection server, so as to be pushed to the terminal equipment of the user through the long-connection server.
In this embodiment, the live broadcast room server sends the third level current limiting message to the long connection server, so as to be pushed to the terminal device of the user through the long connection server, so that the live broadcast room message after passing through the first level current limiting, the second level current limiting, and the third level current limiting is displayed in the live broadcast room displayed on the display screen of the terminal device.
In an embodiment, in order to improve the reading experience of the client in the terminal device, the amount of messages pushed to each live broadcast room may be 50 messages per second.
In the live broadcast room message current limiting method of this embodiment, if the message amount of the live broadcast room message is greater than a first preset threshold, the message amount of the live broadcast room message (i.e., a first current limiting message) obtained by performing first-stage current limiting on the live broadcast room message is greater than a second preset threshold, then performing second-stage current limiting on the received first-stage current limiting message to obtain a second-stage current limiting message; the second-level current limiting message is sent to a message queue for caching, if the message quantity of the cached message obtained from the message queue is larger than a third preset threshold value, third-level current limiting is carried out on the message obtained from the message queue to obtain a third-level current limiting message, so that the situation that live broadcast service is unstable due to the fact that large impact is easily caused to a live broadcast system when the message quantity of the live broadcast message is large can be reduced or avoided by carrying out multi-level current limiting on the live broadcast message, the second-level current limiting message is sent to the message queue for caching, peak flow buffering can be further achieved, the live broadcast service pressure is relieved, and therefore the stability of the live broadcast service system is improved to a certain extent.
It should be understood that, in this embodiment, performing third-level current limiting on a message is an optional step, and if third-level current limiting is not performed, the live broadcast room server directly sends the cached message obtained from the message queue to the long connection server, so as to push the message to the terminal device of the user through the long connection server, so that the message is displayed in the live broadcast room.
In the process of limiting the flow of the message, if a traditional blocking mode is adopted, CPU waiting is generated, so that the blocking of the service is caused, and the normal operation of the service is influenced. In order to avoid this problem, in this embodiment, a non-blocking manner is adopted, that is, the execution of the main thread service is not affected by the current limiting, and meanwhile, when the current limiting is performed by using the Token bucket algorithm, a timeout expiration mechanism may be provided for obtaining the current limiting Token (Token), and if the waiting time exceeds a preset value, the current limiting is considered to be timeout.
In a third aspect, the present embodiment provides a live broadcast room message current limiting apparatus, which improves stability of a live broadcast service system to a certain extent.
Fig. 4 is a schematic structural diagram of a message throttling device in a live broadcast room according to an embodiment of the present invention, and referring to fig. 4, the device in this embodiment includes a message receiving module 11, a secondary throttling module 12, and a first message sending module 13; the message receiving module 11 is configured to receive a first-stage current limiting message, where the first-stage current limiting message is obtained by performing first-stage current limiting on a live broadcast message when a message amount of the live broadcast message is greater than a first preset threshold; the secondary current limiting module 12 is configured to perform secondary current limiting on the received first-stage current limiting message to obtain a second-stage current limiting message if the message amount of the live broadcast room message subjected to the first-stage current limiting is greater than a second preset threshold, where the second-stage current limiting message is obtained by performing secondary current limiting on the live broadcast room message subjected to the first-stage current limiting; the first message sending module 13 is configured to send the second level current limiting message to a message queue for caching.
The apparatus of this embodiment may be used to implement the technical solution of the method embodiment shown in fig. 2, and the implementation principle and the technical effect are similar, which are not described herein again.
In a fourth aspect, the present embodiment provides another live broadcast room message throttling device, which improves the stability of a live broadcast service system to a certain extent.
Fig. 5 is a schematic structural diagram of a live broadcast room message current limiting apparatus according to another embodiment of the present invention, and referring to fig. 5, the apparatus of this embodiment is based on the apparatus shown in fig. 4, where the received first-level current limiting message is a message belonging to the same live broadcast room; the messages of the same live broadcast room are obtained according to identification of live broadcast room identifications carried in the messages of the live broadcast rooms, and the messages of the same live broadcast room carry the same live broadcast room identifications.
In an embodiment, the apparatus may further comprise: and the third-stage current limiting module 14 is configured to obtain the cached message from the message queue, and if the message amount of the cached message obtained from the message queue is greater than a third preset threshold, perform third-stage current limiting on the message obtained from the message queue to obtain a third-stage current limiting message, where the third-stage current limiting is obtained by performing third-stage current limiting on the live broadcast room message after the second-stage current limiting.
In an embodiment, the apparatus may further comprise: and the second message sending module 15 is configured to send the third-level current limiting message to the long connection server, so as to push the third-level current limiting message to the terminal device of the user through the long connection server, so that the live broadcast room message after passing through the first-level current limiting, the second-level current limiting, and the third-level current limiting is displayed in a live broadcast room displayed on a display screen of the terminal device.
In an embodiment, the secondary current limiting module may be specifically configured to perform secondary current limiting on the received primary current limiting message by using a token bucket algorithm to obtain a secondary current limiting message.
In an embodiment, the third-stage current limiting module may be specifically configured to obtain the cached message from the message queue, and perform third-stage current limiting on the obtained message by using a token bucket algorithm.
The apparatus of this embodiment may be used to implement the technical solutions of the method embodiments shown in fig. 2 or fig. 3, and the implementation principles and technical effects are similar, which are not described herein again.
It should be understood that, in this embodiment, it is optional that the third-level current limiting module performs third-level current limiting on the message, and if the third-level current limiting is not performed, the message obtained from the message queue and cached may be directly sent to the long-connection server, so as to be pushed to the terminal device of the user through the long-connection server, so that the message is displayed in the live broadcast.
Fig. 6 is a schematic structural diagram of an embodiment of the electronic device of the present invention, and may implement the processes of the embodiments shown in fig. 2 to fig. 3 of the present invention, as shown in fig. 6, where the electronic device may include: the device comprises a shell 41, a processor 42, a memory 43, a circuit board 44 and a power circuit 45, wherein the circuit board 44 is arranged inside a space enclosed by the shell 41, and the processor 42 and the memory 43 are arranged on the circuit board 44; a power supply circuit 45 for supplying power to each circuit or device of the electronic apparatus; the memory 43 is used for storing executable program code; the processor 42 executes a program corresponding to the executable program code by reading the executable program code stored in the memory 43, so as to execute the current limiting method according to any of the foregoing embodiments.
The specific execution process of the above steps by the processor 42 and the steps further executed by the processor 42 by running the executable program code may refer to the description of the embodiment shown in fig. 1 to 3 of the present invention, and are not described herein again.
The electronic device exists in a variety of forms, including but not limited to:
(1) a mobile communication device: such devices are characterized by mobile communications capabilities and are primarily targeted at providing voice, data communications. Such terminals include: smart phones (e.g., iphones), multimedia phones, functional phones, and low-end phones, among others.
(2) Ultra mobile personal computer device: the equipment belongs to the category of personal computers, has calculation and processing functions and generally has the characteristic of mobile internet access. Such terminals include: PDA, MID, and UMPC devices, etc., such as ipads.
(3) A portable entertainment device: such devices can display and play multimedia content. This type of device comprises: audio, video players (e.g., ipods), handheld game consoles, electronic books, and smart toys and portable car navigation devices.
(4) A server: the device for providing the computing service comprises a processor, a hard disk, a memory, a system bus and the like, and the server is similar to a general computer architecture, but has higher requirements on processing capacity, stability, reliability, safety, expandability, manageability and the like because of the need of providing high-reliability service.
(5) And other electronic equipment with data interaction function.
Embodiments of the present invention also provide a computer-readable storage medium, which stores one or more programs that can be executed by one or more processors to implement the method provided in any of the foregoing embodiments.
Embodiments of the present invention also provide an application program, which is executed to implement the method provided in any of the embodiments of the present invention.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. The term "comprising", without further limitation, means that the element so defined is not excluded from the group consisting of additional identical elements in the process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments.
In particular, as for the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
For convenience of description, the above devices are described separately in terms of functional division into various units/modules. Of course, the functionality of the units/modules may be implemented in one or more software and/or hardware implementations of the invention.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (14)
1. A live broadcast room message flow limiting method is characterized by comprising the following steps:
the method comprises the steps that a live broadcast room server receives a first-stage current limiting message from a long connection server, when the message quantity of the first-stage current limiting message is larger than a first preset threshold value, the long connection server carries out first-stage current limiting on the live broadcast room message to obtain the message, wherein long connection is established between terminal equipment of a user and the long connection server, the live broadcast room message is submitted to the long connection server when being sent, and the long connection server transmits the live broadcast message to the live broadcast room server;
if the message amount of the live broadcast room message after the first-stage current limiting is larger than a second preset threshold value, the live broadcast room server performs second-stage current limiting on the received first-stage current limiting message to obtain a second-stage current limiting message, wherein the second-stage current limiting message is obtained after performing second-stage current limiting on the live broadcast room message after the first-stage current limiting;
and sending the second-stage current limiting message to a message queue for buffering.
2. The live broadcast room message flow limiting method of claim 1, wherein the received first level flow limiting message is a message belonging to the same live broadcast room; the messages of the same live broadcast room are obtained according to identification of live broadcast room identifications carried in the messages of the live broadcast rooms, and the messages of the same live broadcast room carry the same live broadcast room identifications.
3. The live room message throttling method of claim 1, wherein after sending the second level throttling message to a message queue for buffering, the method further comprises:
obtaining the cached message from the message queue;
and if the message quantity of the cached messages acquired from the message queue is larger than a third preset threshold value, performing third-stage current limiting on the messages acquired from the message queue to acquire third-stage current limiting messages, wherein the third-stage current limiting is acquired after performing third-stage current limiting on the live broadcast messages subjected to second-stage current limiting.
4. The live room message throttling method of claim 3, wherein after tertiary throttling of the retrieved message, the method further comprises:
and sending the third-level current limiting message to a long-connection server so as to be pushed to the terminal equipment of a user through the long-connection server, so that the live broadcasting room message passing through the first-level current limiting, the second-level current limiting and the third-level current limiting is displayed in a live broadcasting room displayed on a display screen of the terminal equipment.
5. The live broadcast room message throttling method of claim 1, wherein said second throttling the received first throttling message to obtain a second throttling message comprises:
and carrying out secondary current limiting on the received primary current limiting message by adopting a token bucket algorithm to obtain a secondary current limiting message.
6. The live room message throttling method of claim 3, wherein said third level throttling of the messages retrieved from the message queue comprises:
and performing third-stage current limiting on the messages acquired from the message queue by adopting a token bucket algorithm.
7. A live room message throttling apparatus, comprising:
the message receiving module is used for receiving a first-stage current limiting message from a long connection server through a live broadcast room server, wherein the first-stage current limiting message is obtained after the first-stage current limiting is carried out on the live broadcast room message through the long connection server when the message quantity of the live broadcast room message is larger than a first preset threshold value, the long connection is established between terminal equipment of a user and the long connection server, the live broadcast room message is submitted to the long connection server when being sent, and the live broadcast message is transmitted to the live broadcast room server through the long connection server;
the second-stage current limiting module is used for carrying out second-stage current limiting on the received first-stage current limiting message to obtain a second-stage current limiting message if the message quantity of the live broadcast room message subjected to the first-stage current limiting is larger than a second preset threshold value, wherein the second-stage current limiting message is obtained after the second-stage current limiting is carried out on the live broadcast room message subjected to the first-stage current limiting;
and the first message sending module is used for sending the second-level current limiting message to a message queue for caching.
8. The live room message throttling apparatus of claim 7, wherein the received first level current limiting message is a message belonging to the same live room; the messages of the same live broadcast room are obtained according to identification of live broadcast room identifications carried in the messages of the live broadcast rooms, and the messages of the same live broadcast room carry the same live broadcast room identifications.
9. The live room message throttling apparatus of claim 7, further comprising:
and the third-level current limiting module is used for acquiring the cached messages from the message queue, and if the message quantity of the cached messages acquired from the message queue is greater than a third preset threshold value, performing third-level current limiting on the messages acquired from the message queue to acquire third-level current limiting messages, wherein the third-level current limiting is acquired after performing third-level current limiting on the live broadcast messages after the second-level current limiting.
10. The live room message throttling apparatus of claim 9, further comprising:
and the second message sending module is used for sending the third-level current limiting message to the long-connection server so as to be pushed to the terminal equipment of the user through the long-connection server, so that the live broadcasting room message after the first-level current limiting, the second-level current limiting and the third-level current limiting is displayed in a live broadcasting room displayed on a display screen of the terminal equipment.
11. The live broadcast room message throttling apparatus of claim 7, wherein the secondary throttling module is specifically configured to perform secondary throttling on the received primary throttling message using a token bucket algorithm to obtain a secondary throttling message.
12. The live broadcast room message throttling apparatus of claim 9, wherein the tertiary throttling module is specifically configured to obtain the cached message from the message queue, and perform tertiary throttling on the obtained message by using a token bucket algorithm.
13. An electronic device, characterized in that the electronic device comprises: the device comprises a shell, a processor, a memory, a circuit board and a power circuit, wherein the circuit board is arranged in a space enclosed by the shell, and the processor and the memory are arranged on the circuit board; a power supply circuit for supplying power to each circuit or device of the electronic apparatus; the memory is used for storing executable program codes; the processor executes a program corresponding to the executable program code by reading the executable program code stored in the memory for performing the method of any one of the preceding claims 1 to 6.
14. A computer readable storage medium, characterized in that the computer readable storage medium stores one or more programs which are executable by one or more processors to implement the method of any of the preceding claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810189283.7A CN110248211B (en) | 2018-03-07 | 2018-03-07 | Live broadcast room message current limiting method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810189283.7A CN110248211B (en) | 2018-03-07 | 2018-03-07 | Live broadcast room message current limiting method and device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110248211A CN110248211A (en) | 2019-09-17 |
CN110248211B true CN110248211B (en) | 2021-08-24 |
Family
ID=67882051
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810189283.7A Active CN110248211B (en) | 2018-03-07 | 2018-03-07 | Live broadcast room message current limiting method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110248211B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110636318A (en) * | 2019-09-23 | 2019-12-31 | 北京达佳互联信息技术有限公司 | Message display method, message display device, client device, server and storage medium |
CN111414516A (en) * | 2020-03-17 | 2020-07-14 | 北京字节跳动网络技术有限公司 | Live broadcast room message processing method and device, electronic equipment and storage medium |
CN113469661A (en) * | 2021-07-21 | 2021-10-01 | 上海浦东发展银行股份有限公司 | Service current limiting method, device, computer equipment and storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104539514A (en) * | 2014-12-17 | 2015-04-22 | 广州酷狗计算机科技有限公司 | Information filtering method and device |
CN105916057A (en) * | 2016-04-18 | 2016-08-31 | 乐视控股(北京)有限公司 | Video barrage display method and device |
CN106993234A (en) * | 2017-03-22 | 2017-07-28 | 北京潘达互娱科技有限公司 | Barrage display methods and device |
WO2017185640A1 (en) * | 2016-04-29 | 2017-11-02 | 乐视控股(北京)有限公司 | Bullet-screen generation and display method, and device, server, and client thereof |
CN107371056A (en) * | 2017-07-18 | 2017-11-21 | 北京蜜莱坞网络科技有限公司 | A kind of method and apparatus for loading barrage |
CN107592578A (en) * | 2017-09-22 | 2018-01-16 | 广东欧珀移动通信有限公司 | Information processing method, device, terminal device and storage medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7809773B2 (en) * | 2007-12-21 | 2010-10-05 | Yahoo! Inc. | Comment filters for real-time multimedia broadcast sessions |
-
2018
- 2018-03-07 CN CN201810189283.7A patent/CN110248211B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104539514A (en) * | 2014-12-17 | 2015-04-22 | 广州酷狗计算机科技有限公司 | Information filtering method and device |
CN105916057A (en) * | 2016-04-18 | 2016-08-31 | 乐视控股(北京)有限公司 | Video barrage display method and device |
WO2017185640A1 (en) * | 2016-04-29 | 2017-11-02 | 乐视控股(北京)有限公司 | Bullet-screen generation and display method, and device, server, and client thereof |
CN106993234A (en) * | 2017-03-22 | 2017-07-28 | 北京潘达互娱科技有限公司 | Barrage display methods and device |
CN107371056A (en) * | 2017-07-18 | 2017-11-21 | 北京蜜莱坞网络科技有限公司 | A kind of method and apparatus for loading barrage |
CN107592578A (en) * | 2017-09-22 | 2018-01-16 | 广东欧珀移动通信有限公司 | Information processing method, device, terminal device and storage medium |
Non-Patent Citations (1)
Title |
---|
基于IPv6的P2P流量识别与控制的研究;许佳;《中国优秀硕士学位论文全文数据库 信息科技辑》;20090115(第1期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN110248211A (en) | 2019-09-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110248211B (en) | Live broadcast room message current limiting method and device, electronic equipment and storage medium | |
CN104539514B (en) | Information filtering method and device | |
US20170163580A1 (en) | Interactive method and device for playback of multimedia | |
CN109617852B (en) | Method and device for preventing network addiction based on flow analysis | |
CN106326137B (en) | Memory optimization method and device and user equipment | |
CN108452525B (en) | Method and system for monitoring chat information in game | |
CN109698809B (en) | Method and device for identifying abnormal login of account | |
CN112311684B (en) | Burst traffic processing method, computer device and readable storage medium | |
CN112418580A (en) | Risk control method, computer equipment and readable storage medium | |
CN110932960A (en) | Social software-based fraud prevention method, server and system | |
CN112312145B (en) | Access server, burst traffic caching method, system, computer device and readable storage medium | |
CN111541555A (en) | Group chat optimization method and related product | |
CN107182042A (en) | Short message channel method for evaluating quality, device, medium and system | |
US20070294359A1 (en) | System and method of implementing remote access and control of registered personal appliances via instant messaging | |
CN114338102A (en) | Security detection method and device, electronic equipment and storage medium | |
CN107978014B (en) | Particle rendering method and device, electronic equipment and storage medium | |
CN108076149B (en) | Session maintaining method and device | |
CN106971296B (en) | Method for processing information object, electronic equipment and storage medium | |
CN106487653B (en) | Message processing method and server | |
CN106933323B (en) | Method and device for optimizing power consumption of application program and electronic equipment | |
CN115987625A (en) | Malicious traffic detection method and device and electronic equipment | |
CN110933122B (en) | Method, apparatus and computer storage medium for managing server | |
CN114466215B (en) | Data processing method and device | |
CN116320518A (en) | Live message current limiting method, device, equipment and storage medium | |
US20170171330A1 (en) | Method for pushing information and electronic device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
TA01 | Transfer of patent application right |
Effective date of registration: 20210607 Address after: 25, 5th floor, shuangjingfang office building, 3 frisha street, Singapore Applicant after: Zhuomi Private Ltd. Address before: Room 1101, Santai Commercial Building, 139 Connaught Road, Hong Kong, China Applicant before: HONG KONG LIVE.ME Corp.,Ltd. |
|
TA01 | Transfer of patent application right | ||
GR01 | Patent grant | ||
GR01 | Patent grant |