Disclosure of Invention
The embodiment of the disclosure at least provides a message processing method and device.
In a first aspect, an embodiment of the present disclosure provides a message processing method, including:
receiving a message acquisition request sent by a user side and equipment performance parameters of the user side, wherein the equipment performance parameters are used for representing the running state of equipment corresponding to the user side;
determining a corresponding message screening strategy based on the equipment performance parameters of the user side;
and screening the received message based on the message screening strategy, and sending the screened target message to the user side.
In a possible implementation manner, the device performance parameter of the user side includes a CPU occupancy rate and/or a memory occupancy rate.
In a possible implementation manner, the determining a corresponding message screening policy based on the device performance parameter of the user side includes:
determining the priority order of different types of messages;
and determining the screening proportion corresponding to the message of each level of priority based on the equipment performance parameters of the user side.
In a possible implementation manner, the message request of the user side carries an identity type identifier of the user side;
the determining the priority order of the different types of messages includes:
determining a priority order of different types of messages corresponding to the identity type identifier.
In a possible embodiment, determining a screening ratio corresponding to a message of each level of priority based on the device performance parameter of the ue includes:
determining a corresponding screening grade based on the equipment performance parameters corresponding to the user side;
and acquiring the preset screening proportion of the messages of each level of priority under the screening level.
In a possible implementation, the screening the received message based on the message screening policy includes:
taking messages received in a preset time period from the current moment to the previous moment as messages to be screened, and determining the type of each message to be screened;
and screening the messages to be screened of each level of priority according to the screening proportion corresponding to each type of messages.
In a possible implementation manner, the screening the messages to be screened of each level of priority according to the screening proportion corresponding to each type of message includes:
aiming at the messages to be screened of each level of priority, sorting the messages to be screened of the priority from large to small according to the memory size occupied by the messages;
determining the rejection number N based on the screening proportion corresponding to the messages to be screened of the priority and the number of the messages to be screened of the priority, wherein N is a positive integer;
and eliminating the messages to be screened which are arranged at the front N positions, and taking the remaining messages to be screened after elimination as the screened messages.
In a second aspect, an embodiment of the present disclosure further provides a message processing apparatus, including:
the receiving module is used for receiving a message acquisition request sent by a user side and equipment performance parameters of the user side, wherein the equipment performance parameters are used for representing the running state of equipment corresponding to the user side;
the determining module is used for determining a corresponding message screening strategy based on the equipment performance parameters of the user side;
and the sending module is used for screening the received messages based on the message screening strategy and sending the screened target messages to the user side.
In a possible implementation manner, the device performance parameter of the user side includes a CPU occupancy rate and/or a memory occupancy rate.
In a possible implementation manner, the determining module, when determining the corresponding message screening policy based on the device performance parameter of the user side, is configured to:
determining the priority order of different types of messages;
and determining the screening proportion corresponding to the message of each level of priority based on the equipment performance parameters of the user side.
In a possible implementation manner, the message request of the user side carries an identity type identifier of the user side;
the determining module, when determining the priority order of the different types of messages, is configured to:
determining a priority order of different types of messages corresponding to the identity type identifier.
In a possible implementation manner, the determining module, when determining, based on the device performance parameter of the ue, a screening ratio corresponding to a message of each level of priority, is configured to:
determining a corresponding screening grade based on the equipment performance parameters corresponding to the user side;
and acquiring the preset screening proportion of the messages of each level of priority under the screening level.
In a possible implementation manner, the sending module, when screening the received message based on the message screening policy, is configured to:
taking messages received in a preset time period from the current moment to the previous moment as messages to be screened, and determining the type of each message to be screened;
and screening the messages to be screened of each level of priority according to the screening proportion corresponding to each type of messages.
In a possible implementation manner, when the sending module filters the message to be filtered of each level of priority according to the filtering ratio corresponding to each type of message, the sending module is configured to:
aiming at the messages to be screened of each level of priority, sorting the messages to be screened of the priority from large to small according to the memory size occupied by the messages;
determining the rejection number N based on the screening proportion corresponding to the messages to be screened of the priority and the number of the messages to be screened of the priority, wherein N is a positive integer;
and eliminating the messages to be screened which are arranged at the front N positions, and taking the remaining messages to be screened after elimination as the screened messages.
In a third aspect, an embodiment of the present disclosure further provides a computer device, including: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating via the bus when the computer device is running, the machine-readable instructions when executed by the processor performing the steps of the first aspect described above, or any possible implementation of the first aspect.
In a fourth aspect, this disclosed embodiment also provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to perform the steps in the first aspect or any one of the possible implementation manners of the first aspect.
According to the message processing method and device provided by the embodiment of the disclosure, when the user side sends the message acquisition request, the user side carries the device performance parameters in the message acquisition request, so that the server can determine the corresponding message screening strategy for the user side based on the device performance parameters, and then screens the received messages according to the message screening strategy, so that the message amount received by the user side can be matched with the device performance parameters of the user side, the message processing efficiency can be improved, the smoothness of page display is ensured, and the user experience is improved.
In order to make the aforementioned objects, features and advantages of the present disclosure more comprehensible, preferred embodiments accompanied with figures are described in detail below.
In a specific implementation, the message screening policy may include screening proportions of messages of different priorities. When determining the corresponding message screening policy based on the device performance parameters of the user side, the priority order of the messages of different types may be determined first, and then the screening proportion corresponding to the message of each level of priority may be determined based on the device performance parameters of the user side.
Illustratively, if the priority order of the different types of messages is a reminder message (the priority is the first level) for a user to enter a live broadcast room, a barrage message (the priority is the second level) sent by the user, and a message (the priority is the third level) for a user to mainly broadcast a gift, wherein the priority of the reminder message for the user to enter the live broadcast room is the lowest, so that when a corresponding message screening policy is determined based on the device performance parameters of the user side, the screening proportion of the message with the first level of priority, the screening proportion of the message with the second level of priority, and the screening proportion of the message with the third level of priority can be respectively determined.
In a possible implementation manner, when determining the screening proportion corresponding to the message of each level of priority based on the device performance parameter of the user end, the corresponding screening level may be determined based on the device performance parameter corresponding to the user end, and then the screening proportion of the message of each level of priority is determined according to the preset screening level.
When the device performance parameter at the user end includes the CPU occupancy rate, the device performance parameter may be divided into different screening levels according to the CPU occupancy rate, for example, when the CPU occupancy rate is less than 60%, the corresponding screening level is determined to be low, when the CPU occupancy rate is greater than or equal to 60% and less than or equal to 80%, the corresponding screening level is determined to be medium, and when the CPU occupancy rate is greater than 80%, the corresponding screening level is high.
When the device performance parameter of the user end includes the memory occupancy rate, the method for determining the screening level may be the same as the method for determining the screening level based on the CPU occupancy rate, but the thresholds between different levels may be different, and will not be described again.
When the device performance parameters at the user end include CPU occupancy and memory occupancy, and when determining the screening levels, the partition thresholds of each level may be determined by simultaneously combining the CPU occupancy and the memory occupancy, and a plurality of partition thresholds may exist between any two screening levels, for example, when the CPU occupancy is less than 40% and the memory occupancy is less than 30%, or when the CPU occupancy is less than 50% and the memory occupancy is less than 20%, the screening level is determined to be low, and the specific thresholds between the screening levels may be adjusted according to actual conditions.
In practical applications, the user side is divided into a main broadcasting side and a viewer side, for the main broadcasting side, besides the need to acquire the interactive message, the current picture of the main broadcasting side and the special effect content added in the picture need to be sent to the server, for the main broadcasting side, the required consumed device performance may be more, and the importance of different types of messages to the viewer and the main broadcasting side may be different, for example, for the main broadcasting side, the message that the user gives a main broadcast gift may be more important, and for the viewer, the bullet screen message that the user may send may be more important.
Based on this, in another possible implementation manner of the present disclosure, when the user side sends the message request, the message request may carry an identity type identifier of the user side, and when determining a priority order of the different types of messages, the priority order of the different types of messages corresponding to the identity type identifier carried in the received message request may be determined, where the identity type identifier is used to distinguish an identity type of the user side requesting to acquire the message, for example, may be used to distinguish whether the user side requesting to acquire the message is a main broadcasting end or a viewer end.
The priority order of the different types of messages corresponding to the different identity type identifiers is, for example, a reminding message (priority is first level) when the user enters a live broadcast room, a barrage message (priority is second level) sent by the user, a message (priority is third level) when the user gives a main broadcast gift, and the priority order of the different types of messages corresponding to the audience end is a reminding message (priority is first level) when the user gives the main broadcast gift, a barrage message (priority is second level) sent by the user, and a reminding message (priority is third level) when the user enters the live broadcast room.
In a possible embodiment, the screening proportion of the messages of each level of priority may be the same for different screening levels corresponding to different id identifiers, for example, as shown in table 1 below, and the value taken in the table indicates the screening proportion of each level by the next level at the screening level:
TABLE 1
In another possible embodiment, the screening ratios of the messages with each level of priority may be different for different screening levels corresponding to different identity types, for example, the screening ratio of the messages with each level of priority for different screening levels corresponding to the viewer side may be as shown in table 1 above, the screening ratio of the messages with each level of priority for different screening levels corresponding to the anchor side may be as shown in table 2 below, and the value taken in the table indicates the screening ratio of each level by the next level at the screening level:
TABLE 2
In another possible implementation, when determining the corresponding message screening policy based on the device performance parameter of the user side, the screening proportion of each message may also be determined based on the device performance parameter of the user side.
Specifically, the corresponding screening level may be determined based on the device performance parameter of the user side, and then the preset screening ratio of each message in the screening level may be obtained. For example, if the screening level is low, the screening ratios of the message a, the message B, and the message C may all be set to 0; when the screening level is the middle level, the screening proportion of the message a may be set to 30%, the screening proportion of the message B to the message C may be set to 0, and when the screening level is the high level, the screening proportion of the message a may be set to 100%, the screening proportion of the message B may be set to 40%, and the screening proportion of the message C may be set to 0.
In another possible implementation, when determining the screening proportion of each message based on the device performance parameter of the user side, the screening level corresponding to the device performance parameter of the user side may be determined first, and then the screening proportion of each message corresponding to the identity type identifier of the user side, which is preset under the screening level, may be obtained.
And 103, screening the received message based on the message screening strategy, and sending the screened target message to the user side.
In a possible implementation manner, when filtering the received messages based on the message filtering policy, the messages received in a preset time period from the current time may be used as the messages to be filtered, the type of each message to be filtered is determined, and then the messages to be filtered of each priority level are filtered according to the filtering proportion corresponding to each type of message.
The length of the preset time period may be a length of a period in which the user terminal initiates a message acquisition request, or may be a time period from a current time to a time when the message acquisition request initiated by the user terminal is received last time, which is taken as the preset time period.
When the messages to be screened of each level of priority are screened according to the screening proportion corresponding to each type of message, the messages to be screened of each level of priority can be sorted from large to small according to the memory size occupied by the messages, then the rejection quantity N is determined based on the screening proportion corresponding to the messages to be screened of the priority and the quantity of the messages to be screened of the priority, then the messages to be screened of the first N bits are rejected, and the remaining messages to be screened after rejection are taken as the screened messages.
When the reject number N is determined based on the screening proportion corresponding to the message to be screened of the priority and the number of the message to be screened of the priority, the product of the screening proportion corresponding to the message to be screened of the priority and the number of the message to be screened of the priority may be used as the reject number.
If the product of the screening proportion corresponding to the message to be screened of the priority and the number of the message to be screened of the priority is a non-integer, rounding operation can be performed on the product, and the result after rounding operation is taken as the rejection number.
In another possible implementation manner, after the removal number N is determined, N messages to be screened may also be randomly removed from the messages to be screened of the priority, and then the remaining messages to be screened after removal are used as the screened messages.
According to the message processing method provided by the embodiment of the disclosure, when the user side sends the message acquisition request, the device performance parameters are carried in the message acquisition request, so that the server can determine the corresponding message screening strategy for the user side based on the device performance parameters, and then screen the received messages according to the message screening strategy, so that the message amount received by the user side can be matched with the device performance parameters of the user side, the message processing efficiency can be improved, the smoothness of page display is ensured, and the user experience is improved.
It will be understood by those skilled in the art that in the method of the present invention, the order of writing the steps does not imply a strict order of execution and any limitations on the implementation, and the specific order of execution of the steps should be determined by their function and possible inherent logic.
Based on the same inventive concept, the embodiment of the present disclosure further provides a message processing apparatus corresponding to the message processing method, and since the principle of the apparatus in the embodiment of the present disclosure for solving the problem is similar to the message processing method in the embodiment of the present disclosure, the implementation of the apparatus may refer to the implementation of the method, and repeated parts are not described again.
Referring to fig. 2, there is shown a schematic architecture diagram of a message processing apparatus according to an embodiment of the present disclosure, where the apparatus includes: a receiving module 201, a determining module 202 and a sending module 203; wherein,
a receiving module 201, configured to receive a message acquisition request sent by a user and a device performance parameter of the user, where the device performance parameter is used to represent an operating state of a device corresponding to the user;
a determining module 202, configured to determine a corresponding message screening policy based on the device performance parameter of the user side;
the sending module 203 is configured to screen the received message based on the message screening policy, and send the screened target message to the user side.
In a possible implementation manner, the device performance parameter of the user side includes a CPU occupancy rate and/or a memory occupancy rate.
In a possible implementation manner, the determining module 202, when determining the corresponding message screening policy based on the device performance parameter of the user end, is configured to:
determining the priority order of different types of messages;
and determining the screening proportion corresponding to the message of each level of priority based on the equipment performance parameters of the user side.
In a possible implementation manner, the message request of the user side carries an identity type identifier of the user side;
the determining module 202, when determining the priority order of the different types of messages, is configured to:
determining a priority order of different types of messages corresponding to the identity type identifier.
In a possible implementation manner, the determining module 202, when determining the filtering ratio corresponding to the message of each level of priority based on the device performance parameter of the user end, is configured to:
determining a corresponding screening grade based on the equipment performance parameters corresponding to the user side;
and acquiring the preset screening proportion of the messages of each level of priority under the screening level.
In a possible implementation manner, the sending module 203, when screening the received message based on the message screening policy, is configured to:
taking messages received in a preset time period from the current moment to the previous moment as messages to be screened, and determining the type of each message to be screened;
and screening the messages to be screened of each level of priority according to the screening proportion corresponding to each type of messages.
In a possible implementation manner, when the sending module 203 filters the message to be filtered of each level of priority according to the filtering ratio corresponding to each type of message, the sending module is configured to:
aiming at the messages to be screened of each level of priority, sorting the messages to be screened of the priority from large to small according to the memory size occupied by the messages;
determining the rejection number N based on the screening proportion corresponding to the messages to be screened of the priority and the number of the messages to be screened of the priority, wherein N is a positive integer;
and eliminating the messages to be screened which are arranged at the front N positions, and taking the remaining messages to be screened after elimination as the screened messages.
The description of the processing flow of each module in the device and the interaction flow between the modules may refer to the related description in the above method embodiments, and will not be described in detail here.
Based on the same technical concept, the embodiment of the application also provides computer equipment. Referring to fig. 3, a schematic structural diagram of a computer device 300 provided in the embodiment of the present application includes a processor 301, a memory 302, and a bus 303. The memory 302 is used for storing execution instructions and includes a memory 3021 and an external memory 3022; the memory 3021 is also referred to as an internal memory, and is used for temporarily storing operation data in the processor 301 and data exchanged with an external memory 3022 such as a hard disk, the processor 301 exchanges data with the external memory 3022 through the memory 3021, and when the computer device 300 is operated, the processor 301 communicates with the memory 302 through the bus 303, so that the processor 301 executes the following instructions:
receiving a message acquisition request sent by a user side and equipment performance parameters of the user side, wherein the equipment performance parameters are used for representing the running state of equipment corresponding to the user side;
determining a corresponding message screening strategy based on the equipment performance parameters of the user side;
and screening the received message based on the message screening strategy, and sending the screened target message to the user side.
In a possible implementation manner, in the instructions executed by the processor 301, the device performance parameter of the user end includes a CPU occupancy rate and/or a memory occupancy rate.
In a possible implementation manner, the instructions executed by the processor 301 for determining a corresponding message screening policy based on the device performance parameter of the user end include:
determining the priority order of different types of messages;
and determining the screening proportion corresponding to the message of each level of priority based on the equipment performance parameters of the user side.
In a possible implementation manner, in the instruction executed by the processor 301, the message request of the user side carries an identity type identifier of the user side;
the determining the priority order of the different types of messages includes:
determining a priority order of different types of messages corresponding to the identity type identifier.
In a possible implementation manner, the determining, by the processor 301, the filtering ratio corresponding to the message of each level of priority based on the device performance parameter of the ue includes:
determining a corresponding screening grade based on the equipment performance parameters corresponding to the user side;
and acquiring the preset screening proportion of the messages of each level of priority under the screening level.
In a possible implementation, the instructions executed by the processor 301 for filtering the received message based on the message filtering policy include:
taking messages received in a preset time period from the current moment to the previous moment as messages to be screened, and determining the type of each message to be screened;
and screening the messages to be screened of each level of priority according to the screening proportion corresponding to each type of messages.
In a possible implementation manner, in the instructions executed by the processor 301, the screening the message to be screened of each level of priority according to the screening ratio corresponding to each type of message includes:
aiming at the messages to be screened of each level of priority, sorting the messages to be screened of the priority from large to small according to the memory size occupied by the messages;
determining the rejection number N based on the screening proportion corresponding to the messages to be screened of the priority and the number of the messages to be screened of the priority, wherein N is a positive integer;
and eliminating the messages to be screened which are arranged at the front N positions, and taking the remaining messages to be screened after elimination as the screened messages.
The embodiments of the present disclosure also provide a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to perform the steps of the message processing method described in the above method embodiments. The storage medium may be a volatile or non-volatile computer-readable storage medium.
The computer program product of the message processing method provided in the embodiments of the present disclosure includes a computer-readable storage medium storing a program code, where instructions included in the program code may be used to execute steps of the message processing method in the above method embodiments, which may be referred to specifically for the above method embodiments, and are not described herein again.
The embodiments of the present disclosure also provide a computer program, which when executed by a processor implements any one of the methods of the foregoing embodiments. The computer program product may be embodied in hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied in a computer storage medium, and in another alternative embodiment, the computer program product is embodied in a Software product, such as a Software Development Kit (SDK), or the like.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the system and the apparatus described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, apparatus, and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present disclosure may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such understanding, the technical solution of the present disclosure may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present disclosure. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Finally, it should be noted that: the above-mentioned embodiments are merely specific embodiments of the present disclosure, which are used for illustrating the technical solutions of the present disclosure and not for limiting the same, and the scope of the present disclosure is not limited thereto, and although the present disclosure is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive of the technical solutions described in the foregoing embodiments or equivalent technical features thereof within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present disclosure, and should be construed as being included therein. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.