Broadcast message sending method and device, equipment, storage medium and program product
By partitioning broadcast messages by agent process and writing them into the message queue, and filtering them based on remaining sendable capacity and priority, the problem of agent process traffic overload is solved, and more efficient message processing is achieved.
Patent Information
- Application Number
- CN202510967034.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-14
- Publication Date
- 2025-10-31
AI Technical Summary
In existing technologies, directly forwarding broadcast messages through a proxy process leads to traffic overload, reduces message processing performance, and cannot adapt to sudden traffic surges.
Broadcast messages are partitioned by agent process and written to the message queue. Messages are then filtered and aggregated for forwarding based on the remaining sendable capacity and priority of the target partition.
By using flow control and message aggregation, the load on the proxy process is reduced, and message processing performance is improved.
Smart Images

Figure CN120881048A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a method, apparatus, device, storage medium, and program product for transmitting broadcast messages. Background Technology
[0002] With the rapid development of audio and video transmission technologies, live audio and video streaming has gradually become an indispensable part of the internet ecosystem. From daily entertainment to online education and remote conferencing, the application scenarios for live audio and video streaming are constantly expanding. Among these, the application of broadcast messages plays a crucial role in enhancing the live streaming experience and increasing interactivity. Taking live video streaming as an example, broadcast messages can be messages that can be received by all viewers, such as chat logs, gift messages, and gift animations within the live streaming room.
[0003] In related technologies, viewers can log in and connect to a lightweight proxy process, and send or receive broadcast messages through the proxy process. However, the aforementioned method, which directly forwards user-sent or server-sent messages to all viewers in the live stream via the proxy process, can easily cause traffic overload on the proxy process, reduce message processing performance, and fail to adapt to sudden traffic surges. Summary of the Invention
[0004] This application provides a broadcast message sending method, apparatus, device, storage medium, and program product, which solves the problems in related technologies that easily cause traffic overload of the proxy process, reduce message processing performance, and cannot adapt to sudden traffic scenarios. It can adapt to the processing capacity of the proxy process to perform traffic control for broadcast message forwarding, and at the same time aggregate broadcast messages to reduce the load pressure of the proxy process and improve message processing performance.
[0005] In a first aspect, embodiments of this application provide a method for sending broadcast messages, the method comprising: Acquire multiple broadcast messages, and write the broadcast messages from the same agent process into the target partition corresponding to the agent process in the message queue; Obtain the remaining sendable capacity of the target agent process corresponding to the target partition, and filter multiple broadcast messages from the target agent process in the target partition according to priority to obtain multiple target broadcast messages that match the remaining sendable capacity; The multiple target broadcast messages are aggregated to obtain an aggregated message, which is then forwarded through the target proxy process.
[0006] Secondly, embodiments of this application also provide a broadcast message sending device, comprising: The message aggregation module is configured to acquire multiple broadcast messages and write broadcast messages from the same agent process into a message queue to the target partition corresponding to the agent process. The message determination module is configured to obtain the remaining sendable capacity of the target agent process corresponding to the target partition, and filter multiple broadcast messages from the target agent process in the target partition according to priority to obtain multiple target broadcast messages that match the remaining sendable capacity. The message sending module is configured to aggregate the multiple target broadcast messages to obtain an aggregated message, and forward the aggregated message through the target proxy process.
[0007] Thirdly, embodiments of this application also provide a broadcast message sending device, the device comprising: One or more processors; Storage device, configured to store one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the broadcast message sending method described in the embodiments of this application.
[0008] Fourthly, embodiments of this application also provide a non-volatile storage medium for storing computer-executable instructions, which, when executed by a computer processor, are configured to perform the broadcast message sending method described in embodiments of this application.
[0009] Fifthly, embodiments of this application also provide a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor of the device reads from the computer-readable storage medium and executes the computer program, causing the device to perform the broadcast message sending method described in embodiments of this application.
[0010] In this embodiment, broadcast messages from the same agent process are written to the target partition corresponding to the agent process in the message queue. This allows for initial allocation of broadcast messages by different agent processes, facilitating subsequent aggregation of messages from the same agent process. Multiple broadcast messages from the target agent process within the target partition are then filtered according to priority to obtain multiple target broadcast messages matching the remaining sendable capacity. This allows for traffic control of broadcast message forwarding based on the current processing capacity of the target agent process, while also optimizing resource allocation by filtering based on broadcast message priority. Aggregating multiple target broadcast messages to obtain an aggregated message, which is then forwarded by the target agent process, reduces network overhead and lowers the data processing scale of the agent process. The above scheme can adapt to the processing capacity of the agent process for traffic control of broadcast message forwarding, while simultaneously aggregating broadcast messages, reducing the load pressure on the agent process, and improving message processing performance. Attached Figure Description
[0011] Figure 1 A flowchart illustrating a broadcast message sending method provided in this application embodiment; Figure 2 A flowchart of a broadcast message sending method, including a process of selecting and determining target broadcast messages according to priority, is provided for embodiments of this application. Figure 3 A flowchart of a broadcast message sending method, including a process for determining the number of sendable messages corresponding to each message type, is provided for embodiments of this application. Figure 4 A flowchart of a broadcast message sending method provided for embodiments of this application, including a process of determining the number of messages that can be sent by combining a weight ratio, the number of broadcast messages, and the remaining allocated capacity; Figure 5 A flowchart of a broadcast message sending method including a process for filtering duplicate messages is provided for embodiments of this application; Figure 6 A flowchart of a broadcast message sending method, including the process of writing a broadcast message to a target partition, is provided for embodiments of this application. Figure 7 A structural block diagram of a broadcast message sending device provided in an embodiment of this application; Figure 8 This is a schematic diagram of the structure of a broadcast message sending device provided in an embodiment of this application. Detailed Implementation
[0012] The embodiments of this application will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the embodiments of this application and are not intended to limit the scope of the embodiments. Furthermore, it should be noted that, for ease of description, only the parts relevant to the embodiments of this application are shown in the accompanying drawings, not the entire structure.
[0013] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0014] The broadcast message sending method provided in this application embodiment can partition and write broadcast messages into message queues based on agent processes, adapting to the processing capabilities of different agent processes for traffic control of broadcast message forwarding, and aggregating broadcast messages to reduce the load pressure on agent processes and improve message processing performance. Relevant application scenarios may include video conferencing, live audio and video streaming, etc. The aforementioned application scenarios are merely exemplary and illustrative; in practical applications, this broadcast message sending method can also be used in other scenarios, and this application embodiment does not limit its application to these scenarios.
[0015] The broadcast message sending method provided in this application embodiment can be executed by a computer device. The computer device refers to any electronic device with data computing, processing and storage capabilities, such as a server. This application embodiment does not limit this.
[0016] Figure 1 This is a flowchart illustrating a broadcast message sending method provided in an embodiment of this application. Figure 1 As shown, the broadcast message sending method specifically includes the following steps: Step S101: Obtain multiple broadcast messages, and write the broadcast messages from the same agent process into the target partition corresponding to the agent process in the message queue.
[0017] Broadcast messages can be messages sent to multiple specific recipients. Taking live video streaming as an example, broadcast messages can be public chat logs, gift messages, or gift animations sent to all viewers in the live stream room. Specifically, they can include message content, user information, room identifier, and message type. A proxy process can be an intermediate service instance that connects viewers to the live stream room, used for message forwarding between viewers and backend services. A message queue can be a middleware component used for asynchronous message processing, while a partition can be the basic parallel unit for message storage and transmission within the message queue. These multiple broadcast messages can be grouped according to their originating proxy processes. All broadcast messages from the same proxy process can be routed to the target partition pre-assigned to that proxy process in the message queue. Since broadcast messages from the same proxy process are written to the same partition, it facilitates subsequent consumption and aggregation of messages from the same proxy process. Furthermore, writing messages from different proxy processes to different partitions allows for parallel and independent processing of message streams from different proxy processes.
[0018] Step S102: Obtain the remaining sendable capacity of the target agent process corresponding to the target partition, and filter the multiple broadcast messages from the target agent process in the target partition according to priority to obtain multiple target broadcast messages that match the remaining sendable capacity.
[0019] The target partition can be one of the partitions in the message queue that is processed in parallel. This target partition stores broadcast messages from the target agent process. Optionally, multiple broadcast messages from the target agent process can be extracted from the target partition periodically for processing, or a fixed number of broadcast messages from the target agent process can be extracted from the target partition for processing; this application does not impose any limitations on this. The remaining sendable capacity can be the total number of messages that the target agent process can currently process and forward. If the number of multiple broadcast messages from the target agent process in the target partition is less than or equal to the remaining sendable capacity, aggregation and forwarding can be performed directly. If the number of multiple broadcast messages from the target agent process in the target partition is greater than the remaining sendable capacity, the multiple broadcast messages need to be filtered according to priority to reasonably determine the target broadcast message and reduce the message volume.
[0020] In one embodiment, broadcast messages of different message types have different priorities. Therefore, the number of messages that can be sent for each message type can be determined based on the priority of each message type, the number of broadcast messages, and the remaining sendable capacity.
[0021] In one embodiment, the priority of each message type can be pre-set with a weight value. This weight value can be the maximum number of messages that can be sent for each message type during flow control, where a higher priority corresponds to a larger weight value. Specifically, the number of messages that can be sent for each message type can be determined by combining the weight value corresponding to each message type.
[0022] In one embodiment, multiple broadcast messages from the target agent process can be arranged in descending order of priority, and the multiple broadcast messages with the highest priority that satisfy the remaining sendable capacity can be identified as the multiple target broadcast messages required.
[0023] Step S103: Aggregate multiple target broadcast messages to obtain an aggregated message, and forward the aggregated message through the target proxy process.
[0024] The target proxy process can be configured with a batch broadcast interface. Each interface can contain broadcast messages from multiple live streaming rooms, and each live streaming room can contain multiple broadcast messages. Aggregating multiple target broadcast messages using this batch broadcast interface reduces the number of messages directly transmitted to the target proxy process, improving message aggregation. The target proxy process can then forward the aggregated messages to different live streaming rooms and different viewers.
[0025] The above-described method involves writing broadcast messages from the same agent process into the target partition corresponding to the agent process in the message queue. This allows for initial allocation of broadcast messages by different agent processes, facilitating subsequent aggregation of messages from the same agent process. Filtering multiple broadcast messages from the target agent process within the target partition according to priority yields multiple target broadcast messages matching the remaining sendable capacity. This allows for traffic control of broadcast message forwarding based on the current processing capacity of the target agent process, while also optimizing resource allocation by filtering based on broadcast message priority. Aggregating multiple target broadcast messages into an aggregated message, and forwarding the aggregated message through the target agent process, reduces network overhead and lowers the data processing scale of the agent process. In summary, this scheme enables traffic control of broadcast message forwarding based on the agent process's processing capacity, while simultaneously aggregating broadcast messages, reducing the load on the agent process, and improving message processing performance.
[0026] Figure 2 This is a flowchart illustrating a broadcast message sending method, including a process of selecting and determining target broadcast messages according to priority, as provided in an embodiment of this application. Figure 2 As shown, the specific steps include the following: Step S201: Obtain multiple broadcast messages, and write the broadcast messages from the same agent process into the target partition corresponding to the agent process in the message queue.
[0027] Step S202: Obtain the remaining sendable capacity of the target agent process corresponding to the target partition.
[0028] Step S203: Statistically determine at least one message type and the number of broadcast messages corresponding to each message type from multiple broadcast messages from the target agent process in the target partition; determine the number of messages that can be sent for each message type based on the priority, the number of broadcast messages, and the remaining sendable capacity for each message type; determine multiple target broadcast messages from the multiple broadcast messages based on the number of messages that can be sent for each message type.
[0029] Since multiple broadcast messages may have different message types, and different message types have different priorities, taking live video streaming as an example, the broadcast message types in a live streaming room can include room announcement messages, chat messages, gift messages, and room entry messages, etc., and their priorities, from high to low, would be room announcement messages, gift messages, chat messages, and room entry messages. Therefore, we can first statistically analyze the multiple broadcast messages from the target agent process in the target partition to determine what message types exist, and which broadcast messages correspond to each message type.
[0030] In one embodiment, the priority of each message type can be queried to obtain a weight value. Adding the weight values of each message type yields the total weight value. Based on the weight ratio of each message type's weight value relative to the total weight value, the remaining sendable capacity can be proportionally allocated to each message type to determine the number of messages that can be sent.
[0031] In one embodiment, resources can be allocated to message types in descending order of priority. For example, starting with the highest priority message type, the weight values corresponding to multiple message types can be summed to obtain a total weight value. The weight ratio of the highest priority message type's weight value to this total weight value can then be calculated. Multiplying this weight ratio by the remaining sendable capacity yields the theoretical allocation quantity. If the number of broadcast messages corresponding to the highest priority message type is less than or equal to the theoretical allocation quantity, then the number of broadcast messages can be determined as the corresponding sendable message quantity, meaning all broadcast messages corresponding to the highest priority message type can be sent. If the number of broadcast messages corresponding to the highest priority message type is greater than the theoretical allocation quantity, then the theoretical allocation quantity can be determined as the corresponding sendable message quantity, meaning only a portion of the broadcast messages corresponding to the highest priority message type can be sent, and excess broadcast messages need to be discarded. After determining the sendable message quantity corresponding to the highest priority message type, this quantity can be subtracted from the remaining sendable capacity to obtain the remaining allocation capacity. Resource allocation for other priority message types can then be performed based on this remaining allocation capacity. For details, refer to the aforementioned allocation process for the highest priority message type; this application will not repeat it here. After determining the number of messages that can be sent for each message type, the target broadcast messages that need to be sent for each message type can be selected from multiple broadcast messages.
[0032] Step S204: Aggregate multiple target broadcast messages to obtain an aggregated message, and forward the aggregated message through the target proxy process.
[0033] As described above, the number of messages that can be sent for each message type is determined based on the priority, the number of broadcast messages, and the remaining sendable capacity. This allows for the allocation of sendable message quantities for different message types based on priority, ensuring fair resource allocation while taking into account message priority. Furthermore, by determining multiple target broadcast messages from multiple broadcast messages based on the number of sendable messages for each message type, the broadcast message sending traffic can be controlled, balancing the message load of the target proxy process.
[0034] Figure 3 This is a flowchart illustrating a broadcast message sending method, including a process for determining the number of sendable messages corresponding to each message type, as provided in an embodiment of this application. Figure 3 As shown, the specific steps include the following: Step S301: Obtain multiple broadcast messages, and write the broadcast messages from the same agent process into the target partition corresponding to the agent process in the message queue.
[0035] Step S302: Obtain the remaining sendable capacity of the target agent process corresponding to the target partition.
[0036] Step S303: Statistically determine at least one message type and the number of broadcast messages corresponding to each message type from multiple broadcast messages from the target agent process in the target partition.
[0037] Step S304: Query the priority weight value corresponding to each message type, and add the weight values corresponding to the first message type in the message types to obtain the total weight value; calculate the remaining allocated capacity based on the remaining sendable capacity and the number of sendable messages of the second message type, and calculate the weight ratio based on the weight value corresponding to the first message type and the total weight value; determine the number of sendable messages based on the weight ratio corresponding to the first message type, the number of broadcast messages and the remaining allocated capacity.
[0038] The weight value can be the maximum number of messages that can be sent for each message type during flow control. The priority weight value for each message type can be obtained by querying the database or stored mapping relationship. The first message type is a message type with an undetermined number of messages that can be sent, and its priority is lower than the second message type, which has a determined number of messages that can be sent. For example, statistical analysis of multiple broadcast messages from the target agent process in the target partition reveals three message types: message type A, message type B, and message type C. The broadcast message count corresponding to message type A is... The number of broadcast messages corresponding to message type B is The number of broadcast messages corresponding to message type C is The remaining sendable capacity is S. The weight value corresponding to message type A can be obtained through querying. The weight value corresponding to message type B is The weight value corresponding to message type C is ,in, At the start of resource allocation, the number of messages that can be sent for message types A, B, and C is not yet determined. Therefore, the first message type consists of message types A, B, and C, and there is no second message type. The weights corresponding to message types A, B, and C are then assigned respectively. and The total weight value is obtained by adding them together. Resource allocation is performed on message type A, which has the highest priority, and its corresponding weight ratio is: Therefore, the theoretical allocation quantity corresponding to message type A is... for If the number of broadcast messages Less than or equal to the theoretical allocation quantity Then the number of broadcast messages can be... Determine the number of messages that can be sent corresponding to message type A. If the number of broadcast messages Greater than the theoretical allocation quantity Then the theoretical allocation quantity can be... Determine the number of messages that can be sent corresponding to message type A. After resource allocation for message type A is completed, the first message type is message type B and message type C, and the second message type is message type A. Therefore, the weight values corresponding to message type B and message type C can be assigned respectively. and The total weight value is obtained by adding them together. And, will Subtract the number of messages that can be sent for message type A. Obtain the remaining allocation capacity Resource allocation is performed on message type B, which has the highest priority at present, and its corresponding weight ratio is... Therefore, the theoretical allocation quantity corresponding to message type B is... for If the number of broadcast messages Less than or equal to the theoretical allocation quantity Then the number of broadcast messages can be... Determine the number of messages that can be sent corresponding to message type B. If the number of broadcast messages Greater than the theoretical allocation quantity Then the theoretical allocation quantity can be... Determine the number of messages that can be sent corresponding to message type B. And so on, completing the resource allocation for the remaining message types, which will not be elaborated upon in this application.
[0039] Step S305: Determine multiple target broadcast messages from multiple broadcast messages based on the number of messages that can be sent corresponding to each message type.
[0040] Specifically, if the number of sendable messages for a certain message type is greater than or equal to the number of broadcast messages it can be directly identified as the target broadcast message. If the number of sendable messages for a certain message type is less than the number of broadcast messages it can be, some broadcast messages need to be discarded, and broadcast messages matching the number of sendable messages need to be retained as target broadcast messages. Specifically, broadcast messages to be discarded can be randomly selected, or broadcast messages with lower content richness can be filtered and discarded based on the content richness of the broadcast messages.
[0041] Step S306: Aggregate multiple target broadcast messages to obtain an aggregated message, and forward the aggregated message through the target proxy process.
[0042] The above approach allocates the remaining sendable capacity reasonably and fairly to each message type according to its priority weight value. This ensures that message types with high weight receive a larger resource quota while reserving resource quotas for message types with low weight, effectively controlling traffic and optimizing resource allocation.
[0043] Figure 4 This application provides a flowchart of a broadcast message sending method that includes a process of determining the number of messages that can be sent by combining a weight ratio, the number of broadcast messages, and the remaining allocated capacity. Figure 4 As shown, the specific steps include the following: Step S401: Obtain multiple broadcast messages, and write the broadcast messages from the same agent process into the target partition corresponding to the agent process in the message queue.
[0044] Step S402: Obtain the remaining sendable capacity of the target agent process corresponding to the target partition.
[0045] Step S403: Statistically determine at least one message type and the number of broadcast messages corresponding to each message type from multiple broadcast messages from the target agent process in the target partition.
[0046] Step S404: Query the priority weight value corresponding to each message type, and add the weight values corresponding to the first message type in the message types to obtain the total weight value; calculate the remaining allocated capacity based on the remaining sendable capacity and the number of messages that can be sent for the second message type, and calculate the weight ratio based on the weight value corresponding to the first message type and the total weight value.
[0047] Step S405: Determine the theoretical allocation quantity based on the weight ratio corresponding to the first message type and the remaining allocation capacity.
[0048] In one embodiment, the theoretical allocation quantity can be obtained by multiplying the weight ratio by the remaining allocation capacity. In another embodiment, the target weight ratio can be obtained by multiplying the weight ratio corresponding to the first message type by a pre-configured adjustment coefficient corresponding to the first message type, and then multiplying the target weight ratio by the remaining allocation capacity to obtain the theoretical allocation quantity. The adjustment coefficient can be adaptively set according to the traffic characteristics of message types in actual application scenarios.
[0049] Step S406: If the number of broadcast messages corresponding to the first message type is less than or equal to the theoretically allocated number, the number of broadcast messages is determined as the number of messages that can be sent.
[0050] If the number of broadcast messages corresponding to the first message type is less than or equal to the theoretically allocated number, then all broadcast messages of that first message type can be sent without any quantity limit. Therefore, the number of broadcast messages can be determined as the number of messages that can be sent.
[0051] Step S407: If the number of broadcast messages corresponding to the first message type is greater than the theoretical allocation number, the theoretical allocation number is determined as the number of messages that can be sent.
[0052] If the number of broadcast messages corresponding to the first message type exceeds the theoretically allocated number, it can be considered that not all broadcast messages of that first message type can be sent, and the number must be limited to the theoretically allocated number. Therefore, the theoretically allocated number can be determined as the number of messages that can be sent.
[0053] Step S408: Determine multiple target broadcast messages from multiple broadcast messages based on the number of messages that can be sent corresponding to each message type.
[0054] Step S409: Aggregate multiple target broadcast messages to obtain an aggregated message, and forward the aggregated message through the target proxy process.
[0055] Based on the comparison between the number of broadcast messages corresponding to the first message type and the theoretically allocated number, the number of messages that can be sent corresponding to the first message type can be reasonably determined, and resource allocation can be adapted to the actual load of the target agent process and the priority distribution of different message types.
[0056] Figure 5 This is a flowchart illustrating a broadcast message sending method that includes a process for filtering duplicate messages, as provided in an embodiment of this application. Figure 5 As shown, the specific steps include the following: Step S501: Obtain multiple broadcast messages, and write the broadcast messages from the same agent process into the target partition corresponding to the agent process in the message queue.
[0057] Step S502: Obtain the remaining sendable capacity of the target agent process corresponding to the target partition.
[0058] Step S503: Perform hash calculation on the message content of multiple broadcast messages in the target partition to obtain a first hash value; if there are first broadcast messages and second broadcast messages with the same first hash value among the multiple broadcast messages, compare the message lengths of the first broadcast messages and second broadcast messages; if the message lengths of the first broadcast messages and second broadcast messages are the same, compare the message content of the first broadcast messages and second broadcast messages; if the message content of the first broadcast messages and second broadcast messages is the same, filter out the first broadcast message or the second broadcast message from the multiple broadcast messages in the target partition.
[0059] Due to network fluctuations and other issues, viewers may send the same broadcast message, causing short-term traffic anomalies. Therefore, duplicate messages can be filtered out from multiple broadcast messages to reduce the scale of message transmission. Hash calculations are performed on the message content of each broadcast message to obtain a fixed-length first hash value. This first hash value is used to quickly compare the number of broadcast messages to see if duplicate messages exist, initially filtering out most obviously different broadcast messages. If the first hash values of multiple broadcast messages are all different, then there are no duplicate messages. If there are first and second broadcast messages with the same first hash value, then the first and second broadcast messages may be duplicates. Next, the message lengths of the first and second broadcast messages can be compared to compensate for hash collisions and quickly eliminate different broadcast messages. If the message lengths of the first and second broadcast messages are different, then the first and second broadcast messages are different; if the message lengths of the first and second broadcast messages are the same, then the first and second broadcast messages may be duplicates. Finally, the message content of the first and second broadcast messages can be directly and precisely compared. If the content of the first broadcast message and the second broadcast message are different, then the first broadcast message and the second broadcast message are distinct; if the content of the first broadcast message and the second broadcast message are the same, then the first broadcast message and the second broadcast message are duplicated, and either the first broadcast message or the second broadcast message can be filtered out from multiple broadcast messages.
[0060] Step S504: Filter multiple broadcast messages from the target agent process in the target partition according to priority to obtain multiple target broadcast messages that match the remaining sendable capacity.
[0061] Step S505: Aggregate multiple target broadcast messages to obtain an aggregated message, and forward the aggregated message through the target proxy process.
[0062] As described above, the layered approach of using hash comparison, length comparison, and content comparison in sequence can quickly eliminate duplicate messages, improve the efficiency of the deduplication process, and at the same time ensure the accuracy of deduplication, avoiding the accidental deletion of non-duplicate broadcast messages.
[0063] Figure 6 This is a flowchart illustrating a broadcast message sending method, including the process of writing a broadcast message to a target partition, provided as an embodiment of this application. For example... Figure 6 As shown, the specific steps include the following: Step S601: Obtain multiple broadcast messages, extract broadcast messages from the same agent process from the multiple broadcast messages, and perform a hash calculation on the process identifier of the agent process to obtain a second hash value; determine the target partition in the message queue based on the second hash value, and write the broadcast messages from the same agent process to the target partition.
[0064] Specifically, hashing the process identifier of the agent process can map it to a fixed-length second hash value, which is used for partition location in the message queue. Therefore, broadcast messages from the same agent process can be directed to the same specific partition in the message queue through hash routing.
[0065] Step S602: Obtain the remaining sendable capacity of the target agent process corresponding to the target partition, and filter the multiple broadcast messages from the target agent process in the target partition according to priority to obtain multiple target broadcast messages that match the remaining sendable capacity.
[0066] Step S603: Aggregate multiple target broadcast messages to obtain an aggregated message, and forward the aggregated message through the target proxy process.
[0067] As described above, hash partitioning based on the process identifier of the agent process can distribute broadcast messages from the same source to the same partition, balance the load of different partitions, and facilitate the subsequent aggregation of messages from the same agent process.
[0068] Figure 7 This is a structural block diagram of a broadcast message sending device provided in an embodiment of this application. The device is configured to execute the broadcast message sending method provided in the above embodiment, and has corresponding functional modules and beneficial effects for executing the method. For example... Figure 7 As shown, the device specifically includes: The message aggregation module 701 is configured to acquire multiple broadcast messages and write broadcast messages from the same agent process into the target partition corresponding to the agent process in the message queue.
[0069] The message determination module 702 is configured to obtain the remaining sendable capacity of the target agent process corresponding to the target partition, and filter multiple broadcast messages from the target agent process in the target partition according to priority to obtain multiple target broadcast messages that match the remaining sendable capacity.
[0070] The message sending module 703 is configured to aggregate multiple target broadcast messages to obtain an aggregated message, and then forward the aggregated message through the target proxy process.
[0071] The above-described method involves writing broadcast messages from the same agent process into the target partition corresponding to the agent process in the message queue. This allows for initial allocation of broadcast messages by different agent processes, facilitating subsequent aggregation of messages from the same agent process. Filtering multiple broadcast messages from the target agent process within the target partition according to priority yields multiple target broadcast messages matching the remaining sendable capacity. This allows for traffic control of broadcast message forwarding based on the current processing capacity of the target agent process, while also optimizing resource allocation by filtering based on broadcast message priority. Aggregating multiple target broadcast messages into an aggregated message, and forwarding the aggregated message through the target agent process, reduces network overhead and lowers the data processing scale of the agent process. In summary, this scheme enables traffic control of broadcast message forwarding based on the agent process's processing capacity, while simultaneously aggregating broadcast messages, reducing the load on the agent process, and improving message processing performance.
[0072] In one possible embodiment, the message determination module 702 is further configured to: Statistically determine at least one message type and the number of broadcast messages corresponding to each message type from multiple broadcast messages from the target agent process in the target partition; The number of messages that can be sent for each message type is determined based on the priority of each message type, the number of broadcast messages, and the remaining sendable capacity. Multiple target broadcast messages are determined from multiple broadcast messages based on the number of messages that can be sent for each message type.
[0073] In one possible embodiment, the message determination module 702 is further configured to: Query the priority weight value corresponding to each message type, and add the weight value corresponding to the first message type in the message types to obtain the total weight value. The first message type is a message type with an uncertain number of messages that can be sent, and its priority is lower than the second message type in the message types. The second message type is a message type with a certain number of messages that can be sent. The remaining allocated capacity is calculated based on the remaining sendable capacity and the number of sendable messages of the second message type. The weight ratio is then calculated based on the weight value corresponding to the first message type and the total weight value. The number of messages that can be sent is determined based on the weight ratio corresponding to the first message type, the number of broadcast messages, and the remaining allocated capacity.
[0074] In one possible embodiment, the message determination module 702 is further configured to: The theoretical allocation quantity is determined based on the weight ratio corresponding to the first message type and the remaining allocation capacity. If the number of broadcast messages corresponding to the first message type is less than or equal to the theoretically allocated number, the number of broadcast messages is determined as the number of messages that can be sent.
[0075] In one possible embodiment, the message determination module 702 is further configured to: If the number of broadcast messages corresponding to the first message type is greater than the theoretically allocated number, the theoretically allocated number will be determined as the number of messages that can be sent.
[0076] In one possible embodiment, a duplicate message filtering module is also included, configured as follows: The first hash value is obtained by hashing the message content of each of the multiple broadcast messages in the target partition; If there are first broadcast messages and second broadcast messages with the same first hash value among multiple broadcast messages, the message lengths of the first broadcast messages and the second broadcast messages are compared. If the first broadcast message and the second broadcast message have the same message length, the message content of the first broadcast message and the second broadcast message will be compared. If the content of the first broadcast message and the second broadcast message are the same, filter out the first broadcast message or the second broadcast message from the multiple broadcast messages in the target partition.
[0077] In one possible embodiment, the message aggregation module 701 is further configured as follows: Extract broadcast messages from the same agent process from multiple broadcast messages, and perform a hash calculation on the process identifier of the agent process to obtain a second hash value; The target partition in the message queue is determined based on the second hash value, and broadcast messages from the same agent process are written to the target partition.
[0078] Figure 8 This is a schematic diagram of the structure of a broadcast message sending device provided in an embodiment of this application, as shown below. Figure 8 As shown, the device includes a processor 801, a memory 802, an input device 803, and an output device 804; the number of processors 801 in the device can be one or more. Figure 8 Taking a processor 801 as an example; the processor 801, memory 802, input device 803, and output device 804 in the device can be connected via a bus or other means. Figure 8Taking a bus connection as an example, the memory 802, as a computer-readable storage medium, can be configured to store software programs, computer-executable programs, and modules, such as the program instructions / modules corresponding to the broadcast message sending method in this embodiment. The processor 801 executes various functional applications and data processing of the device by running the software programs, instructions, and modules stored in the memory 802, thereby implementing the aforementioned broadcast message sending method. The input device 803 can be configured to receive input digital or character information and generate key signal inputs related to user settings and function control of the device. The output device 804 may include a display screen or other display device.
[0079] This application also provides a non-volatile storage medium containing computer-executable instructions. When executed by a computer processor, the computer-executable instructions are configured to perform a broadcast message sending method described in the above embodiments. The method includes: acquiring multiple broadcast messages; writing broadcast messages from the same agent process into a target partition corresponding to the agent process in a message queue; acquiring the remaining sendable capacity of the target agent process corresponding to the target partition; filtering the multiple broadcast messages from the target agent process in the target partition according to priority to obtain multiple target broadcast messages matching the remaining sendable capacity; aggregating the multiple target broadcast messages to obtain an aggregated message; and forwarding the aggregated message through the target agent process.
[0080] It is worth noting that in the embodiments of the above-mentioned broadcast message sending device, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not configured to limit the protection scope of the embodiments of this application.
[0081] In some possible implementations, various aspects of the methods provided in this application can also be implemented as a program product comprising program code that, when run on a computer device, is configured to cause the computer device to perform the steps of the methods according to the various exemplary embodiments of this application described above. For example, the computer device may execute the broadcast message sending method described in the embodiments of this application. The program product may be implemented using any combination of one or more readable media.
Claims
1. A method for sending broadcast messages, characterized in that, include: Acquire multiple broadcast messages, and write the broadcast messages from the same agent process into the target partition corresponding to the agent process in the message queue; Obtain the remaining sendable capacity of the target agent process corresponding to the target partition, and filter multiple broadcast messages from the target agent process in the target partition according to priority to obtain multiple target broadcast messages that match the remaining sendable capacity; The multiple target broadcast messages are aggregated to obtain an aggregated message, which is then forwarded through the target proxy process.
2. The broadcast message sending method according to claim 1, characterized in that, The step of filtering multiple broadcast messages from the target agent process in the target partition according to priority to obtain multiple target broadcast messages that match the remaining sendable capacity includes: Statistical analysis is performed on multiple broadcast messages from the target agent process in the target partition to determine at least one message type and the number of broadcast messages corresponding to each message type; The number of messages that can be sent for each message type is determined based on the priority of each message type, the number of broadcast messages, and the remaining sendable capacity. Multiple target broadcast messages are determined from the plurality of broadcast messages based on the number of sendable messages corresponding to each of the aforementioned message types.
3. The broadcast message sending method according to claim 2, characterized in that, The step of determining the number of messages that can be sent for each message type based on the priority of each message type, the number of broadcast messages, and the remaining sendable capacity includes: Query the priority weight value corresponding to each of the message types, and add the weight values corresponding to the first message type among the message types to obtain the total weight value. The first message type is a message type for which the number of messages that can be sent is not determined, and its priority is lower than that of the second message type among the message types. The second message type is a message type for which the number of messages that can be sent is determined. The remaining allocated capacity is calculated based on the remaining sendable capacity and the number of sendable messages of the second message type, and the weight ratio is calculated based on the weight value corresponding to the first message type and the total weight value. The number of messages that can be sent is determined based on the weight ratio corresponding to the first message type, the number of broadcast messages, and the remaining allocated capacity.
4. The broadcast message sending method according to claim 3, characterized in that, The step of determining the number of messages that can be sent based on the weight ratio corresponding to the first message type, the number of broadcast messages, and the remaining allocated capacity includes: The theoretical allocation quantity is determined based on the weight ratio corresponding to the first message type and the remaining allocation capacity. If the number of broadcast messages corresponding to the first message type is less than or equal to the theoretically allocated number, the number of broadcast messages is determined as the number of messages that can be sent.
5. The broadcast message sending method according to claim 4, characterized in that, After determining the theoretical allocation quantity based on the weight ratio corresponding to the first message type and the remaining allocation capacity, the method further includes: If the number of broadcast messages corresponding to the first message type is greater than the theoretically allocated number, the theoretically allocated number is determined as the number of messages that can be sent.
6. The broadcast message sending method according to claim 1, characterized in that, Before filtering multiple broadcast messages from the target agent process in the target partition according to priority to obtain multiple target broadcast messages matching the remaining sendable capacity, the method further includes: A first hash value is obtained by hashing the message content of each of the multiple broadcast messages in the target partition; If a first broadcast message and a second broadcast message with the same first hash value exist among the multiple broadcast messages, the message lengths of the first broadcast message and the second broadcast message are compared. If the first broadcast message and the second broadcast message have the same message length, compare the message content of the first broadcast message and the second broadcast message. If the content of the first broadcast message and the second broadcast message are the same, the first broadcast message or the second broadcast message is filtered out from the multiple broadcast messages in the target partition.
7. The broadcast message sending method according to claim 1, characterized in that, The step of writing broadcast messages from the same agent process among the multiple broadcast messages to the target partition in the message queue corresponding to the agent process includes: Extract broadcast messages from the same agent process from the multiple broadcast messages, and perform a hash calculation on the process identifier of the agent process to obtain a second hash value; The target partition in the message queue is determined based on the second hash value, and the broadcast message from the same agent process is written to the target partition.
8. A broadcast message transmitting device, characterized in that, include: The message aggregation module is configured to acquire multiple broadcast messages and write broadcast messages from the same agent process into a message queue to the target partition corresponding to the agent process. The message determination module is configured to obtain the remaining sendable capacity of the target agent process corresponding to the target partition, and filter multiple broadcast messages from the target agent process in the target partition according to priority to obtain multiple target broadcast messages that match the remaining sendable capacity. The message sending module is configured to aggregate the multiple target broadcast messages to obtain an aggregated message, and forward the aggregated message through the target proxy process.
9. A broadcast message transmitting device, characterized in that, The device includes: one or more processors; and a storage device configured to store one or more programs, which, when executed by the one or more processors, cause the one or more processors to implement the broadcast message sending method according to any one of claims 1-7.
10. A non-volatile storage medium for storing computer-executable instructions, characterized in that, The computer-executable instructions, when executed by a computer processor, are configured to perform the broadcast message sending method according to any one of claims 1-7.
11. A computer program product, comprising a computer program, characterized in that, The computer program is stored in a computer-readable storage medium, and at least one processor of the device reads from the computer-readable storage medium and executes the computer program, causing the device to perform the broadcast message sending method according to any one of claims 1-7.