Push method and push apparatus for live streaming message, and electronic device and storage medium
By introducing target push servers and storage servers, efficient push of client messages in the live broadcast room is achieved, the problem of large number of push interface calls in the existing technology is solved, and the efficiency and reliability of message push in the live broadcast room is improved.
Patent Information
- Application Number
- PCT/CN2024/096785
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-05-31
- Filing Date
- 2024-05-31
- Publication Date
- 2024-12-05
AI Technical Summary
In live broadcast scenarios, the existing technology has a problem of write amplification. The push of client messages in the live broadcast room requires traversing all clients, resulting in large amounts of calls to the push interface and low efficiency.
By introducing a target push server between the live service server and the target push server, we will push messages to multiple clients in a unified manner, reduce the number of calls to the push interface by the service server, and add a storage server to the message push server architecture, using preset cycles Batch processing of messages to be pushed.
It effectively reduces the number of calls to the push interface, improves the efficiency of message push, reduces the load of the service server, and improves the timeliness and reliability of message push in the live broadcast room.
Smart Images

Figure CN2024096785_05122024_PF_FP_ABST
Abstract
Description
Live message push method, push device, electronic device and storage medium
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application is based on the Chinese application with application number 202310637731.6 and application date May 31, 2023, and claims its priority. The disclosed content of the Chinese application is hereby introduced as a whole into this application. Technical Field
[0003] The present application belongs to the field of live broadcast technology, and specifically relates to a method for pushing live broadcast messages, a pushing device, an electronic device, and a storage medium. Background Art
[0004] In related technologies, in live broadcast scenarios, the real-time interactive messages of the live broadcast room are generally sent through a long message connection channel. Specifically, the broadcast messages of the live broadcast room need to be sent to all clients in the live broadcast room through a long message connection service. When the message needs to be sent, it is necessary to traverse all clients in the live broadcast room and push the message to all clients in the live broadcast room one by one.
[0005] The above push method has a write amplification problem. The number of interface calls required to push messages is equal to the number of clients in the live broadcast room, resulting in a large number of push interface calls.
[0006] Summary of the Invention
[0007] The purpose of the embodiments of the present application is to provide a method, a device, an electronic device and a storage medium for pushing live messages, which can at least partially solve the above-mentioned technical problems.
[0008] In a first aspect, an embodiment of the present application provides a method for pushing live broadcast messages, which is applied to a live broadcast service server. The live broadcast service server is used to send messages to the client corresponding to the live broadcast room. The method for pushing live broadcast messages includes:
[0009] Determine the target live broadcast room associated with the target message;
[0010] The target message is sent to the target push server corresponding to the target live broadcast room, so that the target push server pushes the target message to multiple clients, where the multiple clients are multiple clients corresponding to the target live broadcast room.
[0011] In a second aspect, an embodiment of the present application provides a method for pushing a live message, which is applied to a target push server. The method for pushing a live message includes:
[0012] Obtain a target message sent by a live broadcast service server, wherein the target message is associated with a target live broadcast room, the target live broadcast room is associated with a target push server, and the target live broadcast room is associated with multiple clients;
[0013] Send targeted messages to multiple clients through association with multiple clients.
[0014] In a third aspect, an embodiment of the present application provides a live broadcast message push device, which is applied to a live broadcast service server. The live broadcast service server is used to send messages to the client corresponding to the live broadcast room. The live broadcast message push device includes:
[0015] A determination module, used to determine a target live broadcast room associated with a target message;
[0016] The sending module is used to send the target message to the target push server corresponding to the target live broadcast room, so that the target push server can push the target message to multiple clients, where the multiple clients are multiple clients corresponding to the target live broadcast room.
[0017] In a fourth aspect, an embodiment of the present application provides a live message push device, which is applied to a target push server. The live message push device includes:
[0018] An acquisition module is used to acquire a target message sent by a live broadcast service server, wherein the target message is associated with a target live broadcast room, the target live broadcast room is associated with a target push server, and the target live broadcast room is associated with multiple clients;
[0019] The sending module is used to send target messages to multiple clients through association relationships with multiple clients.
[0020] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising: a memory for storing programs or instructions; and a processor for implementing the steps of the method of the first aspect and / or the second aspect when executing the programs or instructions.
[0021] In a sixth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method of the first aspect and / or the second aspect are implemented.
[0022] In the seventh aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the steps of the method of the first aspect and / or the second aspect.
[0023] In an eighth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method of the first aspect and / or the second aspect.
[0024] In the embodiment of the present application, clients in the same live broadcast room are connected to the same connection layer instance, that is, the target message of the target live broadcast room is pushed through the target push server. When the live broadcast service server needs to push the target message to the client in the target live broadcast room, it locates the target live broadcast room based on the message to be pushed, and further locates the target push server associated with the target live broadcast room. The target push server then pushes the message to multiple clients watching the live broadcast in the target live broadcast room. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] FIG1 shows a flowchart of a method for pushing a live broadcast message according to an embodiment of the present application;
[0026] FIG2 shows one of the schematic diagrams of the architecture of the live broadcast system according to an embodiment of the present application;
[0027] FIG3 shows a second schematic diagram of the architecture of the live broadcast system according to an embodiment of the present application;
[0028] FIG4 shows a second flowchart of a method for pushing live broadcast messages according to an embodiment of the present application;
[0029] FIG5 shows a third schematic diagram of the architecture of the live broadcast system according to an embodiment of the present application;
[0030] FIG6 shows a fourth schematic diagram of the architecture of the live broadcast system according to an embodiment of the present application;
[0031] FIG7 shows a fifth schematic diagram of the architecture of the live broadcast system according to an embodiment of the present application;
[0032] FIG8 shows one structural block diagram of a device for pushing live messages according to an embodiment of the present application;
[0033] FIG9 shows a second structural block diagram of the apparatus for pushing live broadcast messages according to an embodiment of the present application;
[0034] FIG10 shows a structural block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0035] The following will be combined with the accompanying drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the embodiments described are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field are within the scope of protection of this application.
[0036] The terms "first," "second," and the like in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of this application can be implemented in an order other than that illustrated or described herein, and that the objects distinguished by "first," "second," and the like are generally of the same type, and do not limit the number of objects; for example, the first object can be one or more. In addition, the term "and / or" in the specification and claims refers to at least one of the connected objects, and the character " / " generally indicates that the objects connected are in an "or" relationship.
[0037] The following, in conjunction with the accompanying drawings, describes in detail the live message push method, push device, electronic device and storage medium provided by the embodiments of the present application through specific embodiments and their application scenarios.
[0038] In some embodiments of the present application, a method for pushing a live broadcast message is provided, which is applied to a live broadcast service server. FIG1 shows one flow chart of the method for pushing a live broadcast message according to an embodiment of the present application. As shown in FIG1 , the method for pushing a live broadcast message includes:
[0039] Step 102, determining a target live broadcast room associated with the target message;
[0040] Step 104: Send the target message to the target push server corresponding to the target live broadcast room, so that the target push server can push the target message to multiple clients;
[0041] Among them, the multiple clients are multiple clients corresponding to the target live broadcast room, that is, the audience clients connected to the target live broadcast room to watch the live broadcast.
[0042] In an embodiment of the present application, for a live broadcast scenario, real-time communication messages within the live broadcast room are generally sent by the live broadcast service server through a long connection service, specifically through a message distribution server, that is, a push server to all clients in the corresponding live broadcast room, thereby realizing real-time synchronous push of live broadcast room messages, such as barrage, broadcast and other messages.
[0043] For example, during the live broadcast of the target live broadcast room, the audience connected to the target live broadcast room will send live barrage messages through the audience client and participate in the live interactive activities through the live barrage messages. When a viewer client sends a barrage message, the barrage message will be sent to the live broadcast service server. The live broadcast service server needs to find the live broadcast room corresponding to the barrage message and push the barrage message to all clients in the target live broadcast room through the long connection service, so that all users watching the live broadcast can see the barrage message. In the related art, when pushing messages through the message long connection service, the live broadcast server needs to traverse all clients in the live broadcast room and push them to these clients one by one. There is a more serious write amplification problem in this process. For example, if there are 1 million clients connected to the live broadcast room at the same time, the service server needs to make 1 million push interface calls to complete the broadcast of a message, resulting in a large number of push interface calls.
[0044] To address the above issues, the embodiment of the present application connects the clients in the same live broadcast room to the same connection layer instance, that is, the target message of the target live broadcast room is pushed through the target push server. It can be understood that the client here refers to the client of the audience watching the live broadcast in the live broadcast room.
[0045] Specifically, Figure 2 shows one of the architectural diagrams of the live broadcast system according to an embodiment of the present application. As shown in Figure 2, when the live broadcast service server needs to push a target message to the client in the target live broadcast room, the target live broadcast room is located based on the message to be pushed, and the target push server associated with the target live broadcast room is located according to the target live broadcast room.
[0046] The business server can send the target message to be pushed to the target push server (PushServer), and the target push server will push the target message to multiple clients (Client) in the target live broadcast room (Room). Ideally, only one call to the push interface is required to complete the message push to all clients in the target live broadcast room.
[0047] As shown in Figure 2, messages from different live broadcast rooms can be pushed by different push servers. One push server can push all messages that need to be pushed to all clients in the corresponding live broadcast room at one time.
[0048] In the embodiment of the present application, a target push server is used to uniformly push messages to multiple clients watching the live broadcast in the target live broadcast room. Therefore, the live broadcast service server does not need to traverse all clients in the target live broadcast room to push the target message one by one, which effectively reduces the number of calls to the push interface and improves the efficiency of message push.
[0049] In some embodiments of the present application, sending the target message to the target push server corresponding to the target live broadcast room includes:
[0050] The target message is sent to the storage server, so that when the storage server receives the data acquisition request sent by the target push server according to a preset period, the target message is sent to the target push server through the storage server.
[0051] In an embodiment of the present application, if the speed at which messages are generated in the live broadcast room is very fast, and the number of live broadcast rooms corresponding to the push server is also large, for example, the push server is connected to 100 live broadcast rooms, and these 100 live broadcast rooms generate an average of 100 messages per second. If the push server pushes each message one by one, the business server needs to call the push interface 100×100=10,000 times per second to complete the delivery of all messages.
[0052] To further reduce the number of push interface calls, the present embodiment adds a storage server to the message push server architecture. Figure 3 shows a second schematic diagram of the live broadcast system architecture according to an embodiment of the present application. As shown in Figure 3, the live broadcast system includes a business server, message storage, push service, and a client connected to any live broadcast room.
[0053] When pushing live broadcast messages, the business server no longer pushes each message of each live broadcast room one by one, but sends the target messages that need to be pushed to the storage server in a unified manner.
[0054] The storage server saves the received target message, and the target push server of the access layer obtains the to-be-pushed message stored in the storage server by accessing the storage server according to a preset period, and the to-be-pushed message includes the target message.
[0055] Taking a preset period of 1 second as an example, the business server sends every message generated in each live broadcast room to the storage server. Every 1 second, the push server retrieves a batch of messages to be pushed from the storage server. Each time the push server retrieves messages to be pushed, it only retrieves messages associated with its own live broadcast room. That is, the target push server only needs to retrieve the target messages for the target live broadcast room.
[0056] After the target server obtains the target message, it sends the target message in batches to multiple clients in the target live broadcast room. Therefore, the target server only needs to obtain the message to be pushed once in each preset period, which can effectively reduce the number of calls to the push interface.
[0057] In some embodiments of the present application, before the step of determining the target live broadcast room associated with the target message, the method for pushing the live broadcast message further includes:
[0058] When it is detected that the client is connected to the live broadcast room, the client is associated with the push server corresponding to the live broadcast room so that messages can be pushed to the client through the push server corresponding to the live broadcast room.
[0059] In an embodiment of the present application, the live broadcast system includes a business server, multiple push services and multiple clients connected to any live broadcast room, wherein a push server is a connection layer instance. In the live broadcast system provided by the present application, clients in the same live broadcast room are connected to the same connection layer instance as much as possible.
[0060] Therefore, when the live broadcast room is started, the live broadcast service server associates each live broadcast room with the push server. Whenever a new client connects to a live broadcast room, the client connected to the current live broadcast room will be associated with the push server that has established an association with the current live broadcast room.
[0061] When a new broadcast message is generated in the current live broadcast room, the push server associated with the current live broadcast room obtains the target message from the business server, or the push server obtains the message to be pushed containing the target message from the storage server, and pushes the message to all clients connected to the current live broadcast room, including the current client, thereby reducing the number of calls to the push interface.
[0062] In some embodiments of the present application, there are multiple target push servers, and the number of clients that establish live broadcast connections with the target live broadcast room is greater than the number threshold corresponding to any one of the multiple target push servers;
[0063] Live message push methods also include:
[0064] When the number of clients establishing live broadcast connections in the target live broadcast room changes, the number of multiple target push servers is adjusted according to the changed number of clients.
[0065] In the embodiment of the present application, when a live broadcast room is very popular and many users watch the live broadcast through the live broadcast room, a large number of clients will be connected to the live broadcast room. When the number of viewers in the live broadcast room is greater than the upper limit of the clients that a push server can support, the push service of the live broadcast room needs to be expanded.
[0066] Specifically, when the number of viewers in the target live broadcast room, specifically the number of clients that have established live broadcast connections with the target live broadcast room, exceeds the number threshold of the target push server, that is, exceeds the upper limit of the number of clients that the target push server can carry, multiple target push servers are grouped into an active cluster, and messages are pushed to multiple clients in the target live broadcast room through multiple target push servers in the active cluster.
[0067] Among them, the number of target servers in the active cluster can be dynamically adjusted according to the actual number of viewers in the current target live broadcast room. Specifically, if the number of clients connected to the target live broadcast room changes, the number of target push servers will be increased or decreased according to the changed number of clients.
[0068] For example, assuming that there are 10 target push servers in the current active cluster, and several clients enter the target live broadcast room, the number of clients in the target live broadcast room exceeds the total number of clients that can be carried by all 10 target push servers in the current active cluster. In this case, the active cluster is expanded, that is, at least one target push server is added to the active cluster.
[0069] If several clients exit the target live broadcast room, and the number of clients in the target live broadcast room is less than the total number of clients that can be carried by the 9 target push servers in the current active cluster, and the number of clients in the target live broadcast room does not show a clear increasing trend over a period of time, the active cluster will be scaled down, and one target push server will be reduced in the active cluster, leaving 9 target push servers.
[0070] By dynamically adjusting the number of target servers, the timeliness and reliability of message push can be guaranteed.
[0071] In some embodiments of the present application, a method for pushing a live broadcast message is provided, which is applied to a target push server. FIG4 shows a second flowchart of the method for pushing a live broadcast message according to an embodiment of the present application. As shown in FIG4 , the method for pushing a live broadcast message includes:
[0072] Step 402: Obtain the target message sent by the live broadcast service server;
[0073] The target message is associated with the target live broadcast room, the target live broadcast room is associated with the target push server, and the target live broadcast room is associated with multiple clients;
[0074] Step 404: Send target messages to the multiple clients through association relationships with the multiple clients.
[0075] In an embodiment of the present application, the push server is associated with the live broadcast room, so that the clients in the same live broadcast room are connected to the same connection layer instance, that is, the target message of the target live broadcast room is pushed through the target push server.
[0076] Specifically, Figure 2 shows one of the architectural diagrams of the live broadcast system according to an embodiment of the present application. As shown in Figure 2, the push server (PushServer) obtains the target message sent by the business server, and pushes the target message uniformly to multiple clients (Client) in the target live broadcast room (Room) associated with itself and corresponding to the target message.
[0077] Since the push server is used to perform unified broadcast push to clients in the same live broadcast room, ideally, only one push interface needs to be called to complete the message push to all clients in the target live broadcast room.
[0078] As shown in Figure 2, messages from different live broadcast rooms can be pushed by different push servers. One push server can push all messages that need to be pushed to all clients in the corresponding live broadcast room at one time.
[0079] In the embodiment of the present application, a target push server is used to uniformly push messages to multiple clients watching the live broadcast in the target live broadcast room. Therefore, the live broadcast service server does not need to traverse all clients in the target live broadcast room to push the target message one by one, which effectively reduces the number of calls to the push interface and improves the efficiency of message push.
[0080] In some embodiments of the present application, obtaining a target message sent by a live broadcast service server includes:
[0081] The storage server is accessed according to a preset period to obtain the messages to be pushed stored by the storage server, wherein the storage server is associated with the target live broadcast room, and the messages to be pushed include the target message.
[0082] In the embodiment of the present application, a storage server is added to the message push server architecture. As shown in Figure 3, the live broadcast system includes a business server, message storage, push service, and a client connected to any live broadcast room.
[0083] When pushing live broadcast messages, the business server no longer pushes each message to each live broadcast room one by one. Instead, it sends the target messages to be pushed to the storage server. The storage server saves the received target messages. The target push server at the access layer accesses the storage server at a preset period to obtain the messages to be pushed stored there, which include the target message.
[0084] Taking a preset period of 1 second as an example, the business server sends every message generated in each live broadcast room to the storage server. Every 1 second, the push server retrieves a batch of messages to be pushed from the storage server. Each time the push server retrieves messages to be pushed, it only retrieves messages associated with its own live broadcast room. That is, the target push server only needs to retrieve the target messages for the target live broadcast room.
[0085] After the target server obtains the target message, it sends the target message in batches to multiple clients in the target live broadcast room. Therefore, the target server only needs to obtain the message to be pushed once in each preset period, which can effectively reduce the number of calls to the push interface.
[0086] In some embodiments of the present application, the storage server includes N storage shards, where N is a positive integer;
[0087] Access the storage server according to the preset period to obtain the messages to be pushed stored by the storage server, including:
[0088] According to the target live broadcast room, determine the target storage shard among N storage shards;
[0089] The target storage shard is accessed according to a preset period to obtain the message to be pushed stored in the target storage shard by the storage server, wherein the target storage shard is associated with the target live broadcast room.
[0090] In an embodiment of the present application, when the number of live broadcast rooms increases, messages from a large number of live broadcast rooms are mixed in the storage server, which will cause the push server to search for the required message data in a large amount of data when accessing the storage server to obtain the target message of the target live broadcast room.
[0091] In order to reduce the amount of indexing, the embodiment of the present application partitions the storage server to obtain N partitioned storage shards, wherein each of the N storage shards is responsible for storing messages to be pushed from one or more live broadcast rooms, that is, each storage shard is associated with at least one live broadcast room.
[0092] Figure 5 shows the third architectural diagram of the live broadcast system according to an embodiment of the present application. As shown in Figure 5, N storage shards are set in the storage server (shard 1 and shard 2 as shown in Figure 5). When the push server associated with the target live broadcast room obtains the message to be pushed stored in the storage server, it searches for the target storage shard associated with the target live broadcast room in the N storage shards according to the live broadcast room to be pushed, and obtains the message to be pushed stored in the target storage shard by the storage server by accessing the target storage shard.
[0093] The embodiment of the present application partitions the storage server, and the push server searches for the corresponding storage shards according to the live broadcast room that needs to be pushed, thereby reducing the amount of data indexing and improving the push efficiency.
[0094] In some embodiments of the present application, the plurality of push servers correspond to M push shards, each of the M push shards includes at least one push server from the plurality of push servers, and M is a positive integer;
[0095] Before the step of accessing the storage server according to a preset period to obtain the message to be pushed stored by the storage server, the method for pushing the live message further includes:
[0096] Generate K virtual slots, where K is the product of M and N, each of the N storage shards corresponds to the M virtual slots, each of the M push shards corresponds to the N virtual slots, and each of the multiple live broadcast rooms is associated with at least one virtual slot of the K virtual slots;
[0097] Based on the target live broadcast room, determine the target storage shard among multiple storage shards, including:
[0098] Determine the target virtual slot associated with the target live broadcast room;
[0099] According to the target virtual slot, a target push slice is determined in the M push slices, and a target storage slice is determined in the N storage slices, wherein the target push slice includes a target push server, and the target push server is used to send target messages to multiple clients.
[0100] In the embodiment of the present application, the number of storage shards in the storage server is positively correlated with the number of live broadcast rooms. When the number of live broadcast rooms increases, the number of storage shards will also increase. If a push server is associated with multiple live broadcast rooms, each associated with a different storage shard in these storage shards, the push server may need to reply to the source message on many storage shards.
[0101] In order to further improve efficiency, this application shards all multiple push servers to obtain M push shards, each of which includes at least one push server, that is, each push shard is equivalent to a shard cluster of push servers.
[0102] Align the push shard with the storage shard, that is, all the messages to be pushed in the live broadcast room of a push shard are stored in a fixed storage shard. Therefore, the push server in each push shard only needs to access the fixed storage shard to obtain the required messages to be pushed, which can effectively reduce the amount of data search.
[0103] Specifically, in order to align push slices with storage slices, the concept of virtual slots can be introduced. For example, if a storage server includes 10 storage slices and multiple push servers include 100 push slices, the number of virtual slots can be set to 1000.
[0104] For each live broadcast room, the virtual slot identifier (slotID) of each live broadcast room is determined according to the identifier (RoomID) of the live broadcast room. For example, slotID=hashRoomID%1000.
[0105] When the message to be pushed is saved to the storage server, it is stored in 10 storage shards according to the range of virtual slots. The number of virtual slots corresponding to each storage shard is 1000 ÷ 10 = 100. For example, the corresponding relationship between slotID and storage shard is:
[0106] Dockerfile:
[0107] Storage shard 1 --> slot 1 to slot 100;
[0108] Storage shard 2 --> slot 101 to slot 200;
[0109] …
[0110] Storage shard 10 --> slot 901 to slot 1000.
[0111] That is to say, the messages to be pushed of the live broadcast room whose virtual slots are identified as slot1 to slot100 are stored in storage shard 1, the messages to be pushed of the live broadcast room whose virtual slots are identified as slot101 to slot200 are stored in storage shard 2, and so on.
[0112] The push server is also sharded according to the above virtual slots. Since there are 100 push shards, the number of push shards corresponding to each storage shard is 1000 ÷ 100 = 10. When the client establishes a connection with the push server, the corresponding relationship between slotID and PushServer shard is:
[0113] Dockerfile:
[0114] PushServer shard 1 --> slot 1 to slot 10;
[0115] PushServer shard 2 --> slot 11 to slot 20;
[0116] …
[0117] PushServer shard 100 --> slot 990 to slot 1000.
[0118] That is to say, the push server of push shard 1 is responsible for pushing the messages to be pushed for the live broadcast rooms with virtual slots identified as slot1 to slot10, and the push server of push shard 2 is responsible for pushing the messages to be pushed for the live broadcast rooms with virtual slots identified as slot11 to slot20, and so on.
[0119] Figure 6 shows the fourth architectural diagram of the live broadcast system according to an embodiment of the present application. As shown in Figure 6, after the above-mentioned corresponding relationship is established, the push server in each push shard only needs to return the source message to the fixed storage shard according to the mapping relationship of the slotID. Within each preset period, the push messages to be pushed of one or several live broadcast rooms associated with a push shard can be returned to the source.
[0120] The embodiment of the present application shards the push server and the storage server, and divides the push shards and storage shards into shards, so that the push server can return the message to be pushed on a fixed storage shard, thereby improving the efficiency of message push.
[0121] In some embodiments of the present application, when the number of clients in a single live broadcast room exceeds the upper limit of the number of clients that a single push server can connect to, it is necessary to distribute the client load in this live broadcast room to more push servers.
[0122] For example, when a sudden increase in traffic occurs in a live broadcast room, a large number of new clients will flock in, causing the push server of the live broadcast room to expand.
[0123] Experience shows that live streaming has a significant head-to-head effect. For example, the top 5% of live streaming rooms may connect to 70% of all viewers on the platform, while the remaining 95% of live streaming rooms have fewer than 500 viewers. Furthermore, burst traffic often concentrates in these few top rooms.
[0124] In order to ensure the alignment of push shards and storage shards, an active cluster of push servers can be created separately for the top live broadcast rooms, such as the top 5% of live broadcast rooms mentioned above. The push servers in the active cluster do not perform sharding processing, and the active cluster is associated with a fixed storage shard.
[0125] For example, Figure 7 shows the fifth architectural diagram of the live broadcast system according to an embodiment of the present application. As shown in Figure 7, the active cluster set for the target live broadcast room (Room3) includes 3 target push servers. When a burst of traffic occurs, for example, the number of clients in the target live broadcast room exceeds the total number of clients that can be carried by all 3 target push servers in the current active cluster, the active cluster can be expanded, that is, at least one target push server is added to the active cluster. By expanding the active cluster, the live broadcast system can be flexibly expanded.
[0126] The push method of live broadcast message provided in the embodiment of the present application can be executed by a push device of live broadcast message. In the embodiment of the present application, the method of pushing live broadcast message by the push device of live broadcast message is taken as an example to illustrate the push device of live broadcast message provided in the embodiment of the present application.
[0127] In some embodiments of the present application, a live broadcast message push device is provided, which is applied to a live broadcast service server. The live broadcast service server has multiple live broadcast rooms. FIG8 shows one structural block diagram of the live broadcast message push device according to an embodiment of the present application. As shown in FIG8 , the live broadcast message push device 800 includes:
[0128] A determination module 802 is configured to determine a target live broadcast room associated with a target message;
[0129] The sending module 804 is used to send the target message to the target push server corresponding to the target live broadcast room, so that the target push server can push the target message to multiple clients, where the multiple clients are multiple clients corresponding to the target live broadcast room.
[0130] When the live broadcast service server needs to push a target message to the client in the target live broadcast room, it locates the target live broadcast room based on the message to be pushed, and locates the target push server associated with the target live broadcast room based on the target live broadcast room.
[0131] The business server can send the target message to be pushed to the target push server (PushServer), and the target push server will push the target message to multiple clients (Client) in the target live broadcast room (Room). Ideally, only one call to the push interface is required to complete the message push to all clients in the target live broadcast room.
[0132] In the embodiment of the present application, a target push server is used to uniformly push messages to multiple clients watching the live broadcast in the target live broadcast room. Therefore, the live broadcast service server does not need to traverse all clients in the target live broadcast room to push the target message one by one, which effectively reduces the number of calls to the push interface and improves the efficiency of message push.
[0133] In some embodiments of the present application, the sending module is specifically used to send the target message to the storage server, so that when the storage server receives the data acquisition request sent by the target push server according to a preset period, the target message is sent to the target push server through the storage server.
[0134] In an embodiment of the present application, when pushing live broadcast messages, the business server no longer pushes each message of each live broadcast room one by one, but sends the target messages that need to be pushed to the storage server in a unified manner.
[0135] The storage server saves the received target message, and the target push server of the access layer obtains the to-be-pushed message stored in the storage server by accessing the storage server according to a preset period, and the to-be-pushed message includes the target message.
[0136] Taking a preset period of 1 second as an example, the business server sends every message generated in each live broadcast room to the storage server. Every 1 second, the push server retrieves a batch of messages to be pushed from the storage server. Each time the push server retrieves messages to be pushed, it only retrieves messages associated with its own live broadcast room. That is, the target push server only needs to retrieve the target messages for the target live broadcast room.
[0137] After the target server obtains the target message, it sends the target message in batches to multiple clients in the target live broadcast room. Therefore, the target server only needs to obtain the message to be pushed once in each preset period, which can effectively reduce the number of calls to the push interface.
[0138] In some embodiments of the present application, the apparatus for pushing live broadcast messages further includes:
[0139] The association module is used to associate the client with the push server corresponding to the live broadcast room when it is detected that the client is connected to the live broadcast room, so as to push messages to the client through the push server corresponding to the live broadcast room.
[0140] In an embodiment of the present application, when a live broadcast room is started, the live broadcast service server associates each live broadcast room with a push server. Whenever a new client connects to a live broadcast room, the client connected to the current live broadcast room will be associated with the push server that has established an association with the current live broadcast room.
[0141] When a new broadcast message is generated in the current live broadcast room, the push server associated with the current live broadcast room obtains the target message from the business server, or the push server obtains the message to be pushed containing the target message from the storage server, and pushes the message to all clients connected to the current live broadcast room, including the current client, thereby reducing the number of calls to the push interface.
[0142] In some embodiments of the present application, there are multiple target push servers, and the number of clients that establish live broadcast connections with the target live broadcast room is greater than the number threshold corresponding to any one of the multiple target push servers;
[0143] The push device for live broadcast messages also includes: an adjustment device for adjusting the number of multiple target push servers according to the changed number of clients when the number of clients establishing live broadcast connections in the target live broadcast room changes.
[0144] In an embodiment of the present application, when the number of viewers in the target live broadcast room, specifically the number of clients that have established live broadcast connections with the target live broadcast room, exceeds the number threshold of the target push server, that is, exceeds the upper limit of the number of clients that the target push server can carry, multiple target push servers are grouped into an active cluster, and messages are pushed to multiple clients in the target live broadcast room through the multiple target push servers in the active cluster.
[0145] Among them, the number of target servers in the active cluster can be dynamically adjusted according to the actual number of viewers in the current target live broadcast room. Specifically, if the number of clients connected to the target live broadcast room changes, the number of target push servers will be increased or decreased according to the changed number of clients.
[0146] By dynamically adjusting the number of target servers, the timeliness and reliability of message push can be guaranteed.
[0147] In some embodiments of the present application, a live message push device is provided, which is applied to a push server. FIG9 shows a second structural block diagram of the live message push device according to an embodiment of the present application. As shown in FIG9 , the live message push device 900 includes:
[0148] An acquisition module 902 is configured to acquire a target message sent by a live broadcast service server, wherein the target message is associated with a target live broadcast room, the target live broadcast room is associated with a target push server, and the target live broadcast room is associated with multiple clients;
[0149] The sending module 904 is configured to send a target message to multiple clients through association relationships with the multiple clients.
[0150] In an embodiment of the present application, the push server is associated with the live broadcast room, so that the clients in the same live broadcast room are connected to the same connection layer instance, that is, the target message of the target live broadcast room is pushed through the target push server.
[0151] Since the push server is used to perform unified broadcast push to clients in the same live broadcast room, ideally, only one push interface needs to be called to complete the message push to all clients in the target live broadcast room.
[0152] In the embodiment of the present application, a target push server is used to uniformly push messages to multiple clients watching the live broadcast in the target live broadcast room. Therefore, the live broadcast service server does not need to traverse all clients in the target live broadcast room to push the target message one by one, which effectively reduces the number of calls to the push interface and improves the efficiency of message push.
[0153] In some embodiments of the present application, the acquisition module is specifically used to access the storage server according to a preset period to obtain the messages to be pushed stored by the storage server, wherein the storage server is associated with the target live broadcast room, and the messages to be pushed include the target message.
[0154] In this embodiment of the present application, when pushing live broadcast messages, the service server no longer pushes each message to each live broadcast room one by one. Instead, it sends the target messages to be pushed to the storage server. The storage server saves the received target messages. The target push server at the access layer accesses the storage server according to a preset period to obtain the messages to be pushed stored in the storage server, which include the target message.
[0155] After the target server obtains the target message, it sends the target message in batches to multiple clients in the target live broadcast room. Therefore, the target server only needs to obtain the message to be pushed once in each preset period, which can effectively reduce the number of calls to the push interface.
[0156] In some embodiments of the present application, the storage server includes N storage shards, where N is a positive integer;
[0157] The push device for live broadcast messages also includes:
[0158] A determination module, configured to determine a target storage shard among N storage shards according to a target live broadcast room;
[0159] The acquisition module is specifically used to access the target storage shard according to a preset period to obtain the message to be pushed stored in the target storage shard by the storage server, wherein the target storage shard is associated with the target live broadcast room.
[0160] In an embodiment of the present application, the storage server is partitioned to obtain N partitioned storage shards, wherein each of the N storage shards is responsible for storing messages to be pushed from one or more live broadcast rooms, that is, each storage shard is associated with at least one live broadcast room.
[0161] When the push server associated with the target live broadcast room obtains the message to be pushed stored in the storage server, it searches for the target storage shard associated with the target live broadcast room in N storage shards according to the live broadcast room to be pushed, and obtains the message to be pushed stored in the target storage shard by the storage server by accessing the target storage shard.
[0162] The embodiment of the present application partitions the storage server, and the push server searches for the corresponding storage shards according to the live broadcast room that needs to be pushed, thereby reducing the amount of data indexing and improving the push efficiency.
[0163] In some embodiments of the present application, there are multiple push servers, the multiple push servers correspond to M push shards, each push shard in the M push shards includes at least one push server in the multiple push servers, and M is a positive integer;
[0164] The push device for live broadcast messages also includes:
[0165] a generation module for generating K virtual slots, where K is the product of M and N, each of the N storage shards corresponds to the M virtual slots, each of the M push shards corresponds to the N virtual slots, and each of the multiple live broadcast rooms is associated with at least one virtual slot of the K virtual slots;
[0166] The determination module is also used to determine the target virtual slot associated with the target live broadcast room; according to the target virtual slot, the target push slice is determined among the M push slices, and the target storage slice is determined among the N storage slices, wherein the target push slice includes a target push server, and the target push server is used to send target messages to multiple clients.
[0167] In an embodiment of the present application, all multiple push servers are sharded to obtain M push shards, each of which includes at least one push server, that is, each push shard is equivalent to a shard cluster of push servers.
[0168] Align the push shard with the storage shard, that is, all the messages to be pushed in the live broadcast room of a push shard are stored in a fixed storage shard. Therefore, the push server in each push shard only needs to access the fixed storage shard to obtain the required messages to be pushed, which can effectively reduce the amount of data search.
[0169] By sharding the push server and storage server, and then sharding the push and storage shards, the push server can return the messages to be pushed to the fixed storage shards, thereby improving the efficiency of message push.
[0170] The push device for live broadcast messages in the embodiment of the present application can be an electronic device or a component in an electronic device, such as an integrated circuit or chip. The electronic device can be a terminal or other device other than a terminal. For example, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a mobile Internet device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA), etc. It can also be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., and the embodiment of the present application does not specifically limit it.
[0171] The push device for live broadcast messages in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0172] The live message push device provided in the embodiment of the present application can implement each process implemented in the above method embodiment. To avoid repetition, it will not be described here.
[0173] Optionally, an embodiment of the present application also provides an electronic device. Figure 10 shows a structural block diagram of an electronic device according to an embodiment of the present application. As shown in Figure 10, the electronic device 1000 includes a processor 1002, a memory 1004, and a program or instruction stored in the memory 1004 and executable on the processor 1002. When the program or instruction is executed by the processor 1002, each process of the above-mentioned method embodiment is implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0174] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
[0175] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0176] The processor is the processor in the electronic device in the above embodiment. The readable storage medium includes a computer-readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0177] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0178] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0179] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0180] It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element. In addition, it should be noted that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in the opposite order according to the functions involved. For example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0181] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the relevant technology, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.
[0182] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.
Claims
1. A method for pushing live broadcast messages, applied to a live broadcast service server, the push method include: Determine a target live broadcast room associated with the target message; The target message is sent to a target push server corresponding to the target live broadcast room, so that the target push server pushes the target message to multiple clients, wherein the multiple clients are multiple clients corresponding to the target live broadcast room.
2. The method for pushing live broadcast messages according to claim 1, in, Sending the target message to a target push server corresponding to the target live broadcast room includes: The target message is sent to the storage server, so that when the storage server receives the data acquisition request sent by the target push server according to a preset period, the target message is sent to the target push server through the storage server.
3. The method for pushing live broadcast messages according to claim 1 or 2, in, Before the step of determining the target live broadcast room associated with the target message, the method for pushing the live broadcast message further includes: When it is detected that the client is connected to the live broadcast room, the client is associated with the push server corresponding to the live broadcast room, so that a message can be pushed to the client through the push server corresponding to the live broadcast room.
4. The method for pushing live broadcast messages according to any one of claims 1 to 3, in, The number of the target push servers is multiple, and the number of clients that establish live broadcast connections with the target live broadcast room is greater than the number threshold corresponding to any one of the multiple target push servers; The method for pushing the live broadcast message also includes: When the number of clients establishing live broadcast connections in the target live broadcast room changes, the number of the multiple target push servers is adjusted according to the changed number of clients.
5. A method for pushing live broadcast messages, applied to a target push server, the method for pushing live broadcast messages include: Get the target message sent by the live broadcast service server, where the target message is related to the target live broadcast room. Associating, the target live broadcast room is associated with the target push server, and the target live broadcast room is associated with multiple clients; The target message is sent to the multiple clients through the association relationship with the multiple clients.
6. The method for pushing live broadcast messages according to claim 5, in, The obtaining of the target message sent by the live broadcast service server includes: The storage server is accessed according to a preset period to obtain the messages to be pushed stored in the storage server, wherein the storage server is associated with the target live broadcast room, and the messages to be pushed include the target message.
7. The method for pushing live broadcast messages according to claim 6, in, The storage server includes N storage slices, where N is a positive integer; The accessing the storage server according to a preset period to obtain the message to be pushed stored by the storage server includes: According to the target live broadcast room, determine a target storage shard among the N storage shards; The target storage slice is accessed according to the preset period to obtain the message to be pushed stored in the target storage slice by the storage server, wherein the target storage slice is associated with the target live broadcast room.
8. The method for pushing live broadcast messages according to claim 7, in, The number of the push servers is multiple, the multiple push servers correspond to M push slices, each of the M push slices includes at least one push server among the multiple push servers, and M is a positive integer; Before the step of accessing the storage server according to a preset period to obtain the message to be pushed stored by the storage server, the method for pushing the live message further includes: Generate K virtual slots, where K is the product of M and N, each of the N storage slices corresponds to the M virtual slots, each of the M push slices corresponds to the N virtual slots, and each of the multiple live broadcast rooms is associated with at least one virtual slot of the K virtual slots; The step of determining a target storage shard among the multiple storage shards according to the target live broadcast room includes: Determine a target virtual slot associated with the target live broadcast room; According to the target virtual slot, a target push slice is determined in the M push slices, and the target storage slice is determined in the N storage slices, wherein the target push slice includes a target push server, and the target push server is used to send the target message to the multiple clients.
9. A live broadcast message push device, applied to a live broadcast service server, the live broadcast service server is used to send messages to the client corresponding to the live broadcast room, the live broadcast message push device include: A determination module, used to determine a target live broadcast room associated with a target message; A sending module is used to send the target message to a target push server corresponding to the target live broadcast room, so that the target push server pushes the target message to multiple clients, wherein the multiple clients are multiple clients corresponding to the target live broadcast room.
10. A live message push device, applied to a target push server, the live message push device include: An acquisition module, used for acquiring a target message sent by a live broadcast service server, wherein the target message is associated with a target live broadcast room, the target live broadcast room is associated with the target push server, and the target live broadcast room is associated with multiple clients; The sending module is used to send the target message to the multiple clients through the association relationship with the multiple clients.
11. An electronic device, include: Memory, used to store programs or instructions; A processor, used to implement the steps of the method for pushing a live message as described in any one of claims 1 to 8 when executing the program or instruction.
12. A readable storage medium storing a program or instruction, wherein the program or instruction, when executed by a processor, implements the steps of the method for pushing a live broadcast message as described in any one of claims 1 to 8.
13. A computer program, include: Instructions, when executed by a processor, implement the steps of the method for pushing a live message as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Message pushing method, device and system, electronic device and computer readable medium
CN110401840A
Message pushing method, device and system
CN111970315A
Message pushing method and device and electronic equipment
CN112104884A
Push message processing method and apparatus, intelligent terminal, and storage medium
WO2023015671A1
