A data processing method, system, storage medium and electronic device

Through the single-queue lock-free data structure and distributed algorithm, the problem of low message storage and reading efficiency is solved, and efficient message reading and storage management is achieved.

CN114860477BActive Publication Date: 2025-10-21JINGDONG TECH HLDG CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210460608.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-28
Publication Date
2025-10-21
Estimated Expiration
2042-04-28

AI Technical Summary

Technical Problem

In the prior art, the message storage and reading method results in an increase in the number of identifiers, occupies space, and reduces the efficiency of message reading.

Method used

It adopts a single-queue lock-free data structure, divides unread messages into unread areas through segmentation markers, sorts them in a preset order, divides read messages into read areas, and uses a preset distributed algorithm to disperse and store messages in various clusters, reducing data deletion and movement.

Benefits of technology

It improves message reading efficiency, avoids the increase in the number of identifiers, reduces data storage pressure, and optimizes message reading performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114860477B_ABST
    Figure CN114860477B_ABST
Patent Text Reader

Abstract

The application discloses a data processing method, system, storage medium and electronic equipment, and realizes the read state and unread state of a message through a single-queue non-locking data structure, so that the number of message identifiers is not increased, when a message in the unread state becomes a read message through a single-queue split identifier, only the original score value of the business notification message in the unread state is added with a negative sign, the business notification message in the read state is divided into the read message area of the split identifier, data deletion and movement are not needed, and the efficiency of reading a message is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and more specifically, to a data processing method, system, storage medium, and electronic device. Background Art

[0002] Currently, there are many ways to store messages, mainly to realize the functions of unread messages, read messages, latest messages, unread message counts, and message storage time.

[0003] The unread message and read message functions are generally implemented using two queues. The unread message count is implemented using an independent identifier for addition and subtraction. The latest message function uses the identifier to control the expiration of the message. The message storage time function is implemented using an independent cluster for storage.

[0004] In the existing technology, the storage and reading of messages have the following shortcomings. First, two queues are used to store read and unread messages, which will lead to an increase in the number of identifiers, increase the storage of the cluster, and occupy space. In addition, unread messages are converted into read messages, which requires data to be moved, increasing the pressure of message reading. Second, the unread number of messages uses an independent identifier, which also increases the number of identifiers. Third, to control the expiration of the identifier, it is necessary to add a time dimension to the identifier dimension. If it expires in 7 days, there will be 7 identifiers, which will also increase the number of identifiers and occupy space.

[0005] Therefore, the message reading method in the prior art reduces the message reading efficiency. Summary of the Invention

[0006] In view of this, the present application discloses a data processing method, system, storage medium and electronic device, aiming to improve the efficiency of message reading.

[0007] In order to achieve the above purpose, the disclosed technical solutions are as follows:

[0008] In a first aspect, the present application discloses a data processing method, the method comprising:

[0009] Obtain each service notification message; the service notification message is used to indicate the service type of notification message;

[0010] Storing each of the service notification messages in a single queue and determining a message status of each of the service notification messages; the message status includes at least a read status and an unread status;

[0011] When the message status is unread, each service notification message in the unread state is segmented into an unread message area using a segmentation identifier of a single queue, and each service notification message in the unread message area is sorted according to a first preset order; the first preset order is used to represent the time sequence of entering the unread message area;

[0012] When the message status changes from an unread status to a read status, the business notification messages in the read status are divided into the message read area through the segmentation identifier of the single queue, and the business notification messages in the message read area are sorted according to a second preset order; the second preset order is used to represent the time sequence of entering the message read area.

[0013] Preferably, it also includes:

[0014] The various service notification messages are dispersedly stored in various clusters through a preset distributed algorithm; the preset distributed algorithm is used to improve the access performance of the service data.

[0015] Preferably, the distributing and storing the service notification messages in respective corresponding clusters by using a preset distributed algorithm includes:

[0016] Obtaining each service identifier corresponding to each of the service notification messages;

[0017] Perform distributed processing on each of the service identifiers using a preset distributed algorithm to obtain a cluster index corresponding to each of the service identifiers;

[0018] Through the cluster index corresponding to each service identifier, the service notification message corresponding to each service identifier is dispersedly stored in the corresponding cluster.

[0019] Preferably, after distributing and storing the service notification message in each cluster by using a preset distributed algorithm, the method further includes:

[0020] The cluster addresses of the clusters are generated through the routing table.

[0021] Preferably, it also includes:

[0022] Counting the number of unread service notification messages using the preset value in the segmentation identifier;

[0023] The number of service notification messages in an unread state at the current moment is obtained through statistical results, and the number of service notification messages in an unread state at the current moment is determined to be the latest unread number of service notification messages.

[0024] Preferably, it also includes:

[0025] Monitoring the residence time of the service notification message in the read state in the single queue;

[0026] When the dwell time is greater than a preset time, the service notification message in the read state in the single queue is determined to be an expired message and is deleted.

[0027] A second aspect of the present application discloses a data processing system, the system comprising:

[0028] An acquiring unit, configured to acquire each service notification message; the service notification message is a notification message used to characterize a service type;

[0029] A determining unit, configured to store each of the service notification messages in a single queue and determine a message status of each of the service notification messages; the message status includes at least a read status and an unread status;

[0030] a first segmentation and sorting unit configured to, when the message status is unread, segment each service notification message in the unread state into an unread message area using a segmentation identifier of a single queue, and sort each service notification message in the unread message area according to a first preset order; the first preset order being used to represent a chronological order of entering the unread message area;

[0031] The second segmentation and sorting unit is used to segment the various business notification messages in the read state into the message read area through the segmentation identifier of the single queue when the message state changes from the unread state to the read state, and sort the various business notification messages in the message read area according to a second preset order; the second preset order is used to represent the time sequence of entering the message read area.

[0032] Preferably, it also includes:

[0033] The storage unit is used to disperse and store the various service notification messages in various clusters through a preset distributed algorithm; the preset distributed algorithm is used to improve the access performance of the service data.

[0034] A third aspect of the present application discloses a storage medium, which includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the data processing method as described in any one of the first aspects.

[0035] The fourth aspect of the present application discloses an electronic device comprising a memory and one or more instructions, wherein the one or more instructions are stored in the memory and configured to be executed by one or more processors to perform the data processing method as described in any one of the first aspects.

[0036] It can be seen from the above technical solution that the present application discloses a data processing method, system, storage medium and electronic device, which obtains each business notification message, which is used to represent the notification message of the business type, stores each business notification message in a single queue, and determines the message status of each business notification message. The message status includes at least a read status and an unread status. When the message status is unread, the business notification messages in the unread state are divided into a message unread area by the segmentation marker of the single queue, and the business notification messages in the message unread area are sorted by a first preset order. The first preset order is used to represent the time sequence of entering the message unread area. When the message status changes from the unread state to the read state, the business notification messages in the read state are divided into the message read area by the segmentation marker of the single queue, and the business notification messages in the message read area are sorted by a second preset order. The second preset order is used to represent the time sequence of entering the message read area. Based on the above solution, the read and unread states of messages are realized through a single-queue lock-free data structure, which will not increase the number of message identifiers. When an unread message is converted into a business notification message of a read message through the split identifier of a single queue, it is only necessary to add a negative sign to the score value of the original business notification message in the unread state, and the business notification message in the read state will be divided into the message read area of ​​the split identifier. There is no need to delete or move data, thereby improving the efficiency of reading messages. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without any creative work.

[0038] Figure 1 A flowchart of a data processing method disclosed in an embodiment of the present application;

[0039] Figure 2 This is a schematic diagram of the data structure of a single queue disclosed in an embodiment of the present application;

[0040] Figure 3 This is an architectural diagram of the cluster storage disclosed in the embodiments of this application;

[0041] Figure 4 This is a flow chart of distributing and storing each service notification message in its corresponding cluster using a preset distributed algorithm disclosed in an embodiment of the present application;

[0042] Figure 5This is a flow chart of the lock-free processing of each service notification message through a single queue disclosed in an embodiment of the present application;

[0043] Figure 6 A schematic diagram of the structure of a data processing system disclosed in an embodiment of the present application;

[0044] Figure 7 This is a schematic structural diagram of an electronic device disclosed in an embodiment of the present application. DETAILED DESCRIPTION

[0045] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0046] In this application, the terms "comprises," "comprising," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.

[0047] As can be seen from the background art, the message storage and reading methods in the prior art reduce the message storage performance and message reading efficiency.

[0048] In order to solve the above problems, the embodiments of the present application disclose a data processing method, system, storage medium and electronic device, which realize the read and unread status of messages through a single queue lock-free data structure, without increasing the number of message identifiers. When an unread message is converted into a business notification message of a read message through the split identifier of a single queue, it is only necessary to add a negative sign to the score value of the original business notification message in the unread state, and the business notification message in the read state will be divided into the message read area of ​​the split flag, without the need for data deletion and movement, thereby improving the efficiency of reading messages. The specific implementation method is specifically described through the following embodiments.

[0049] refer to Figure 1 FIG. 1 is a flow chart of a data processing method disclosed in an embodiment of the present application, and the data processing method mainly includes the following steps:

[0050] S101: Acquire various service notification messages; service notification messages are notification messages used to represent service types.

[0051] Among them, business types include loan business type, repayment business type, repayment plan generation business, etc.

[0052] This application does not specifically limit the message type of each service notification message.

[0053] S102: Store each service notification message in a single queue, and determine the message status of each service notification message; the message status includes at least a read status and an unread status.

[0054] In S102, each service notification message is processed without locks through a single queue, and operations such as read, unread, latest message statistics, unread message count, and expired message deletion are implemented for each service notification message. Specific lock-free processing is described in S103 and S104 below.

[0055] Message status includes read status, unread status, number of unread messages, expired message status, etc.

[0056] The single queue design uses the Redis zset structure and the sorting function of the single queue to store each business notification message. The Long timestamp is used as the sorting standard for the score value of the business notification message. The earlier the business notification message enters the single queue, the smaller the score value. By default, the business notification message with the smallest score value is placed at the end of the single queue.

[0057] S103: When the message status is unread, each service notification message in the unread state is divided into an unread message area through a split identifier of a single queue, and each service notification message in the unread message area is sorted according to a first preset order; the first preset order is used to represent the time sequence of entering the unread message area.

[0058] A separator element is inserted into the single queue. The separator element serves as a separation flag for read messages and unread messages, and the Score value of the separation flag is filled with a special value of 0.

[0059] The first preset order is the time sequence of entering the unread message area. The unread message that enters the unread message area earliest is placed at the bottom of the unread message area.

[0060] S104: When the message status changes from the unread status to the read status, the business notification messages in the read status are divided into the message read area through the segmentation identifier of the single queue, and the business notification messages in the message read area are sorted according to the second preset order; the second preset order is used to represent the time sequence of entering the message read area.

[0061] The second preset order is the time sequence of entering the message read area. The earliest read message entering the message read area is arranged at the bottom of the message read area.

[0062] With the split flag, when operating a business notification message in the unread state to become a read message, you only need to add a minus sign to the score value of the original unread business notification message. The business notification message in the read state will be divided into the message read area of ​​the split flag, eliminating the need for data deletion and movement, thereby improving efficiency.

[0063] For a specific single queue data structure diagram, please refer to Figure 2 shown.

[0064] Figure 2 In [1], the data structure of a single queue includes a read message area, a segmentation identifier, and an unread message area. Key: zset is a single queue with a zset structure. The read message area includes read messages (service notification messages in the read state), and the unread message area includes unread messages (service notification messages in the unread state).

[0065] The read messages in the message read area must be sorted according to a first preset order, that is, the read messages must be sorted in the order of time when they enter the read area.

[0066] The unread messages in the unread message area must be sorted according to a second preset order, that is, the unread messages are sorted in the order of time when they enter the unread area.

[0067] Among them, the read messages include 221132:-timestamp, 121133:-timestamp, 421135:-timestamp and 621134:-timestamp.

[0068] Unread messages include 021132: timestamp, 021133: mestamp, 021135: timestamp and 021134: timestamp; 021132: timestamp is the latest message 4, 021133: mestamp is the latest message 3, 021135: timestamp is the latest message 2, 021134: timestamp is the latest message 1.

[0069] When the residence time of the business notification message (621134:-timestamp) in the read state in the single queue is monitored, when the residence time is greater than the preset time, the business notification message in the read state in the single queue is determined to be an expired message and deleted.

[0070] Among them, the preset time can be 2 hours, or 1 day, etc. The specific preset time is determined by technical personnel according to actual conditions, and this application does not make any specific restrictions.

[0071] The message expiration is set on the key. A new message is written to update the expiration of the key. The specific message expiration is triggered by the insertion of a new message. The first expired message to be deleted is at the end of the message read area above the split identifier (the position of 621134-timestamp). The residence time of 621134-timestamp is judged to be expired by the preset time. When the residence time of 621134-timestamp is greater than the preset time, it is determined that 621134-timestamp has expired and is deleted.

[0072] When the latest message 1 (021134: timestamp) in the unread state is read, the latest message 1 (021134: timestamp) adds a minus sign to 021134: timestamp, that is, 021134: -timestamp, and 021134: -timestamp is divided into the message read area of ​​the split flag.

[0073] The above data processing method can meet the needs of message storage and reading in the financial app message center, as well as push offline message storage and other services.

[0074] Optionally, each business notification message is stored in each cluster in a dispersed manner through a preset distributed algorithm; the preset distributed algorithm is used to improve the access performance of business data.

[0075] Each business notification message is processed through a preset distributed algorithm to obtain the business identification key corresponding to each business notification message. Based on the business identification key (businesskey), each business notification message is dispersed and stored in its corresponding cluster, and the cluster address is returned through the routing table.

[0076] Because existing technologies use independent clusters to store business notification messages, high concurrency can lead to hotspot keys, which can put pressure on the cluster. Therefore, a pre-defined distributed algorithm is used to disperse the storage of business notification messages across clusters, reducing the pressure on the cluster.

[0077] The preset distributed algorithm can be MurmurHash algorithm, DJBHash algorithm, etc. The specific preset distributed algorithm is determined by technical personnel according to actual conditions and is not specifically limited in this application. The preset distributed algorithm of this application is preferably MurmurHash algorithm.

[0078] Specifically, the process of distributing and storing each business notification message to its corresponding cluster through a preset distributed algorithm can be combined with Figure 3 Provide explanation. Figure 3 This is an architectural diagram of cluster storage.

[0079] Figure 3 In the example, businesskey is the business identification key. Each business key is processed by the MurmurHash algorithm so that the business notification messages corresponding to each business identification key are dispersed and stored in each cluster.

[0080] The cluster includes ID, running instances, used memory, maximum memory, creation time, and memory usage.

[0081] Running indicates that the cluster is in running state.

[0082] In the Jrm_app_push_center_02 cluster, the cluster memory usage is 28.34, the cluster ID is 2582, the cluster running instances are 120 / 120, the cluster used memory is 141115MB, the cluster maximum memory is 498000MB, and the cluster creation time is 2021-01-22.

[0083] In the Jrm_app_push_center_01 cluster, the cluster memory usage is 28.33, the cluster ID is 2579, the cluster running instances are 120 / 120, the cluster used memory is 141102MB, the cluster maximum memory is 498000MB, and the cluster creation time is 2021-01-22.

[0084] In the Jrm_app_push_center_03 cluster, the cluster memory usage is 28.2, the cluster ID is 2578, the cluster running instances are 120 / 120, the cluster used memory is 141104MB, the cluster maximum memory is 500400MB, and the cluster creation time is 2021-01-22.

[0085] In the Jrm_app_push_center_04 cluster, the cluster memory usage is 27.94, the cluster ID is 2580, the cluster running instances are 120 / 120, the cluster used memory is 139710 MB, the cluster maximum memory is 499980 MB, and the cluster creation time is 2021-01-22.

[0086] In the Jrm_app_push_center_05 cluster, the cluster memory usage is 27.99, the cluster ID is 2583, the cluster running instances are 120 / 120, the cluster used memory is 139389MB, the cluster maximum memory is 498000MB, and the cluster creation time is 2021-01-22.

[0087] Among them, the business notification messages corresponding to each businesskey are dispersedly stored in each cluster, thereby ensuring a balanced cluster storage rate for business notification messages and avoiding the occurrence of excessively high or low cluster memory usage.

[0088] The specific process of distributing and storing each business notification message in its corresponding cluster through a preset distributed algorithm is as follows:

[0089] First, obtain each service identification key corresponding to each service notification message.

[0090] The business key is constructed by combining the hash value of the user ID and the business number. The business key includes the user's personal information, etc.

[0091] Then, each business identification key is processed in a distributed manner using a preset distributed algorithm to obtain a cluster index corresponding to each business identification key.

[0092] Among them, each business identification key is distributedly processed through the MurmurHash algorithm to obtain the cluster index corresponding to each business identification key.

[0093] Finally, through the cluster index corresponding to each business identification key, the business notification message corresponding to each business key is dispersed and stored in each cluster.

[0094] In an embodiment of the present application, the read and unread states of messages are realized through a single-queue lock-free data structure, which will not increase the number of message identifiers. When an unread message is converted into a business notification message of a read message through a split identifier of a single queue, it is only necessary to add a negative sign to the score value of the original business notification message in the unread state, and the business notification message in the read state will be divided into the message read area of ​​the split identifier, without the need for data deletion and movement, thereby improving the efficiency of reading messages.

[0095] Optionally, the number of business notification messages in the unread state is counted using the preset value in the segmentation identifier, the number of business notification messages in the unread state at the current moment is obtained through the statistical results, and the number of business notification messages in the unread state at the current moment is determined to be the latest unread number of business notification messages.

[0096] Among them, the statistics of the number of business notification messages in the unread state at the current moment can accurately and effectively obtain the latest message unread count by using the Score special value 0 of the segmentation identifier.

[0097] In an embodiment of the present application, the number of business notification messages in an unread state is counted by using the preset value in the segmentation identifier, and the number of business notification messages in an unread state at the current moment is obtained through the statistical results, and the number of business notification messages in an unread state at the current moment is determined to be the latest unread number of business notification messages, thereby achieving the purpose of effectively obtaining the latest number of unread messages.

[0098] Optionally, the residence time of the service notification message in the read state in the single queue is monitored, and when the residence time is greater than a preset time, the service notification message in the read state in the single queue is determined to be an expired message and is deleted.

[0099] Among them, the expiration time is dynamically adjusted, and the expiration timestamp is used to determine whether it is expired. When inserting a message into a single queue, the bottom message among the read messages is detected. When the timestamp of the bottom message staying in the queue is equal to the expiration timestamp, the message is deleted.

[0100] The preset time is determined by technical personnel based on actual conditions and is not specifically limited in this application.

[0101] In an embodiment of the present application, the residence time of the service notification message in the read state in the single queue is monitored. When the residence time is greater than the preset time, the purpose of determining that the service notification message in the read state in the single queue is an expired message and deleting it is achieved.

[0102] refer to Figure 4 As shown, the process of distributing and storing each service notification message in each corresponding cluster by using a preset distributed algorithm involved in the above S102 mainly includes the following steps:

[0103] S401: Acquire each service identifier corresponding to each service notification message.

[0104] S402: Perform distributed processing on each service identifier using a preset distributed algorithm to obtain a cluster index corresponding to each service identifier.

[0105] S403: The service notification messages corresponding to the service identifiers are dispersedly stored in the corresponding clusters through the cluster indexes corresponding to the service identifiers.

[0106] The execution principle of S401-S403 is consistent with the execution principle of the above-mentioned process of distributing and storing each business notification message in its corresponding cluster through a preset distributed algorithm, which can be used as a reference and will not be repeated here.

[0107] In an embodiment of the present application, each business key corresponding to each business notification message is obtained, and each business key is distributedly processed through a preset distributed algorithm to obtain a cluster index corresponding to each business key, so that the business notification message corresponding to each business key is dispersedly stored in each cluster, thereby ensuring the balance of the cluster storage rate of the business notification message and avoiding the occurrence of excessively high or low memory usage of the cluster.

[0108] refer to Figure 5 As shown, the process of performing lock-free processing on each service notification message through a single queue involved in the above S102 and S103 mainly includes the following steps:

[0109] S501: Store the business notification messages in each cluster into a single queue and determine the message status of the business notification messages in each cluster. When the message status is unread, execute S502; when the message status changes from unread to read, execute S503.

[0110] S502: Segment each unread service notification message into an unread message area using a segmentation identifier of a single queue, and sort each service notification message in the unread message area according to a first preset order.

[0111] S503: Segment each service notification message in the read state into a message read area using the segmentation identifier of the single queue, and sort each service notification message in the message read area according to a second preset order.

[0112] The execution principle of S501-S503 is consistent with the execution principle of lock-free processing of each business notification message through a single queue involved in the above S102 and S103, which can be used as a reference and will not be repeated here.

[0113] In an embodiment of the present application, the business notification messages in each cluster are stored in a single queue, and the message status of the business notification messages in each cluster is determined. The segmentation identifier of the single queue is used to segment each business notification message into an area corresponding to the message status and sort them.

[0114] Based on the above embodiment Figure 1A data processing method is disclosed, and an embodiment of the present invention also discloses a data processing system. Figure 6 As shown, the data processing system mainly includes an acquisition unit 601 , a determination unit 602 , a first segmentation and sorting unit 603 and a second segmentation and sorting unit 604 .

[0115] The acquiring unit 601 is configured to acquire various service notification messages; the service notification message is a notification message used to represent a service type.

[0116] The determining unit 602 is configured to store each service notification message in a single queue and determine a message status of each service notification message; the message status includes at least a read status and an unread status.

[0117] The first segmentation and sorting unit 603 is used to segment the unread business notification messages into the unread message area through the segmentation identifier of a single queue when the message status is unread, and sort the business notification messages in the unread message area according to the first preset order; the first preset order is used to represent the time sequence of entering the unread message area.

[0118] The second segmentation and sorting unit 604 is used to segment each business notification message in the read state into the message read area through the segmentation identifier of the single queue when the message status changes from the unread state to the read state, and sort the each business notification message in the message read area according to the second preset order; the second preset order is used to represent the time sequence of entering the message read area.

[0119] Furthermore, a storage unit is also included.

[0120] The storage unit is used to disperse and store each business notification message in each cluster through a preset distributed algorithm; the preset distributed algorithm is used to improve the access performance of business data.

[0121] Furthermore, the storage unit includes an acquisition module, a processing module and a storage module.

[0122] The acquisition module is used to obtain each business identifier corresponding to each business notification message.

[0123] The processing module is used to perform distributed processing on each service identifier through a preset distributed algorithm to obtain a cluster index corresponding to each service identifier.

[0124] The storage module is used to disperse and store the service notification messages corresponding to the various service identifiers into the corresponding clusters through the cluster index corresponding to the various service identifiers.

[0125] Furthermore, the data processing system also includes a generating unit.

[0126] The generation unit is configured to generate a cluster address of each cluster through a routing table.

[0127] Furthermore, the data processing system further includes a statistical unit and a first determining unit.

[0128] The counting unit is used to count the number of unread service notification messages according to the preset value in the segmentation identifier.

[0129] The first determining unit is configured to obtain the number of unread service notification messages at the current moment through statistical results, and determine the number of unread service notification messages at the current moment as the latest unread number of service notification messages.

[0130] Furthermore, the data processing system further includes a monitoring unit and a second determining unit.

[0131] The monitoring unit is used to monitor the residence time of the business notification message in the read state in the single queue.

[0132] The second determining unit is configured to determine that the service notification message in the read state in the single queue is an expired message and delete it when the residence time is greater than a preset time.

[0133] In an embodiment of the present application, the read and unread states of messages are realized through a single-queue lock-free data structure, which will not increase the number of message identifiers. When an unread message is converted into a business notification message of a read message through a split identifier of a single queue, it is only necessary to add a negative sign to the score value of the original business notification message in the unread state, and the business notification message in the read state will be divided into the message read area of ​​the split identifier, without the need for data deletion and movement, thereby improving the efficiency of reading messages.

[0134] An embodiment of the present application further provides a storage medium, which includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the above-mentioned data processing method.

[0135] The present application also provides an electronic device, the structure of which is shown in FIG. Figure 7 As shown, it specifically includes a memory 701 and one or more instructions 702, wherein the one or more instructions 702 are stored in the memory 701 and are configured to be executed by one or more processors 703 to perform the above-mentioned data processing method.

[0136] The specific implementation processes and derivative methods of the above embodiments are all within the protection scope of this application.

[0137] Each embodiment in this specification is described in a progressive manner. The same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple. For relevant parts, refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without expending creative work.

[0138] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0139] The above description of the disclosed embodiments will enable one skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.

[0140] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A data processing method, characterized in that: The method comprises: Obtain each service notification message; the service notification message is used to indicate the service type of notification message; Storing each of the service notification messages in a single queue and determining a message status of each of the service notification messages; the message status includes at least a read status and an unread status; When the message status is unread, each service notification message in the unread state is segmented into an unread message area using a segmentation identifier of a single queue, and each service notification message in the unread message area is sorted according to a first preset order; the first preset order is used to represent the time sequence of entering the unread message area; When the message status changes from an unread state to a read state, each service notification message in the read state is segmented into a message read area using the segmentation identifier of the single queue, and each service notification message in the message read area is sorted according to a second preset order; the second preset order is used to represent the time sequence of entering the message read area; When the message status changes from the unread status to the read status, segmenting each service notification message in the read status into a message read area using the segmentation identifier of the single queue includes: When the message status is unread, a separator element is inserted into the single queue. The separator element serves as a separation flag for read messages and unread messages, and the Score value of the separation flag is filled with a special value of 0. When operating a service notification message in an unread state to be a read message, a minus sign is added to the Score value of the unread service notification message so that the service notification message in a read state is divided into the message read area of ​​the split flag.

2. The method according to claim 1, characterized in that Also includes: Distributed storage of each service notification message in each cluster through a preset distributed algorithm; The preset distributed algorithm is used to improve the access performance of business data.

3. The method according to claim 2, characterized in that The distributing and storing the service notification messages in respective corresponding clusters by using a preset distributed algorithm includes: Obtaining each service identifier corresponding to each of the service notification messages; Perform distributed processing on each of the service identifiers using a preset distributed algorithm to obtain a cluster index corresponding to each of the service identifiers; Through the cluster index corresponding to each service identifier, the service notification message corresponding to each service identifier is dispersedly stored in the corresponding cluster.

4. The method according to claim 2, characterized in that After distributing and storing the service notification message in each cluster using a preset distributed algorithm, the method further includes: The cluster addresses of the clusters are generated through the routing table.

5. The method according to claim 1, wherein Also includes: Counting the number of unread service notification messages using the preset value in the segmentation identifier; The number of service notification messages in an unread state at the current moment is obtained through statistical results, and the number of service notification messages in an unread state at the current moment is determined to be the latest unread number of service notification messages.

6. The method according to claim 1, characterized in that Also includes: Monitoring the residence time of the service notification message in the read state in the single queue; When the dwell time is greater than a preset time, the service notification message in the read state in the single queue is determined to be an expired message and is deleted.

7. A data processing system, characterized in that: The system comprises: An acquiring unit, configured to acquire each service notification message; the service notification message is a notification message used to characterize a service type; A determining unit, configured to store each of the service notification messages in a single queue and determine a message status of each of the service notification messages; the message status includes at least a read status and an unread status; a first segmentation and sorting unit configured to, when the message status is unread, segment each service notification message in the unread state into an unread message area using a segmentation identifier of a single queue, and sort each service notification message in the unread message area according to a first preset order; the first preset order being used to represent a chronological order of entering the unread message area; a second segmentation and sorting unit configured to, when the message status changes from an unread state to a read state, segment each service notification message in the read state into a message read area using the segmentation identifier of the single queue, and sort each service notification message in the message read area according to a second preset order; the second preset order being used to represent a chronological order of entering the message read area; When the message status changes from the unread status to the read status, the second segmentation and sorting unit segments each service notification message in the read status into the message read area using the segmentation identifier of the single queue, specifically for: When the message status is unread, a partition element is inserted into the single queue. The partition element serves as a separation flag for read messages and unread messages, and the Score value of the separation flag is filled with a special value of 0. When the business notification message in the unread state is changed to a read message, a negative sign is added to the Score value of the business notification message in the unread state so that the business notification message in the read state is divided into the message read area of ​​the separation flag.

8. The system according to claim 7, characterized in that Also includes: A storage unit, configured to disperse and store the service notification messages in each cluster using a preset distributed algorithm; The preset distributed algorithm is used to improve the access performance of business data.

9. A storage medium, characterized in that: The storage medium includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the data processing method according to any one of claims 1 to 6.

10. An electronic device, characterized in that: The device comprises a memory and one or more instructions, wherein the one or more instructions are stored in the memory and configured to cause one or more processors to execute the data processing method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Message processing method and device

    CN111510469A

  • Message processing method and device, electronic equipment and readable storage medium

    CN114221922A