Processing Method, Device, Medium and Equipment for Write Task

By introducing a delay queue mechanism in the write task processing, the processing results of the task are determined based on the comparison of the time difference value of the write task and the preset threshold value, the problem of the surge in request volume during special periods is solved, and the effect of reducing the number of diffusion requests and reducing the number of write operations is achieved.

CN115706717BActive Publication Date: 2025-06-13TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110879024.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-02
Publication Date
2025-06-13
Estimated Expiration
2041-08-02

AI Technical Summary

Technical Problem

During special periods such as the Spring Festival, the number of requests for dynamic updates and group chat messages has increased sharply, resulting in increased background pressure and affecting system stability.

Method used

By generating the current write task, the difference between its generation time and the execution time of the most recently executed write task is determined, and the processing result of the current write task is determined based on the comparison of the preset threshold. If the difference is less than the threshold, the current write task will be discarded directly; if the difference is not less than the threshold, it will be placed in the delay queue and executed after delay.

Benefits of technology

It effectively reduces the number of diffusion requests, reduces the number of write operations, alleviates background pressure, improves the robustness of the system, and does not affect the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115706717B_ABST
    Figure CN115706717B_ABST
Patent Text Reader

Abstract

The present application discloses a method, apparatus, medium, and device for processing a write task, relating to the field of computer communication, including: generating a current write task in response to a message notification request for a target user; the current write task is used to write the notification message in the message notification request into the message subscription list of the target user; determining the generation time of the current write task; determining the execution time of a target historical write task according to the execution information of the historical write task corresponding to the message subscription list; the target historical write task is the most recently executed write task; determining the difference between the generation time of the current write task and the execution time of the target historical write task; determining the processing result of the current write task according to the comparison between the difference and a preset threshold. The solution provided by the present application can effectively reduce the spread of requests, reduce write operations, and relieve the background pressure.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer communication, and particularly to a method, device, medium, and equipment for processing write tasks. Background Art

[0002] With the development and popularization of Internet technology and wireless communication, using chat software for group chats or viewing friends' dynamics has become a high-frequency operation that everyone participates in. Behind this, a single request initiated by a user often leads to hundreds or thousands of times of diffusion. For example, when a person posts a moment and needs to remind all friends to view the update, if there are 1000 friends, the diffusion ratio is 1000, greatly amplifying the request volume. During special periods such as the Spring Festival, dynamic updates and group chat messages often increase exponentially, the request volume surges, putting great pressure on the background and posing risks to system stability.

[0003] Therefore, a method is needed to reduce the diffused request volume without degrading the user experience. Summary of the Invention

[0004] To reduce the diffusion of request volume and decrease the number of write operations, this application provides a method, device, medium, and equipment for processing write tasks. The technical solutions are as follows:

[0005] In a first aspect, this application provides a method for processing a write task, the method comprising:

[0006] In response to a message notification request for a target user, generating a current write task; the current write task is used to write the notification message carried in the message notification request into the message subscription list of the target user;

[0007] Determining the generation time of the current write task;

[0008] Based on the execution information of the historical write tasks corresponding to the message subscription list, determining the execution time of a target historical write task; the target historical write task is the most recently executed write task;

[0009] Determining the difference between the generation time of the current write task and the execution time of the target historical write task;

[0010] Based on the comparison between the difference and a preset threshold, determining the processing result of the current write task.

[0011] In a second aspect, this application provides a device for processing a write task, the device comprising:

[0012] A current writing task generation module, configured to generate a current writing task in response to a message notification request for a target user; the current writing task is used to write a notification message carried in the message notification request into a message subscription list of the target user;

[0013] A generation time determination module, configured to determine a generation time of the current writing task;

[0014] A target historical writing task determination module, configured to determine an execution time of a target historical writing task according to execution information of a historical writing task corresponding to the message subscription list; the target historical writing task is the most recently executed writing task;

[0015] A time difference determination module, configured to determine a difference between the generation time of the current writing task and the execution time of the target historical writing task;

[0016] A processing module, configured to determine a processing result of the current writing task according to a comparison between the difference and a preset threshold.

[0017] In a third aspect, the present application provides a computer-readable storage medium, in which at least one instruction or at least one program segment is stored, and the at least one instruction or at least one program segment is loaded and executed by a processor to implement a processing method for a writing task as described in the first aspect.

[0018] In a fourth aspect, the present application provides a computer device, which includes a processor and a memory, and at least one instruction or at least one program segment is stored in the memory, and the at least one instruction or at least one program segment is loaded and executed by the processor to implement a processing method for a writing task as described in the first aspect.

[0019] In a fifth aspect, the present application provides a computer program product or a computer program, which includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes a processing method for a writing task as described in the first aspect.

[0020] A processing method, device, medium and device for a writing task provided by the present application have the following technical effects:

[0021] The present application provides a method for reducing diffusion and alleviating background pressure in the scenario of large-scale write diffusion in a distributed system. In the solution provided by the present application, the background stores the execution time of the historical write tasks corresponding to each message subscription list. If the generation time of the current write task is not less than a preset threshold from the execution time of the most recently executed write task, the current write task will be placed in a delay queue, and after a preset delay time, the current write task dequeues from the delay queue and is executed, completing the write operation on the message subscription list of the target user to achieve the effect of notifying the target user of new messages; if the generation time of the current write task is less than the preset threshold from the execution time of the most recently executed write task, the current write task is directly discarded, which is equivalent to filtering out the message notification request corresponding to the current write task. In this way, the scale of diffusion will be greatly reduced, the pressure on the background is alleviated, and the robustness of the system is improved; because there is a certain time interval between two times when a user views messages, the above preset threshold is adaptively set according to this time interval, so that the solution provided by the present application will not affect the user experience when implemented; in addition, the message notification request corresponding to the current write task can be the filtering result or aggregation result of one or more notification requests for the target user, further reducing the diffusion scale of the request volume and reducing the number of write operations.

[0022] Additional aspects and advantages of the present application will be given in part in the following description, will become apparent in part from the following description, or will be understood through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0024] Figure 1 is a schematic diagram of the implementation environment of a method for processing write tasks provided by an embodiment of the present application;

[0025] Figure 2 is a schematic flowchart of a method for processing write tasks provided by an embodiment of the present application;

[0026] Figure 3 is a schematic flowchart of generating a current write task in response to a message notification request for a target user provided by an embodiment of the present application;

[0027] Figure 4 is a schematic flowchart of another method for generating a current write task provided by an embodiment of the present application;

[0028] Figure 5 is another schematic flow chart of generating a current writing task provided by an embodiment of the present application;

[0029] Figure 6 is a schematic flow chart of determining a processing result of a current writing task provided by an embodiment of the present application;

[0030] Figure 7 is a schematic flow chart of updating execution information provided by an embodiment of the present application;

[0031] Figure 8 is a schematic diagram of a notification prompt style provided by an embodiment of the present application;

[0032] Figure 9 is a time schematic diagram of content update and red dot update in a specific application scenario provided by an embodiment of the present application;

[0033] Figure 10 is a schematic diagram of a processing device for a writing task provided by an embodiment of the present application;

[0034] Figure 11 is a schematic hardware structure diagram of a device for implementing a processing method of a writing task provided by an embodiment of the present application. Specific embodiments

[0035] In order to reduce the spread of requests and reduce the number of writing operations, embodiments of the present application provide a processing method, device, medium, and device for a writing task. The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present application. Examples of the embodiments are shown in the accompanying drawings, where the same or similar reference numerals represent the same or similar elements or elements with the same or similar functions throughout.

[0036] It should be noted that the terms "first", "second", etc. in the description, claims and the above-mentioned drawings of this application are used to distinguish similar objects, and do not necessarily describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or server that includes a series of steps or units does not necessarily limit to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0037] To facilitate the understanding of the technical solutions described in the embodiments of the present application and the technical effects produced thereby, the embodiments of the present application explain the relevant professional terms involved:

[0038] Feed stream: An information stream that continuously updates and presents content to users. Everyone's Moments, Weibo follow page, etc. are all a Feed stream. Each status or message in the Feed stream is a Feed. For example, a status in Moments is a Feed, and a Weibo in Weibo is a Feed. To implement a Feed stream system, the two most crucial cores are storage and pushing.

[0039] Write diffusion: It is a pushing scheme in the Feed stream system, also known as the push scheme or push (Push) mode. In the background server, multiple writes are required for one request. For example, when a user posts a Moments, it is necessary to remind all friends to view it. At this time, the updated status needs to be written into the data of all friends. This method maintains a subscription list for each user to record the message indexes subscribed by the user. When the subscribed user posts a message, the subscription list of the subscribed users is updated.

[0040] Hash: Also known as hashing or digesting, it transforms an input of any length (also called the pre-image) into an output of a fixed length through a hashing algorithm. This output is the hash value. This transformation is a compression mapping.

[0041] Consistent hashing: It is a special hashing algorithm aimed at solving the problem of distributed caching.

[0042] Group chat: Multi-person chat in chat software.

[0043] Red dot: Also known as the message badge. When there is a new message or dynamic update and it is necessary to remind the user, a red dot is displayed on the user's terminal application to remind the user to view the latest update.

[0044] Request diffusion ratio: The ratio of the number of users to which multiple requests need to be diffused to the number of requests.

[0045] Please refer to Figure 1 , which is a schematic diagram of the implementation environment of a method for processing a write task provided by an embodiment of the present application. As Figure 1 shown, the implementation environment may at least include a first terminal 10, a second terminal 20, and a server 30.

[0046] Specifically, the first terminal 10 and the second terminal 20 may include devices such as smartphones, desktop computers, tablet computers, laptop computers, digital assistants, smart wearable devices, monitoring devices, and voice interaction devices, and may also include software running on the devices. For example, some web pages provided by service providers to users, or applications provided by these service providers to users.

[0047] Specifically, the server 30 may be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The server 30 may include a network communication unit, a processor, a memory, and so on. The terminal and the server may be directly or indirectly connected through wired or wireless communication means, which are not limited in this application.

[0048] Only as an example, the application programs installed on the first terminal 10 and the second terminal 20 may be served by the server 30. The first terminal 10 may be a terminal corresponding to a non-target user, and the second terminal 20 may be a terminal corresponding to a target user. The server 30 determines whether to execute a write task according to the message notification request sent by the first terminal 10 to notify the target user on the second terminal 20. The connection between the first terminal 10 and the server 30, and between the second terminal 20 and the server 30 may be directly or indirectly connected through wired or wireless communication means, which are not limited in the embodiments of the present disclosure.

[0049] The embodiments of the present application can also be implemented in combination with cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or a local area network to achieve data computing, storage, processing, and sharing. It can also be understood as the general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. Cloud technology requires cloud computing as a support. Cloud computing is a computing model that distributes computing tasks on a resource pool composed of a large number of computing devices, enabling various application systems to obtain computing power, storage space, and information services as needed. The network that provides resources is called the "cloud". Specifically, the server 30 and the database are located in the cloud, and the server 30 can be a physical machine or a virtualized machine.

[0050] The processing method for the write task provided by the embodiments of the present disclosure can be executed by a processing device for the write task, and the processing device for the write task can be integrated in an electronic device such as a client or a terminal in the form of hardware or software.

[0051] The following introduces a processing method for the write task provided by the present application. Figure 2 is a flowchart of a processing method for the write task provided by the embodiments of the present application. The present application provides the method operation steps as described in the embodiments or the flowchart, but based on routine or non-creative labor, there can be more or fewer operation steps. The order of the steps listed in the embodiments is only one of the ways for the execution order of many steps and does not represent the only execution order. When the actual system or server product is executed, it can be executed in the order of the method shown in the embodiments or the drawings or executed in parallel (for example, in an environment of parallel processors or multi-threaded processing). Please refer to Figure 2 A processing method for the write task provided by the embodiments of the present application may include the following steps:

[0052] S210: In response to a message notification request for a target user, generate a current write task; the current write task is used to write the notification message carried in the message notification request into the message subscription list of the target user.

[0053] It is understandable that with the development of computer communication technology, a new type of information display method has emerged in Internet applications, namely the Feed stream. The Feed stream can continuously update and present content to users. For example, Moments in Weibo or WeChat adopt this method. One of the cores of the Feed stream is pushing, and there are two common pushing schemes: write diffusion and read diffusion, which can be selected according to application types, user scales, read and write data volumes, etc. Specifically, in the write diffusion (also known as the push mode) pushing scheme, a message subscription list is maintained for each user to record the message indexes subscribed by the user. When a subscribed user publishes a message, the message subscription list of the subscribed users is updated. However, when the number of subscribed users is very large, every time a subscribed user publishes a message, a large number of write operations need to be performed. For example, a Moments dynamic message published by a user needs to remind all friends to view the update. If the user has 1,000 friends, the request diffusion ratio is 1,000, which greatly amplifies the request volume. Assuming that during special periods such as the Spring Festival, every message notification request of the subscribed users will perform write diffusion. If 1 billion users each publish a Moments at the same time, and each person has an average of n friends and is diffused n times on average, then 10n billion diffusions are required. The diffusion volume grows exponentially with the growth of the request volume, and the original request volume is already very high. The pressure brought to the system or the background after exponential growth will be even greater. Therefore, it is necessary to effectively reduce the request volume that needs to be diffused without affecting the user experience, that is, to reduce write operations.

[0054] In the embodiments of the present application, the target user is a subscribed user. One or more message notification requests for the target user can correspond to the objects subscribed by one or more target users. The objects subscribed by the target user can be called subscribed users. In the write diffusion pushing method, each subscribed user has a corresponding message subscription list for recording the indexes of the messages published by the subscribed users, such as metadata such as message identifiers, message types, and publishing times. When a subscribed user publishes a message, the terminal of the subscribed user sends a message notification request to the background. The message notification request carries a notification message, which is used to remind the subscribed user that there is a new message. For example, it can include a message identifier, a publishing time, etc., and can also include or not include the specific substantial content of the new message, which can be determined according to the requirements of the application function and is not limited here. In addition, the message notification request can also carry the identity identifier of the subscribed user, etc. Exemplarily, in the application scenario of group chat, the group members form a mutual subscription relationship. When one of the group members publishes a new message, the corresponding message notification request can include a notification message, the identity identifier of the group member, a group identifier, etc. If the content of the group message is also actively written into the message subscription list of the subscribed users and sent to the terminals of the subscribed users, the message notification request can also include the substantial content of the new message.

[0055] In an embodiment of the present application, after the background receives a message notification request sent by a subscribed user, based on the system architecture of Feed stream write diffusion, a write task will be correspondingly generated. The execution of the write task is the above-mentioned write operation, and the write operation is to write the notification message in the message notification request into the message subscription list of the corresponding subscribed user.

[0056] In an embodiment of the present application, the background adopts a distributed system architecture. The distributed system architecture includes multiple parallel server nodes. Specifically, as Figure 3 shown, generating the current write task in response to a message notification request for a target user may include the following steps:

[0057] S310: Obtain the message notification request, and determine the user identifier of the target user according to the message notification request.

[0058] In a feasible manner, if the user identifier of the target user is included in the message notification request sent by the subscribed user, the user identifier of the target user can be directly determined; in another feasible embodiment, based on the write diffusion method of the Feed stream, the background stores the attention data between users. The user identifier of the target user to which the message notification request is to be diffused can be determined from the attention data according to the identity identifier (i.e., the user identifier) of the subscribed user in the message notification request and the identifier corresponding to the message type (such as group chat message, Moments message).

[0059] S330: Based on the consistent hashing algorithm, determine the corresponding target server node according to the user identifier.

[0060] Specifically, the consistent hashing algorithm is used to distribute data and select routes in a dynamic network topology. Perform a modulo operation on the user identifier represented by a number, and the value after modulo corresponds to the node identifier of the server node.

[0061] S350: Send the message notification request to the target server node, so that the target server node generates the current write task in response to the message notification request.

[0062] Multiple message notification requests for the same subscribed user can be routed to the same server node, so that the server node generates the corresponding write task, and the server node can also perform further processing such as filtering or aggregating multiple message notification requests. It can be understood that a server node can process the message notification requests corresponding to one or more subscribed users.

[0063] In a feasible embodiment, specifically, as Figure 4 shown, the method may further include the following steps:

[0064] S410: Receive multiple of the message notification requests within a preset time period.

[0065] It can be understood that multiple of the message notification requests are all directed to the target user.

[0066] S420: Filter multiple of the message notification requests based on a preset filtering condition to obtain a first target message notification request.

[0067] Exemplarily, the preset filtering condition can be set according to application function requirements. For example, it can be set to filter multiple message notification requests sent to the target user (i.e., the same subscribed user) within a preset time period. If the notification message in the message notification request has no substantial content, it can be directly filtered out. The preset filtering condition can also be set to filter multiple message notification requests sent to the target user within a preset time period, and only retain the last message notification request within the preset time period after filtering multiple requests.

[0068] S440: Generate the current write task according to the first target message notification request.

[0069] In another feasible implementation manner, specifically, as Figure 5 shown, the method may further include the following steps:

[0070] S410: Receive multiple of the message notification requests within a preset time period;

[0071] S430: Aggregate multiple of the message notification requests based on a preset aggregation condition to obtain a second target message notification request.

[0072] Exemplarily, the preset aggregation condition can be set according to application function requirements. For example, it can be set to aggregate multiple message notification requests sent to the target user within a preset time period, and merge the message notification requests containing the specific content of the new message (such as group chat conversation information) into the second target message notification request, and the specific content of the messages can also be merged in sequence.

[0073] S450: Generate the current write task according to the second target message notification request.

[0074] S230: Determine the generation time of the current write task.

[0075] S250: Determine the execution time of the target historical write task according to the execution information of the historical write task corresponding to the message subscription list; the target historical write task is the most recently executed write task.

[0076] In the embodiments of the present application, the background stores the execution information of the write task, that is, the write information for the message subscription list of each user. The write information records the time of the write operation of the message subscription list of each user, and in some cases, it may also include the newly written message content.

[0077] In one embodiment of the present application, specifically, determining the execution time of the target historical write task according to the execution information of the historical write task corresponding to the message subscription list may include the following steps:

[0078] S510: Query the execution information of the historical write task corresponding to the message subscription list according to the user identifier of the target user.

[0079] Exemplarily, the execution information of the write task may adopt a storage structure of an array or a linked list, such as a hashmap (hash table) structure in distributed storage. According to the user identifier of the target user, determine the write information of the message subscription list corresponding to the target user, that is, the execution information of the corresponding historical write task. In the embodiments of the present application, the historical write tasks may be write tasks that have all been executed. Each historical write task is first placed in a delay queue, dequeued from the delay queue after the preset delay time of the delay queue, and then each historical write task is executed, that is, the write tasks that need to be executed are delayed.

[0080] S530: Determine the target historical write task according to the execution times of the historical write tasks in the execution information of the historical write task.

[0081] In the embodiments of the present application, the time distance between the execution time (that is, the dequeue time) of the target historical write task and the current time is the closest.

[0082] In another feasible implementation manner, only the execution information of the most recently executed write task may be recorded in the execution information of the write task. When a new write task is executed, the execution information is overwritten and updated.

[0083] S270: Determine the difference between the generation time of the current write task and the execution time of the target historical write task.

[0084] S290: Determine the processing result of the current write task according to the comparison between the difference and the preset threshold.

[0085] In the embodiments of the present application, the current write task is cancelled or placed in a delay queue for processing according to the comparison situation to reduce the write task, that is, to reduce the number of write operations. Specifically, such as Figure 6As shown, determining the processing result of the current write task according to the comparison between the difference value and a preset threshold may include the following steps:

[0086] S910: When the difference value is less than the preset threshold, discard the current write task.

[0087] In this case, it is equivalent to not performing a write operation on the message notification request corresponding to the current write task, or not spreading the message notification request, which can effectively reduce the request spread ratio.

[0088] S930: When the difference value is not less than the preset threshold, put the current write task into a delay queue.

[0089] S950: When, after the preset delay time of the delay queue, the current write task dequeues from the delay queue, execute the current write task.

[0090] In the embodiments of the present application, a delay queue is used to perform delay processing on write tasks. In a feasible implementation, the preset delay time of the delay queue is T, that is, the time difference between the time when a write task enters the delay queue and the time when the write task exits the delay queue is T. In an ideal state, the execution time of the write task put into the delay queue is equal to the dequeue time, and at the same time, the generation time of the write task is equal to the enqueue time, then the delay time T can be used as the preset threshold. However, in actual applications, there is still a period of processing time from when the write task dequeues to when it is executed. It can be understood that the setting of the preset threshold is a trade-off between user experience and the reduction effect of the request volume (or write operation). The shorter the preset threshold, the better the user experience, and the worse the reduction effect; the longer the preset threshold, the worse the user experience, and the better the reduction effect. Exemplarily, in the application scenario of a friend circle, according to the behavior characteristics of subscribed users, the probability distribution of the time interval for the subscribed users to view the content of the friend circle can be simulated, and the preset threshold can be selected as the smallest value of the time interval, that is to say, the preset threshold can be the shortest time required for the subscribed users to consume the sent message content once. In addition, it can be balanced according to the reduction effect expected to be achieved by the application requirements.

[0091] The present application adaptively uses a delay queue to perform delay processing on write tasks by utilizing the characteristic of the interval between subscribed users' viewings of messages, resulting in a time delay effect, and does not affect the user experience after reducing write operations.

[0092] In an embodiment of the present application, as Figure 7 shown, the method may further include the following steps:

[0093] S931: Execute the current write task and record the execution time of the current write task.

[0094] S933: Update the execution information of the historical write task corresponding to the message subscription list according to the execution time of the current write task.

[0095] Further, the terminal of the subscribed user reads the notification message from the message subscription list and performs corresponding notification display in the terminal application interface to prompt the subscribed user that there is a new message published. Exemplarily, in the application functions of the Moments or group chat, as Figure 8 shown in the square box, various red dot (also known as message badges) styles can be used for notification prompts.

[0096] In a feasible implementation manner, since there is a certain time interval between two times when the user views the message, the above preset threshold is adaptively set according to this time interval, which can ensure that the solution provided by this application does not affect the user experience during implementation. As Figure 9 shown, the preset threshold is T. The time interval between two times when the target user views the red dot is greater than T. There is an updated red dot - 1 before the previous view, and an updated red dot - 2 before the subsequent view. Assume Figure 9 that the time of red dot update can be equal to the dequeue time of the write task or the execution time of the write task, and the content update time can be equal to the generation time of the write task. In Figure 9 it, assume that the interval between the time of the first content update A1 and the time of the corresponding updated red dot - 1 is T. After the first time A1, if there is content update but no write operation is performed, that is, the red dot will not be updated again; the interval between the time of the first content update B1 and the time of the corresponding updated red dot - 2 is T. After the first time B1, if there is content update later, since the time interval from the updated red dot - 1 is less than T, no write operation is performed, that is, the red dot will not be updated again. Based on the above assumptions, when the first content update C1 occurs, the time of the first content update C1 coincides with the execution time of the updated red dot - 2. However, at this time point, the execution operation of the target historical write task corresponding to the first content update C1 is to update the red dot - 1, and the time interval between them is not less than T. Therefore, the write operation corresponding to the first content update C1 will be executed, and the operation of updating the red dot - 3 will be executed after a delay of T time. For the content updates from the first time C1 to the s-th time Cs, the generation time of the corresponding write task is less than T from the execution time of the updated red dot - 2, and they will be directly discarded. By cycling in this way, the message notification requests triggered by content updates within each T time period can be processed, achieving the reduction of the request diffusion volume without affecting the user experience.

[0097] Exemplarily, assume that the subscribed user originally posts one dynamic per second, and there are 1000 subscribed users who receive dynamic message notifications.

[0098] If each piece of dynamic information requests to be written into the message subscription list of subscribed users, it is equivalent to spreading 1000 times per second, 60000 times per minute, and 86.4 million times per day. With the solution of this application, assuming the time interval between two executions of the write task (i.e., Figure 8 the time interval for updating the red dot shown in

[0099] is 60s), the new solution can reduce the spreading volume by 98.3%. Only 1.44 million times are needed per day, which greatly reduces the spreading volume, reduces the number of write operations, and improves the system stability.

[0100] The embodiment of this application also provides a processing device 1000 for write tasks, as Figure 10 shown. The device 1000 may include:

[0101] A current write task generation module 1010, configured to generate a current write task in response to a message notification request for a target user; the current write task is used to write the notification message carried in the message notification request into the message subscription list of the target user;

[0102] A generation time determination module 1020, configured to determine the generation time of the current write task;

[0103] A target historical write task determination module 1030, configured to determine the execution time of a target historical write task according to the execution information of the historical write task corresponding to the message subscription list; the target historical write task is the most recently executed write task;

[0104] A time difference determination module 1040, configured to determine the difference between the generation time of the current write task and the execution time of the target historical write task;

[0105] A processing module 1050, configured to determine the processing result of the current write task according to the comparison between the difference and a preset threshold.

[0106] In an embodiment of this application, the current write task generation module 1010 may include:

[0107] An acquisition unit, configured to acquire a message notification request and determine the user identifier of the target user according to the message notification request;

[0108] A node matching unit, configured to determine a corresponding target server node based on the consistent hashing algorithm according to the user identifier;

[0109] A sending unit, configured to send the message notification request to the target server node, so that the target server node generates the current write task in response to the message notification request.

[0110] In an embodiment of the present application, the current write task generation module 1010 may further include:

[0111] A first receiving unit, configured to receive, by the target server node, a plurality of the message notification requests within a preset time period;

[0112] A filtering unit, configured to filter the plurality of message notification requests based on a preset filtering condition to obtain a first target message notification request;

[0113] A first task generation unit, configured to generate the current write task according to the first target message notification request.

[0114] In an embodiment of the present application, the current write task generation module 1010 may further include:

[0115] A second receiving unit, configured to receive, by the target server node, a plurality of the message notification requests within a preset time period;

[0116] An aggregation unit, configured to aggregate the plurality of message notification requests based on a preset aggregation condition to obtain a second target message notification request;

[0117] A second task generation unit, configured to generate the current write task according to the second target message notification request.

[0118] In an embodiment of the present application, the target historical write task determination module 1030 may include:

[0119] An information query unit, configured to query, according to the user identifier of the target user, the execution information of the historical write task corresponding to the message subscription list;

[0120] A target historical write task determination unit, configured to determine a target historical write task according to the execution time of each historical write task in the execution information of the historical write task.

[0121] In an embodiment of the present application, the processing module 1050 may include:

[0122] A task cancellation unit, configured to discard the current write task when the difference is less than the preset threshold;

[0123] A task enqueueing unit, configured to place the current write task into a delay queue when the difference is not less than the preset threshold.

[0124] A task execution unit, configured to execute the current write task when the current write task dequeues from the delay queue after the preset delay time of the delay queue has elapsed.

[0125] It should be noted that for the device provided in the above embodiment, when implementing its functions, only the division of the above functional modules is used for illustration. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device provided in the above embodiment and the method embodiment belong to the same concept, and the specific implementation process can be seen in the method embodiment, which will not be elaborated here.

[0126] An embodiment of the present application provides a computer device, which includes a processor and a memory. At least one instruction or at least one program segment is stored in the memory, and the at least one instruction or the at least one program segment is loaded and executed by the processor to implement a processing method for a write task as provided in the above method embodiment.

[0127] Figure 11 The figure shows a schematic hardware structure diagram of a device for implementing a processing method for a write task provided in an embodiment of the present application. The device may participate in forming or include the device or system provided in the embodiment of the present application. As Figure 11 shown, the device 11 may include one or more (shown as 1102a, 1102b,..., 1102n in the figure) processors 1102 (the processor 1102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 1104 for storing data, and a transmission device 1106 for communication functions. In addition, it may further include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a power supply, and / or a camera. Those of ordinary skill in the art can understand that Figure 11 the structure shown is only schematic and does not limit the structure of the above electronic device. For example, the device 11 may further include more or fewer components than Figure 11 shown, or have a different configuration from Figure 11 shown.

[0128] It should be noted that the one or more processors 1102 and / or other data processing circuits described above can generally be referred to as "data processing circuits" herein. The data processing circuit can be embodied in software, hardware, firmware, or any combination thereof, in whole or in part. In addition, the data processing circuit can be a single independent processing module, or can be incorporated in whole or in part into any one of the other elements in the device 11 (or mobile device). As involved in the embodiments of the present application, the data processing circuit is a kind of processor control (such as the selection of a variable resistor terminal path connected to an interface).

[0129] The memory 1104 can be used to store software programs and modules of application software, such as the program instructions / data storage devices corresponding to the methods described in the embodiments of the present application. The processor 1102 executes various functional applications and data processing by running the software programs and modules stored in the memory 1104, that is, to implement the above-mentioned processing method for a write task. The memory 1104 can include high-speed random access memory, and can also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memories. In some instances, the memory 1104 can further include memories remotely located relative to the processor 1102, and these remote memories can be connected to the device 11 through a network. Examples of the above-mentioned network include but are not limited to the Internet, intranet, local area network, mobile communication network, and combinations thereof.

[0130] The transmission device 1106 is used to receive or send data via a network. Specific examples of the above-mentioned network can include the wireless network provided by the communication provider of the device 11. In one instance, the transmission device 1106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one instance, the transmission device 1106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0131] The display can be, for example, a touch-screen liquid crystal display (LCD), which enables the user to interact with the user interface of the device 11 (or mobile device).

[0132] The embodiments of the present application also provide a computer-readable storage medium, which can be disposed in a server to store at least one instruction or at least one segment of program related to implementing the processing method for a write task in the method embodiments. The at least one instruction or the at least one segment of program is loaded and executed by the processor to implement the processing method for a write task provided by the above-mentioned method embodiments.

[0133] Optionally, in this embodiment, the above storage medium may be located in at least one of multiple network servers in a computer network. Optionally, in this embodiment, the above storage medium may include, but is not limited to: various media that can store program codes such as USB flash drives, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), mobile hard disks, magnetic disks, or optical discs.

[0134] An embodiment of the present invention also provides a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and these computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads these computer instructions from the computer-readable storage medium, and the processor executes these computer instructions, so that the computer device executes a processing method for a write task provided in the above various optional embodiments.

[0135] As can be seen from the embodiments of a processing method, device, medium, and device for a write task provided by the present application above,

[0136] The present application provides a method for reducing diffusion and reducing background pressure in the scenario of large-scale write diffusion in a distributed system. In the solution provided by the present application, the execution time of the historical write tasks corresponding to each message subscription list is stored in the background, that is, the time when dequeuing from the delay queue. If the enqueue time of the current write task is not less than a preset threshold from the execution time of the most recently executed write task, the current write task will dequeue and be executed to complete the write operation on the message subscription list of the target user, so as to achieve the effect of notifying the target user of new messages; if the enqueue time of the current write task is less than the preset threshold from the execution time of the most recently executed write task, the current write task will not dequeue and will not be executed, which is equivalent to filtering out the message notification request corresponding to the current write task. In this way, the scale of diffusion will be greatly reduced, the pressure on the background will be alleviated, and the robustness of the system will be improved; because there is a certain time interval between two times when a user views messages, the above preset threshold is adaptively set according to this time interval, which can ensure that the solution provided by the present application does not affect the user experience during implementation; in addition, the message notification request corresponding to the current write task may be the filtering result or aggregation result of one or more notification requests for the target user, further reducing the diffusion scale of the request volume and reducing the number of write operations.

[0137] It should be noted that the above order of the embodiments of the present application is only for description and does not represent the superiority or inferiority of the embodiments. And the above specific embodiments of the present application have been described. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve the desired results. Additionally, the processes depicted in the figures do not necessarily require the particular order or sequential order shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0138] Each embodiment in the present application is described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the embodiments of the device, equipment, and storage medium, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiments.

[0139] Those of ordinary skill in the art can understand that all or part of the steps for implementing the above embodiments can be completed by hardware, or can be completed by a program instructing relevant hardware. The program can be stored in a computer-readable storage medium. The above-mentioned storage medium can be a read-only memory, a magnetic disk, an optical disk, or the like.

[0140] The above are only the preferred embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included within the protection scope of the present application.

Claims

1. A method for processing a write task, characterized in that, the method includes: responding to a message notification request for a target user, generating a current write task; the current write task is used to write the notification message carried in the message notification request into the message subscription list of the target user; the target user is a subscribed user of the message; the message notification request comes from the subscribed user corresponding to the target user; the message subscription list is used to record the message indexes of one or more of the subscribed users; determining the generation time of the current write task; determining the execution time of a target historical write task according to the execution information of the historical write task corresponding to the message subscription list; the target historical write task is the most recently executed write task; determining the difference between the generation time of the current write task and the execution time of the target historical write task; when the difference is less than a preset threshold, discarding the current write task; when the difference is not less than the preset threshold, putting the current write task into a delay queue; when, after the preset delay time of the delay queue, the current write task dequeues from the delay queue, executing the current write task.

2. The method according to claim 1, characterized in that, the method further includes: receiving a plurality of the message notification requests within a preset time period; filtering the plurality of message notification requests based on a preset filtering condition to obtain a first target message notification request; generating the current write task according to the first target message notification request.

3. The method according to claim 1, characterized in that, the method further includes: receiving a plurality of the message notification requests within a preset time period; aggregating the plurality of message notification requests based on a preset aggregation condition to obtain a second target message notification request; generating the current write task according to the second target message notification request.

4. The method according to claim 1, characterized in that, the generating a current write task in response to a message notification request for a target user includes: obtaining the message notification request, and determining the user identifier of the target user according to the message notification request; determining a corresponding target server node based on the consistent hashing algorithm according to the user identifier; sending the message notification request to the target server node, so that the target server node generates the current write task in response to the message notification request.

5. The method according to claim 1, characterized in that, the method further includes: executing the current write task, and recording the execution time of the current write task; updating the execution information of the historical write task corresponding to the message subscription list according to the execution time of the current write task.

6. A processing device for a write task, characterized in that, the device includes: A current write task generation module, configured to generate a current write task in response to a message notification request for a target user; the current write task is used to write a notification message carried in the message notification request into a message subscription list of the target user; the target user is a subscribed user of a message; the message notification request comes from a subscribed user corresponding to the target user; the message subscription list is used to record message indexes of one or more of the subscribed users; A generation time determination module, configured to determine a generation time of the current write task; A target historical write task determination module, configured to determine an execution time of a target historical write task according to execution information of a historical write task corresponding to the message subscription list; the target historical write task is the most recently executed write task; A time difference determination module, configured to determine a difference between the generation time of the current write task and the execution time of the target historical write task; A processing module, including: A task cancellation unit, configured to discard the current write task when the difference is less than a preset threshold; A task enqueue unit, configured to put the current write task into a delay queue when the difference is not less than the preset threshold; A task execution unit, configured to execute the current write task when the current write task dequeues from the delay queue after a preset delay time of the delay queue has elapsed.

7. The apparatus according to claim 6, wherein, the current write task generation module includes: A first receiving unit, configured to receive a plurality of the message notification requests within a preset time period; A filtering unit, configured to filter the plurality of message notification requests based on a preset filtering condition to obtain a first target message notification request; A first task generation unit, configured to generate the current write task according to the first target message notification request.

8. The apparatus according to claim 6, wherein, the current write task generation module includes: A second receiving unit, configured to receive a plurality of the message notification requests within a preset time period; An aggregation unit, configured to aggregate the plurality of message notification requests based on a preset aggregation condition to obtain a second target message notification request; A second task generation unit, configured to generate the current write task according to the second target message notification request.

9. The apparatus according to claim 6, wherein, the current write task generation module includes: An obtaining unit, configured to obtain a message notification request and determine a user identifier of the target user according to the message notification request; A node matching unit, configured to determine a corresponding target server node based on a consistent hashing algorithm according to the user identifier; A sending unit, configured to send the message notification request to the target server node so that the target server node generates the current write task in response to the message notification request.

10. A computer-readable storage medium, wherein, At least one instruction or at least one program segment is stored in the computer-readable storage medium, and the at least one instruction or the at least one program segment is loaded and executed by a processor to implement a processing method for a writing task as described in any one of claims 1 to 5.

11. A computer device, characterized in that, the computer device includes a processor and a memory, at least one instruction or at least one program segment is stored in the memory, and the at least one instruction or the at least one program segment is loaded and executed by the processor to implement a processing method for a writing task as described in any one of claims 1 to 5.

12. A computer program product, characterized in that, the computer program product includes computer instructions, the computer instructions are stored in a computer-readable storage medium, a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to execute a processing method for a writing task as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Media information collection method and device, electronic equipment and storage medium

    CN113010799A