Data processing method and device

By adding identification to the received data on the business server side and writing it into the database, the problem of loss and confusion caused by the downstream nodes receiving data from multiple upstream nodes in the online business is solved, the continuity and durability of the data are achieved, and the efficiency is improved Disaster recovery efficiency.

CN113407491BActive Publication Date: 2024-10-29BEIJING YUANLI WEILAI SCI & TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202110650874.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-10
Publication Date
2024-10-29
Estimated Expiration
2041-06-10

AI Technical Summary

Technical Problem

In online services, when downstream nodes receive data returned by multiple upstream nodes, data loss and confusion are easily caused, affecting the normal operation of the business.

Method used

After the business server receives the business data collection submitted by the data processing end, it adds a data identifier and writes it to the business database. It reads and writes the data to the distributed system one after another based on the processing instructions and data identifiers to ensure the continuity and persistence of the data. .

Benefits of technology

By adding data identification, data loss and confusion are avoided, the disaster recovery efficiency between the business server and the data processing end is improved, and the orderliness and durability of the data are ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113407491B_ABST
    Figure CN113407491B_ABST
Patent Text Reader

Abstract

The present specification provides a data processing method and device, wherein the data processing method includes: receiving a business data set submitted by a data processing terminal associated with a target business; adding a data identifier for each business data in the business data set, and writing the business data with the data identifier into a business database of the target business; receiving a processing instruction submitted for the business data in the business database; reading the target business data in the business database based on the processing instruction and the data identifier, and writing the target business data into a distributed system corresponding to the target business.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and more particularly to a data processing method and device. Background Art

[0002] With the development of Internet technology, online business has become the main target of most business parties; and due to the characteristics of online business, it is usually completed by the cooperation of multiple data processing nodes, such as data collection nodes, data processing nodes and data storage nodes, which are configured to support the operation of storage business and provide corresponding storage services to users. The data transmitted between each node is the basis for supporting business operation; usually, data collection and processing are in line with the business, and after obtaining the data sent by the upstream, the node needs to process the received data to complete the preset processing task and then send it to the downstream node for processing; and due to the complexity of the business, a downstream node may connect to multiple upstream nodes, which causes the downstream node to receive data sent back by multiple upstream nodes at the same time. With the increase of data, it is easy to cause data loss / confusion, which in turn affects the normal operation of the business. Therefore, an effective method is urgently needed to solve the above problems. Summary of the invention

[0003] In view of this, the embodiments of this specification provide a data processing method. This specification also relates to a data processing device, a computing device, and a computer-readable storage medium to solve the technical defects existing in the prior art.

[0004] According to a first aspect of an embodiment of this specification, a data processing method is provided, which is applied to a business service end, including:

[0005] Receive a business data set submitted by a data processing terminal associated with the target business;

[0006] Adding a data identifier to each business data in the business data set, and writing the business data with the data identifier added into the business database of the target business;

[0007] Receiving a processing instruction submitted for the business data in the business database;

[0008] The target business data is read from the business database based on the processing instruction and the data identifier, and the target business data is written into a distributed system corresponding to the target business.

[0009] Optionally, the adding a data identifier to each business data in the business data set includes:

[0010] Extracting each business data contained in the business data set, and determining the time information corresponding to each business data;

[0011] Adding the data identifier to each business data included in the business data set according to the time information;

[0012] Correspondingly, writing the business data with the data identifier added into the business database of the target business includes:

[0013] The business data with the data identifier added thereto is sequentially written into the business database according to the data identifier, wherein the data identifier increases monotonically.

[0014] Optionally, the reading target business data in the business database based on the processing instruction and the data identifier includes:

[0015] querying metadata of the business database according to the processing instruction to obtain the data identifier;

[0016] Reading the target business data in the business database according to the data identifier;

[0017] Accordingly, writing the target service data into the distributed system corresponding to the target service includes:

[0018] The target business data are written into the distributed system in sequence according to the data identifier, wherein the data identifier increases monotonically.

[0019] Optionally, the adding a data identifier to each business data in the business data set includes:

[0020] Obtain the Snowflake algorithm preset for the target business;

[0021] The data identifier is added to each business data in the business data set based on the Snowflake algorithm.

[0022] Optionally, the receiving of the business data set submitted by the data processing terminal associated with the target business includes:

[0023] Determine the data processing end having a data transmission relationship with the business service end according to the business information of the target business;

[0024] A data processing package is sent to the data processing end, and the business data set returned by the data processing end in response to the data processing package is received.

[0025] Optionally, before the step of sending the data processing package to the data processing end is executed, the method further includes:

[0026] Receiving a business processing request submitted for the target business, and creating a data processing task according to the business processing request;

[0027] The structured information is constructed according to the data processing task, and the data processing package corresponding to the structured information is generated through the business code.

[0028] Optionally, writing the business data with the data identifier added into a business database of the target business includes:

[0029] Determine a storage space threshold corresponding to the business database, and judge whether the storage space of the business database at the current time node is greater than the storage space threshold;

[0030] If so, extract the data to be deleted that has been stored for the longest time in the business database, and release the storage space of the business database based on the data to be deleted;

[0031] When the storage space of the business database is released completely, the business data with the data identifier added is written into the business database.

[0032] Optionally, writing the business data with the data identifier added into a business database of the target business includes:

[0033] Convert the business data with the data identifier added to obtain binary data;

[0034] The binary data are sequentially written into the business database according to the data identifiers, wherein the data identifiers are monotonically increasing.

[0035] According to a second aspect of an embodiment of this specification, a data processing device is provided, which is applied to a business service end, including:

[0036] A receiving set module is configured to receive a business data set submitted by a data processing terminal associated with a target business;

[0037] An identification adding module is configured to add a data identification to each business data in the business data set, and write the business data with the data identification added into the business database of the target business;

[0038] An instruction receiving module is configured to receive a processing instruction submitted for the business data in the business database;

[0039] The data reading module is configured to read the target business data in the business database based on the processing instruction and the data identifier, and write the target business data into the distributed system corresponding to the target business.

[0040] According to a third aspect of an embodiment of this specification, a computing device is provided, including:

[0041] Memory and processor;

[0042] The memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions:

[0043] Receive a business data set submitted by a data processing terminal associated with the target business;

[0044] Adding a data identifier to each business data in the business data set, and writing the business data with the data identifier added into the business database of the target business;

[0045] Receiving a processing instruction submitted for the business data in the business database;

[0046] The target business data is read from the business database based on the processing instruction and the data identifier, and the target business data is written into a distributed system corresponding to the target business.

[0047] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the steps of the data processing method are implemented.

[0048] The data processing method provided in this specification is applied to a business service end. When the business service end receives a business data set returned by the data processing end, a data identifier can be added to each business data in the business set, so that each business data is continuous and unique. Then, in order to prevent data loss, the business data with the data identifier can be written into the business database. When a processing instruction for a physical examination of the business data in the business database is received, target business data can be read from the business database one by one based on the processing instruction and the data identifier, and then the read target business data can be written into the distributed system, thereby avoiding data confusion by adding data identifiers. At the same time, in order to prevent data loss, the business data with the identifier can be written into the business database, so that the data can be persistent, so as to avoid the problem of data loss affecting the target business, thereby further improving the disaster recovery efficiency between the business service end and the data processing end. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 is a flow chart of a data processing method provided by an embodiment of this specification;

[0050] Figure 2It is a processing flow chart of a data processing method applied to a log collection scenario provided in an embodiment of this specification;

[0051] Figure 3 It is a structural schematic diagram of a data processing device provided in an embodiment of this specification;

[0052] Figure 4 It is a structural block diagram of a computing device provided in one embodiment of this specification. DETAILED DESCRIPTION

[0053] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.

[0054] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.

[0055] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0056] First, the terms involved in one or more embodiments of this specification are explained.

[0057] Log: Network devices, systems and service programs will generate an event record called log when they are operating; each line records the date, time, user, action and other related operation descriptions, which will constitute the log.

[0058] SDK: (Software Development Kit) is a collection of development tools that software engineers use to build application software for a specific software package, software framework, hardware platform, operating system, etc. It can simply provide some files of application program interface API for a certain programming language, but it may also include complex hardware that can communicate with some embedded system.

[0059] Thread: (thread) is the smallest unit that the operating system can schedule operations. It is contained in the process and is the actual operation unit in the process. A thread refers to a single sequential control flow in the process. A process can have multiple threads running concurrently, and each thread executes different tasks in parallel.

[0060] DB: (Data Base) is a data set organized according to a certain data model and stored in a secondary storage. This data set has the following characteristics: it has no duplication as much as possible, serves multiple applications of a specific organization in the best way, its data structure is independent of the application program that uses it, and the addition, deletion, modification and retrieval of data are managed and controlled by unified software.

[0061] HTTP: (Hypertext Transfer Protocol) is a simple request-response protocol that usually runs on top of TCP. It specifies what messages a client may send to a server and what responses it may get. The headers of request and response messages are given in ASCII form; the message content has a MIME-like format.

[0062] Data disaster recovery: refers to the establishment of a remote data system, which is a usable copy of local key application data. When a disaster occurs to the local data and the entire application system, the system will at least save a copy of the key business data in a remote location. The data can be a complete real-time copy of the local production data, or it can be slightly behind the local data, but it must be usable. The main technologies used are data backup and data replication technology.

[0063] In this specification, a data processing method is provided. This specification also relates to a data processing apparatus, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.

[0064] In actual applications, the operation of the business is usually completed by the cooperation of multiple data processing nodes. After the upstream node completes the data processing, it will send the processed data to the downstream node, which will continue to process it. However, due to the high complexity of the business, most downstream nodes will connect to one or more upstream nodes. This means that after the downstream node receives the data sent by the upstream node, if it cannot process it as soon as possible, it needs to temporarily store the data locally so that it can be processed again when computing resources can be called; and in this process, as the data increases, it will not only cause data confusion, but also may cause storage failures and cause data loss, making it impossible to guarantee the orderliness of the data when the downstream node sends data again. Therefore, an effective solution is urgently needed to solve the above problems.

[0065] The data processing method provided in this specification is applied to a business service end. When the business service end receives a business data set returned by the data processing end, a data identifier can be added to each business data in the business set, so that each business data is continuous and unique. Then, in order to prevent data loss, the business data with the data identifier can be written into the business database. When a processing instruction for a physical examination of the business data in the business database is received, target business data can be read from the business database one by one based on the processing instruction and the data identifier, and then the read target business data can be written into the distributed system, thereby avoiding data confusion by adding data identifiers. At the same time, in order to prevent data loss, the business data with the identifier can be written into the business database, so that the data can be persistent, so as to avoid the problem of data loss affecting the target business, thereby further improving the disaster recovery efficiency between the business service end and the data processing end.

[0066] Figure 1 A flowchart of a data processing method provided according to an embodiment of the present specification is shown, which is applied to a business service end and specifically includes the following steps:

[0067] Step S102: receiving a business data set submitted by a data processing terminal associated with a target business.

[0068] Specifically, the business service end specifically refers to the end that needs to summarize and analyze data, which belongs to the downstream data processing node of the data processing end; when the business service end receives the business data returned by the data processing end, it will audit or analyze based on the business data to respond to the target business task; correspondingly, the data processing end specifically refers to the end that can perform data collection and preprocessing, which belongs to the upstream data processing node of the business service end; that is, after the data processing end collects and processes the data, it will send the processed data to the business service end, and the business service end will further process and operate the data.

[0069] Based on this, the target business specifically refers to the business services provided to the business participants. For example, if you watch a video and participate in a lucky draw, the target business can be this lucky draw, and the business participants are users who watch videos and participate in the lucky draw; or if the business party provides multimedia resources for users to browse, the target business can be a multimedia resource browsing service, and the business participants are viewers who browse multimedia resources; or if the business party provides rental resources for enterprises or users to use, the target business can be a rental business, and the business participants are enterprises or users who rent resources. In actual applications, the target business is the business service provided by the business direction to users / enterprises, etc. The specific business service content of the target business can be set according to the actual application scenario, and this embodiment does not make any restrictions here.

[0070] In specific implementation, after the data processing end completes data collection and preprocessing, it will return the business data to the business service end. After receiving the business data set composed of the business data, the business service end will usually write each business data contained in the business data set in sequence to the distributed system corresponding to the target business to complete subsequent processing tasks. However, in this process, in order to avoid data loss and data confusion, each business data can be processed by adding data identifiers and written to the business database for persistence, thereby avoiding data loss while providing data security and orderliness.

[0071] Prior to this, it is actually necessary to send a data collection request to the data processing end. That is to say, the business data set received by the business service end is obtained by the data processing end in response to the data collection request sent in advance. In this embodiment, the specific implementation method is as follows:

[0072] Determine the data processing end having a data transmission relationship with the business service end according to the business information of the target business;

[0073] A data processing package is sent to the data processing end, and the business data set returned by the data processing end in response to the data processing package is received.

[0074] Specifically, the business information specifically refers to information related to the target business. Through the business information, the data processing end that has a transmission relationship with the business service end can be determined, and information such as the type of data transmitted between the data processing end and the business service end can be determined; correspondingly, the data processing package specifically refers to a program package that standardizes data collection and processing by the data processing end. Through the data processing package, the data type, field value, etc. required by the business service end can be determined, so that the data processing end can perform data processing operations based on the data processing package, thereby avoiding returning redundant data and causing consumption of computing resources on the business service end; the business data set specifically refers to a set composed of integrated business data returned by the data processing end, and the business data contained therein is the data required to be used by the business service end.

[0075] Based on this, in order to ensure that the business data received by the business service end is the data required for subsequent processing, the data processing end that has a data transmission relationship with the business server can be determined based on the business information of the target business, and the data processing end is an end that can perform data collection and preprocessing, which can meet the needs of the business service end for subsequent processing operations; after determining the data processing end, the data processing package can be sent to the data processing end according to the business information, so that the data processing end can collect and preprocess the business data based on the data processing package, so that the business data received by the business service end can be used directly, that is, finally the business data set returned by the data processing end for the data processing package will be received.

[0076] In actual applications, in order to ensure that the business data received by the business service end can be directly used for subsequent processing operations, the data collection and processing of the data processing end can be standardized by sending the data processing package. Before sending the data processing package, it is necessary to create a data processing package according to the specification requirements. In this embodiment, the specific implementation method is as follows:

[0077] Receiving a business processing request submitted for the target business, and creating a data processing task according to the business processing request;

[0078] The structured information is constructed according to the data processing task, and the data processing package corresponding to the structured information is generated through the business code.

[0079] Specifically, the business processing request specifically refers to a request to create a data processing task, and the business data required by the business service end can be determined through the data processing request. The data processing task specifically refers to a task to obtain data. The business service end can request the data processing end to collect data and transmit it back through the data processing task, so as to use the transmitted data to complete the data processing task. Correspondingly, the structured information specifically refers to the data processing package containing corresponding information on data collection and data processing. The data collected by the data processing end can be processed through the structured information to sort out the data required by the business service end; that is, the business data contained in the business data set is the data obtained after being sorted according to the structured information, which can be directly transmitted back to the business service end for processing, so as to save the computing resources of the business service end. The business code specifically refers to the underlying code for generating the data processing package, so that the data processing end can complete the data collection and processing and transmit it back from the code level.

[0080] Based on this, when a business processing request submitted for the target business is received, it can be determined that it is necessary to cooperate with the data processing end to complete data collection and processing. In order to improve the data processing efficiency between the business service end and the data processing end, the business service end can create the data processing task based on the business processing request, and construct the structured information according to the data processing task, so as to preliminarily determine the data content described by the business service end, and finally generate the data processing package corresponding to the structured information in combination with the business code, so as to achieve the purpose of encapsulating the required information, so that the data processing end can respond quickly and return the business data.

[0081] Furthermore, the structured information constructed according to the data processing task actually collects and processes data on the data processing end according to the data information, field information and type information specifications. That is to say, the data processing end will collect and process data according to the data information, field information and type information required by the business service end, so that the business data contained in the business data set returned by the data processing end are all data that can be directly used by the business service end, so as to improve data processing efficiency.

[0082] Among them, the data information specifically refers to the information corresponding to the data required by the business service end, the field information specifically refers to the information on the number of fields and the meaning of each field in the data required by the business service end; the type information specifically refers to the type information corresponding to the data required by the business service end, and the type information corresponding to the fields contained in the data.

[0083] In specific implementation, the data processing end, in the process of processing the collected data in combination with the data information, the field information and the type information, actually normalizes the data, which can be understood as removing redundant data in the data, standardizing data types, setting field values, determining field meanings, etc., so that the generated business data is the data needed by the business service end, saving the computing resources of the business service end and improving processing efficiency.

[0084] For example, when the log audit node receives a business processing request submitted by the operation and maintenance personnel, it can determine the data information, field information and type information according to the business processing request, and create a log audit task by combining the above three types of information. At this time, in order to improve the efficiency of log auditing, log processing structured information can be constructed according to the log audit task, and then the log processing package SDK_log corresponding to the log processing structured information can be created in combination with the business code of the target business, and sent to the log collection node.

[0085] After receiving the log processing package SDK_log, the log collection node parses the log processing package SDK_log to obtain the log processing structured information, and determines that the user behavior log needs to be collected according to the log processing structured information. The time is between T0 and T1, which needs to contain S fields, namely field_1, field_2...field_s; field_1 represents the user name, field_2 represents the user ID...field_s represents the time when the user participates in the business; at this time, the log collection node will collect all the user behavior logs, database logs and business logs associated with the target business, and then process the collected logs according to the structured information; that is, the log collection node first selects the user behavior logs from the fully collected logs, and then selects the user behavior logs in the interval between T0 and T1, and again selects according to the fields field_1, field_2...field_s, and finally obtains the target user behavior logs required by the log audit node according to the screening results; finally, the target user behavior logs are sent back to the log review node, and the node performs the log audit operation.

[0086] To sum up, by standardizing the structure of the data returned by the data processing end, it is ensured that the business data in the business data set received by the business server are the data required by the business server, thereby further saving the business server the operation of processing the returned business data and effectively improving the data processing efficiency.

[0087] Step S104: adding a data identifier to each business data in the business data set, and writing the business data with the data identifier added into the business database of the target business.

[0088] Specifically, on the basis of the business data set submitted by the data processing end, in order to ensure that data is not lost and to avoid data confusion on the basis of persistence, the data identifier can be added to each business data contained in the business data set so that each business data has a unique identifier, and the business data with the added data identifier is written into the business database of the target business to achieve the purpose of persistence.

[0089] Among them, the data identifier specifically refers to the key corresponding to each business data, and accordingly, the business database specifically refers to the database storing business data to avoid data loss due to equipment failure before uploading to the distributed system; the business database can use a RocksDB database or other types of databases, and this embodiment does not make any limitations here.

[0090] It should be noted that since the business data set contains a large amount of business data, and each piece of business data will subsequently require the distributed system corresponding to the target business, if the distributed system is not written in the order in which the business server receives each piece of data, the distributed system may be unable to perform data processing operations normally, thereby failing to complete the data processing task. Therefore, when adding the data identifier, it can be added in the order in which the business server receives each piece of data in the business data set, and the data identifier is monotonically increasing, so as to facilitate the subsequent operation of writing data into the distributed system according to the data identifier.

[0091] Based on this, after receiving the business data set, the data identifier can be added to each business data in the business data set so that each data that needs to be persisted becomes ordered and convenient for subsequent writing to the distributed system in sequence. After adding the data identifier to each data, the business data with the data identifier added can be written into the business database corresponding to the target business, thereby avoiding data loss.

[0092] In actual applications, when adding a data identifier for each piece of data, it is necessary to follow the first-come-first-added method, and the data identifier corresponding to the later business data must be larger than the data identifier corresponding to the earlier business data, but it may not be continuous; for example, business data 1, business data 2, and business data 3 are respectively transmitted to the business server, and the business server first receives business data 1, then business data 2, and finally business data 3, then data identifier ID_1 can be added to business data 1, data identifier ID_2 can be added to business data 2, and data identifier ID_3 can be added to business data 3, where ID_1>ID_2>ID_3, but ID_1, ID_2, and ID_3 may not be continuous, such as the value corresponding to ID_1 is 1, the value corresponding to ID_2 can be 5, and the value corresponding to ID_3 can be 6, so as to save the calculation cost of maintaining the continuity of data identifiers.

[0093] Furthermore, in order to ensure that the data can be written into the distributed system in an orderly manner and in a first-in-first-out manner, the data identifier can be added according to the time information. In this embodiment, the specific implementation method is as follows:

[0094] Extracting each business data contained in the business data set, and determining the time information corresponding to each business data;

[0095] Adding the data identifier to each business data included in the business data set according to the time information;

[0096] The business data with the data identifier added thereto is sequentially written into the business database according to the data identifier, wherein the data identifier increases monotonically.

[0097] Specifically, the time information specifically refers to the time corresponding to each business data received by the business service end. It should be noted that each business data has a unique time, and the time level can be microsecond level, millisecond level or second level. In actual applications, the determination of the time information can be set according to the actual application scenario, and this embodiment does not make any limitations here.

[0098] Based on this, when it is determined that each business data contained in the received business data set needs to be written to the business database, first extract each business data from the business data set, and determine the time information corresponding to each business data. After determining the time information, the order in which the business server receives the various business data can be determined, and then add data identifiers to each business data according to the time sequence. In this way, the reception time of the business data can be determined by distinguishing the data identifiers, which is convenient for subsequent sequential writing to the distributed system; after the data identifier is added to each piece of business data, the business data with the added data identifier can be written into the business database in sequence according to the data identifier, so that the business data can be persisted to avoid data loss in the event of equipment failure on the business server.

[0099] Furthermore, since the data identifier is unique and monotonically increasing, in order to be able to distinguish each piece of business data, this embodiment will use the Snowflake algorithm to complete the generation and addition of the data identifier, and the specific implementation method is as follows:

[0100] Obtain the Snowflake algorithm preset for the target business;

[0101] The data identifier is added to each business data in the business data set based on the Snowflake algorithm.

[0102] Specifically, the Snowflake algorithm is a GUID (Globally Unique Identifier) ​​generation algorithm. The task of generating data identifiers can be completed through an int64_t. After extracting each business data contained in the business data set, the Snowflake algorithm is used to create and add data identifiers for each business data in the business data set, so as to achieve the purpose of assigning a key to each business data, facilitate subsequent data storage and distributed system write operations, and avoid the problem of being unable to execute processing due to data confusion.

[0103] Using the above example, after the log audit node receives the business log set returned by the log collection node, it can extract each business log contained in the business log set and determine that it includes business log log_1, business log log_2...business log log_n, where n is a positive integer, the time information corresponding to business log log_1 is T1, the time information corresponding to business log log_2 is T2...the time information corresponding to business log log_n is Tn. Then, the Snowflake algorithm can be used to create a key for each business data in combination with the time information. At this time, the key corresponding to business log log_1 is determined to be log_1 / ID_1; the key corresponding to business log log_2 is log_2 / ID_2...the key corresponding to business log log_n is log_n / ID_n; where log_1 / ID_1>log_2 / ID_2>...>log_n / ID_n.

[0104] Furthermore, after adding keys to n business logs, each business log can be written to the RocksDB database in the order of the keys; that is, in the order of first-in-first-out, the business log log_1 is written to the RocksDB database first, followed by the business log log_2... and so on, until all n business logs are written, thereby achieving the purpose of persistence and avoiding loss due to equipment failure before writing to Kafka.

[0105] In summary, by adding data identifiers to each piece of business data in combination with time information, not only can the orderliness of the data be guaranteed, but also data confusion can be avoided, so that when the data is subsequently written to the distributed system, it can be ensured that the normal operation of the target business will not be affected by confusion.

[0106] Furthermore, in the process of writing the business data with the added data identifier into the business database, since the storage space of the business database is limited, if the business database is continuously written, it may cause the business database to be occupied for a long time and affect the writing of other data. Therefore, in order to avoid affecting the writing of other data, the business database can be updated based on the degradation strategy. In this embodiment, the specific implementation method is as follows:

[0107] Determine a storage space threshold corresponding to the business database, and judge whether the storage space of the business database at the current time node is greater than the storage space threshold;

[0108] If so, extract the data to be deleted that has been stored for the longest time in the business database, and release the storage space of the business database based on the data to be deleted; when the storage space of the business database is released, write the business data with the data identifier into the business database.

[0109] If not, the business data with the data identifier added thereto may be directly written into the business database.

[0110] Specifically, the storage space threshold refers to the upper limit value of the data stored in the business database. The storage space threshold can avoid the business database from crashing and data corruption. The size of the storage space threshold can be set according to the actual scenario, and this embodiment does not make any limitation here. Correspondingly, the data to be deleted refers to the data that has been stored in the business database for too long and is not used.

[0111] Based on this, after adding data identifiers to each business data in the business data set, the storage time threshold corresponding to the business database can be determined first, and it can be judged whether the storage space of the business database at the current time node is greater than the storage space threshold. If so, it indicates that the business data can no longer be written into the business database at the current time node. In order to avoid the loss of business data with added data identifiers, the data to be deleted with the longest storage time in the business database can be extracted at this time, and the data to be deleted can be removed, thereby releasing the storage space of the business database. After the storage space of the business database is released, the business data with added data identifiers can be written into the business database. If not, it indicates that the business data can continue to be written into the business database at the current time node, and the business data with added data identifiers can be directly written into the business database.

[0112] In actual applications, when determining the data to be deleted in the business database, it can be determined based on the total volume of the business data items contained in the business data set, that is, first determine the storage space that can be occupied by the business data contained in the business data set, and then determine the data to be deleted in the business database according to the storage space. After that, the data to be deleted can be eliminated to release the storage space of the business database, so as to achieve the purpose of fully utilizing storage resources.

[0113] Furthermore, in order to persist the data, this embodiment uses RocksDB as the business database. Therefore, when storing the data, the data needs to be converted into binary data. In this embodiment, the specific implementation method is as follows:

[0114] Convert the business data with the data identifier added to obtain binary data;

[0115] The binary data are sequentially written into the business database according to the data identifiers, wherein the data identifiers are monotonically increasing.

[0116] Specifically, as an open embedded, persistent storage, KV-type storage engine, RocksDB database can ensure that data can be persistently stored. After obtaining the business data with the added data identifier, the business data with the added data identifier can be converted into binary data that meets the storage requirements of the business database, and then written into the business database in sequence according to the data identifier.

[0117] Using the above example, before writing business logs log_1, business log_2, ... business log_n to the RocksDB database, you can first determine the storage space threshold of 90% corresponding to the RocksDB database, and judge whether the storage space of the RocksDB database at the current time node reaches the storage space threshold of 90%; if so, you can first determine that the total space occupied by business logs log_1 to business log_n is 5G, and then extract the business log with the longest storage time from the RocksDB database according to the space size of the business logs. When the business log with the longest storage time does not reach 5G, you can extract the second business log with a storage time just less than the longest storage time, until the space share of the business log reaches 5G, then delete this part of the business logs to release the RocksDB database; then convert the business logs log_1 to business log_n into binary data, and finally write the business logs log_1, business log_2, ... business log_n converted into binary data to the RocksDB database in sequence according to the key.

[0118] In summary, by dynamically adjusting the storage space of the business database, not only can the persistence of the business data with added data identifiers be ensured, but also the redundant data in the business database can be cleaned up in time, thereby improving space utilization.

[0119] Step S106: receiving a processing instruction submitted for the business data in the business database.

[0120] Specifically, after the business data with the data identifier added is written to the business database, the persistence of the business data is completed. When the business server needs to use the business data for subsequent processing, it will receive the processing instructions submitted for the business data in the business database. Subsequently, the business data can be read according to the processing instructions and written to the distributed system to complete the data processing task.

[0121] Step 108: Read target business data from the business database based on the processing instruction and the data identifier, and write the target business data into a distributed system corresponding to the target business.

[0122] Specifically, when the processing instruction is received, it indicates that the business data in the business database needs to be extracted for subsequent processing operations. In order to avoid data loss, the data will be persisted. If the business data is directly read from the business database and written to the distributed system, data confusion will occur, thereby affecting the subsequent business processing operations of the distributed system. Therefore, after receiving the processing instruction, the target business data can be read from the business database based on the processing instruction and the data identifier to be written to the distributed system to ensure the smooth completion of the business processing operation. The target business data specifically refers to the business data that needs to be written to the distributed system at the current time node; correspondingly, the distributed system specifically refers to the system that needs to perform corresponding processing operations according to the target business data. For example, in the log collection scenario, the distributed system can be Kafka configured by the business server.

[0123] Furthermore, in the process of reading the target business data and writing it into the distributed system, since the data has been persisted, if the business data is read directly, it may not be the data required by the current time node, thereby causing the distributed system to be unable to complete subsequent processing tasks. Therefore, when reading the target business data, it can be completed based on the data identifier. In this embodiment, the specific implementation method is as follows:

[0124] querying metadata of the business database according to the processing instruction to obtain the data identifier;

[0125] Reading the target business data in the business database according to the data identifier;

[0126] The target business data are written into the distributed system in sequence according to the data identifier, wherein the data identifier increases monotonically.

[0127] Specifically, the metadata refers to the intermediary data and relay data corresponding to the business database, which is a type of data that describes the data stored in the database, mainly information that describes data properties, and is used to support functions such as indicating storage location, historical data, resource search, and file records.

[0128] Based on this, after obtaining the processing instruction, the metadata of the business database can be queried according to the processing instruction to obtain multiple data identifiers based on the reading results, and then the target business data is read from the business database according to the data identifier, and finally the target business data is written into the distributed system according to the first-in-first-out rule, that is, the target business data is written into the distributed system in sequence according to the data identifier.

[0129] Continuing with the above example, when a log audit instruction is received, the metadata corresponding to the RocksDB database can be queried according to the log audit instruction to obtain the key corresponding to each business log according to the query result, and then each business log is read from the RocksDB database in sequence according to the key, that is: first read the business log log_1 according to log_1 / ID_1, then read the business log log_2 according to log_2 / ID_2... and finally read the business log log_n according to log_n / ID_n. Then, in order to complete the log audit processing, the business logs are written to Kafka according to the key, that is: first write the business log log_1 to Kafka, then write the business log log_2 to Kafka... and finally write the business log log_n to Kafka.

[0130] In summary, in the process of writing the target business log into the distributed system, considering that the first-in-first-out principle can ensure that the distributed system completes subsequent data processing tasks, the data can be read and written according to the data identifier, thereby effectively improving the data processing efficiency.

[0131] The data processing method provided in this specification, when the business service end receives the business data set returned by the data processing end, can add a data identifier for each business data in the business set, so that each business data is continuous and unique, and then in order to prevent data loss, the business data with the added data identifier can be written into the business database; when receiving a processing instruction for a physical examination of the business data in the business database, the target business data can be read from the business database one by one based on the processing instruction and the data identifier, and then the read target business data can be written into the distributed system, thereby avoiding data confusion by adding data identifiers; at the same time, in order to prevent data loss, the business data with the identifier can be written into the business database, so that the data can be persistent, so as to avoid the problem of data loss affecting the target business, thereby further improving the disaster recovery efficiency between the business service end and the data processing end.

[0132] The following combination Figure 2 , taking the application of the data processing method provided in this specification in the log collection scenario as an example, the data processing method is further explained. Figure 2 A processing flow chart of a data processing method applied to a log collection scenario provided by an embodiment of this specification is shown, which specifically includes the following steps:

[0133] Step S202: determining a log collection node having a log transmission relationship with a log audit node according to the business information of the target business.

[0134] Step S204: receiving a log audit request submitted for a target business, and creating a log audit task according to the log audit request.

[0135] Step S206, constructing structured information according to the log audit task, and generating a log processing package corresponding to the structured information through the business code.

[0136] Step S208: sending a log processing package to the log collection node, and receiving the user behavior log returned by the log collection node in response to the log processing package.

[0137] Step S210, adding a key to each user behavior log based on the Snowflake algorithm preset for the target business.

[0138] Step S212: When the storage space of the RocksDB database corresponding to the target business is less than the storage space threshold, the user behavior logs with the added key are written into the RocksDB database in sequence.

[0139] Step S214, receiving a log audit instruction submitted for the user behavior log in the RocksDB database.

[0140] Step S216, query the key in the RocksDB database according to the log audit instruction, and read the user behavior log from the RocksDB database according to the key.

[0141] Step S218, write the user behavior log into Kafka in sequence according to the key for log audit processing.

[0142] The data processing method provided in this specification avoids data confusion by adding data identifiers. At the same time, in order to prevent data loss, the business data with the added identifiers can be written into the business database so that the data can be persistent, so as to avoid the problem of data loss affecting the target business, thereby further improving the disaster recovery efficiency between the business service end and the data processing end.

[0143] Corresponding to the above method embodiment, this specification also provides a data processing device embodiment, Figure 3 FIG. 1 shows a schematic diagram of the structure of a data processing device provided by an embodiment of the present specification. Figure 3 As shown, the device comprises:

[0144] A receiving set module 302 is configured to receive a business data set submitted by a data processing terminal associated with a target business;

[0145] An adding identification module 304 is configured to add a data identification to each business data in the business data set, and write the business data with the added data identification into the business database of the target business;

[0146] The instruction receiving module 306 is configured to receive a processing instruction submitted for the business data in the business database;

[0147] The data reading module 308 is configured to read the target business data in the business database based on the processing instruction and the data identifier, and write the target business data into the distributed system corresponding to the target business.

[0148] In an optional embodiment, the adding identification module 304 is further configured to:

[0149] Extract each business data contained in the business data set, and determine the time information corresponding to each business data; add the data identifier to each business data contained in the business data set according to the time information; accordingly, write the business data with the added data identifier into the business database of the target business, including: write the business data with the added data identifier into the business database in sequence according to the data identifier, wherein the data identifier is monotonically increasing.

[0150] In an optional embodiment, the data reading module 308 is further configured to:

[0151] According to the processing instruction, the metadata of the business database is queried to obtain the data identifier; the target business data is read from the business database according to the data identifier; accordingly, the target business data is written into the distributed system corresponding to the target business, including: writing the target business data into the distributed system in sequence according to the data identifier, wherein the data identifier is monotonically increasing.

[0152] In an optional embodiment, the adding identification module 304 is further configured to:

[0153] Obtain the Snowflake algorithm preset for the target business; and add the data identifier to each business data in the business data set based on the Snowflake algorithm.

[0154] In an optional embodiment, the receiving collection module 302 is further configured to:

[0155] The data processing end having a data transmission relationship with the business service end is determined according to the business information of the target business; a data processing package is sent to the data processing end, and the business data set returned by the data processing end for the data processing package is received.

[0156] In an optional embodiment, the receiving collection module 302 is further configured to:

[0157] Receive a business processing request submitted for the target business, and create a data processing task according to the business processing request; construct structured information according to the data processing task, and generate the data processing package corresponding to the structured information through business code.

[0158] In an optional embodiment, the adding identification module 304 is further configured to:

[0159] Determine the storage space threshold corresponding to the business database, and judge whether the storage space of the business database at the current time node is greater than the storage space threshold; if so, extract the data to be deleted that has been stored for the longest time in the business database, and release the storage space of the business database based on the data to be deleted; when the storage space of the business database is released, write the business data with the data identifier added into the business database.

[0160] In an optional embodiment, the adding identification module 304 is further configured to:

[0161] The business data with the data identifier added thereto is converted to obtain binary data; the binary data is sequentially written into the business database according to the data identifier, wherein the data identifier is monotonically increasing.

[0162] The data processing device provided in this embodiment is applied to a business service end. When the business service end receives a business data set returned by the data processing end, a data identifier can be added to each business data in the business set, so that each business data is continuous and unique. Then, in order to prevent data loss, the business data with the data identifier can be written into the business database. When a processing instruction for a physical examination of the business data in the business database is received, target business data can be read from the business database one by one based on the processing instruction and the data identifier, and then the read target business data can be written into the distributed system, thereby avoiding data confusion by adding data identifiers. At the same time, in order to prevent data loss, the business data with the identifier can be written into the business database, so that the data can be persistent, so as to avoid the problem of data loss affecting the target business, thereby further improving the disaster recovery efficiency between the business service end and the data processing end.

[0163] The above is a schematic scheme of a data processing device of this embodiment. It should be noted that the technical scheme of the data processing device and the technical scheme of the above data processing method belong to the same concept, and the details not described in detail in the technical scheme of the data processing device can be referred to the description of the technical scheme of the above data processing method.

[0164] Figure 4 The structure block diagram of a computing device 400 provided according to an embodiment of the present specification is shown. The components of the computing device 400 include but are not limited to a memory 410 and a processor 420. The processor 420 is connected to the memory 410 via a bus 430, and the database 450 is used to store data.

[0165] The computing device 400 also includes an access device 440 that enables the computing device 400 to communicate via one or more networks 460. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 440 may include one or more of any type of network interface (e.g., a network interface card (NIC)) wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Wide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.

[0166] In one embodiment of the present specification, the above components of the computing device 400 and Figure 4 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 4 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.

[0167] Computing device 400 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or PC. Computing device 400 may also be a mobile or stationary server.

[0168] The processor 420 is used to execute the following computer executable instructions:

[0169] Receive a business data set submitted by a data processing terminal associated with the target business;

[0170] Adding a data identifier to each business data in the business data set, and writing the business data with the data identifier added into the business database of the target business;

[0171] Receiving a processing instruction submitted for the business data in the business database;

[0172] The target business data is read from the business database based on the processing instruction and the data identifier, and the target business data is written into a distributed system corresponding to the target business.

[0173] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above data processing method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above data processing method.

[0174] An embodiment of the present specification further provides a computer-readable storage medium storing computer instructions, which are used when executed by a processor to:

[0175] Receive a business data set submitted by a data processing terminal associated with the target business;

[0176] Adding a data identifier to each business data in the business data set, and writing the business data with the data identifier added into the business database of the target business;

[0177] Receiving a processing instruction submitted for the business data in the business database;

[0178] The target business data is read from the business database based on the processing instruction and the data identifier, and the target business data is written into a distributed system corresponding to the target business.

[0179] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above data processing method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above data processing method.

[0180] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0181] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0182] It should be noted that, for the convenience of description, the aforementioned method embodiments are all described as a series of action combinations, but those skilled in the art should be aware that this specification is not limited by the order of the actions described, because according to this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this specification.

[0183] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0184] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is limited only by the claims and their full scope and equivalents.

Claims

1. A data processing method, characterized in that: Applied to business servers, including: Receive the business data set submitted by the data processing end associated with the target business, including: Determine the data processing end having a data transmission relationship with the business service end according to the business information of the target business, send a data processing package to the data processing end, and receive the business data set returned by the data processing end for the data processing package, wherein before the step of sending the data processing package to the data processing end is executed, it also includes: Receive a business processing request submitted for the target business, and create a data processing task according to the business processing request; construct structured information according to the data processing task, and generate the data processing package corresponding to the structured information through business code, wherein the structured information is used to regulate the data processing end to collect and process data according to data information, field information and type information; Adding a data identifier to each business data in the business data set, and writing the business data with the data identifier added into the business database of the target business; Receiving a processing instruction submitted for the business data in the business database; The target business data is read from the business database based on the processing instruction and the data identifier, and the target business data is written into a distributed system corresponding to the target business.

2. The data processing method according to claim 1, characterized in that: The adding a data identifier to each business data in the business data set includes: Extracting each business data contained in the business data set, and determining the time information corresponding to each business data; Adding the data identifier to each business data included in the business data set according to the time information; Correspondingly, writing the business data with the data identifier added into the business database of the target business includes: The business data with the data identifier added thereto is sequentially written into the business database according to the data identifier, wherein the data identifier increases monotonically.

3. The data processing method according to claim 1, characterized in that: The reading target business data in the business database based on the processing instruction and the data identifier includes: querying metadata of the business database according to the processing instruction to obtain the data identifier; Reading the target business data in the business database according to the data identifier; Accordingly, writing the target service data into the distributed system corresponding to the target service includes: The target business data are written into the distributed system in sequence according to the data identifier, wherein the data identifier increases monotonically.

4. The data processing method according to claim 1, characterized in that: The adding a data identifier to each business data in the business data set includes: Obtain the Snowflake algorithm preset for the target business; The data identifier is added to each business data in the business data set based on the Snowflake algorithm.

5. The data processing method according to any one of claims 1 to 4, characterized in that: Writing the business data with the data identifier added thereto into the business database of the target business comprises: Determine a storage space threshold corresponding to the business database, and judge whether the storage space of the business database at the current time node is greater than the storage space threshold; If so, extract the data to be deleted that has been stored for the longest time in the business database, and release the storage space of the business database based on the data to be deleted; When the storage space of the business database is released completely, the business data with the data identifier added is written into the business database.

6. The data processing method according to any one of claims 1 to 4, characterized in that: Writing the business data with the data identifier added thereto into the business database of the target business comprises: Convert the business data with the data identifier added to obtain binary data; The binary data are sequentially written into the business database according to the data identifiers, wherein the data identifiers are monotonically increasing.

7. A data processing device, characterized in that: Applied to business servers, including: The receiving set module is configured to receive a business data set submitted by a data processing terminal associated with a target business, including: Determine the data processing end having a data transmission relationship with the business service end according to the business information of the target business, send a data processing package to the data processing end, and receive the business data set returned by the data processing end for the data processing package, wherein before the step of sending the data processing package to the data processing end is executed, it also includes: Receive a business processing request submitted for the target business, and create a data processing task according to the business processing request; construct structured information according to the data processing task, and generate the data processing package corresponding to the structured information through business code, wherein the structured information is used to regulate the data processing end to collect and process data according to data information, field information and type information; An identification adding module is configured to add a data identification to each business data in the business data set, and write the business data with the data identification added into the business database of the target business; An instruction receiving module is configured to receive a processing instruction submitted for the business data in the business database; The data reading module is configured to read the target business data in the business database based on the processing instruction and the data identifier, and write the target business data into the distributed system corresponding to the target business.

8. A computing device, characterized in that include: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the following method: Receive the business data set submitted by the data processing end associated with the target business, including: Determine the data processing end having a data transmission relationship with the business service end according to the business information of the target business, send a data processing package to the data processing end, and receive the business data set returned by the data processing end for the data processing package, wherein before the step of sending the data processing package to the data processing end is executed, it also includes: Receive a business processing request submitted for the target business, and create a data processing task according to the business processing request; construct structured information according to the data processing task, and generate the data processing package corresponding to the structured information through business code, wherein the structured information is used to regulate the data processing end to collect and process data according to data information, field information and type information; Adding a data identifier to each business data in the business data set, and writing the business data with the data identifier added into the business database of the target business; Receiving a processing instruction submitted for the business data in the business database; The target business data is read from the business database based on the processing instruction and the data identifier, and the target business data is written into a distributed system corresponding to the target business.

9. A computer-readable storage medium, characterized in that: It stores computer instructions, which, when executed by a processor, implement the steps of the method described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Business cache updating method and device

    CN107103068A

  • Data processing method and device

    CN110245010A

  • Data redistribution method, electronic equipment and storage medium

    CN112765262A