Data asynchronous processing method and related equipment based on artificial intelligence
Through the asynchronous data processing method based on artificial intelligence, trillions of data are preprocessed, divided into batches, distributed, encrypted and stored, solving the problem of slow data query rate and achieving efficient asynchronous data processing and user experience improvement.
Patent Information
- Application Number
- CN202210987077.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-17
- Publication Date
- 2025-05-23
- Estimated Expiration
- 2042-08-17
AI Technical Summary
When the prior art processes trillions of data in a large amount of data, the query rate is extremely slow, resulting in a slower data encryption rate, affecting user experience and enterprise service quality.
Using an asynchronous data processing method based on artificial intelligence, preprocessing, batching, distributing to server nodes, encrypting, storing and pushing plaintext data, we ensure the load balancing of the server cluster and encrypting data when the server load is low.
It improves the efficiency of asynchronous data processing, improves the speed and user experience of data queries, and ensures the quality of enterprise services.
Smart Images

Figure CN115329002B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular, to a method, apparatus, electronic device, and storage medium for asynchronous data processing based on artificial intelligence. Background Art
[0002] With the development of big data technology, most enterprises have retained data at the level of tens of billions or even trillions after years of business precipitation. Enterprises usually encrypt massive data through the method of querying first and then encrypting, and then store the encrypted data in the database. Even if the data is maliciously stolen, the sensitive data is protected because of encryption.
[0003] Currently, the query rate for data in the order of trillions is extremely slow, which further slows down the rate of data encryption after querying, thus affecting the user experience and the quality of enterprise services. Summary of the Invention
[0004] In view of the above, it is necessary to provide a method and related devices for asynchronous data processing based on artificial intelligence to solve the technical problem of how to improve the efficiency of asynchronous data processing. Among them, the related devices include an asynchronous data processing device based on artificial intelligence, an electronic device, and a storage medium.
[0005] An embodiment of this application provides a method for asynchronous data processing based on artificial intelligence. The method includes:
[0006] Preprocess the plaintext data table in the preset server cluster to obtain multiple initial plaintext data, and each initial plaintext data corresponds to an auto-increment primary key and a data size;
[0007] Divide the initial plaintext data into multiple batches according to the auto-increment primary key and the data size, and each batch contains multiple initial plaintext data;
[0008] Calculate the load value of each server node in the server cluster, and distribute the multiple batches of initial plaintext data to the server nodes according to the load value;
[0009] Encrypt the initial plaintext data according to the preset encryption duration to obtain ciphertext data and an index of the ciphertext data;
[0010] Mark the topic identifier of the ciphertext data according to the plaintext data, and distribute the ciphertext data to each server node for storage according to the index of the ciphertext data and the load value of the server node;
[0011] Push the plaintext data corresponding to the ciphertext data to the user according to the topic identifier of the ciphertext data.
[0012] In some embodiments, the preprocessing of the plaintext data table in the preset server cluster to obtain a plurality of initial plaintext data includes:
[0013] The plaintext data table contains multiple rows and columns, the type of each column of data in the plaintext data table is queried, and the column whose type is not an auto-increment primary key is used as the initial plaintext data, and each initial plaintext data contains multiple dimensions;
[0014] Query the data type and length corresponding to each dimension, and query the data size of each dimension according to the length and the data type;
[0015] The sum of the data sizes corresponding to all dimensions in each of the initial plaintext data is taken as the data size of the initial plaintext data.
[0016] In some embodiments, dividing the initial plaintext data into multiple batches according to the auto-increment primary key and the data size includes:
[0017] a. Evenly dividing the initial plaintext data into a plurality of candidate batches according to a preset division threshold, each candidate batch containing a plurality of initial plaintext data, and the number of the candidate batches is equal to the division threshold;
[0018] b. Calculate the sum of the data sizes of all initial plaintext data in each candidate batch as the evaluation value of the batch;
[0019] c. Calculate the variance of all the evaluation values. If the variance is less than a preset first termination threshold, it indicates that the difference between the data sizes included in the candidate batches is small. Then, the multiple candidate batches are used as the final multiple batches to complete the batching of the initial plaintext data. If the variance is not less than the preset first termination threshold, it indicates that the difference between the data sizes included in all the candidate batches is large. Then, update the partitioning threshold to obtain an updated partitioning threshold, and repeat steps a to c to obtain multiple batches of initial plaintext data.
[0020] d. If the final batches are still not obtained after the number of repeated divisions reaches a preset second termination threshold, the multiple candidate batches with the smallest variance are taken as the final batches, and the preset second termination threshold is equal to the initial value of the preset division threshold.
[0021] In some embodiments, calculating the load value of each server node in the server cluster and distributing the multiple batches of initial plaintext data to the server node according to the load value includes:
[0022] Querying the number of tasks processed by each server node in the server cluster as a load value of each server node;
[0023] The minimum value of the auto-increment primary key corresponding to all initial plaintext data in each batch is used as the index of the batch;
[0024] The batches are sorted in ascending order according to the indexes to obtain the order of each batch, and the server nodes are sorted in ascending order according to the load values to obtain the order of each server node;
[0025] The batches are sent to a server node having the same order for subsequent data encryption processing.
[0026] In some embodiments, encrypting the initial plaintext data according to a preset encryption duration to obtain ciphertext data and an index of the ciphertext data includes:
[0027] a, encrypting the initial plaintext data within a preset encryption time range to obtain ciphertext data;
[0028] b. When the preset encryption time is over, suspend data encryption, and record the moment when each ciphertext data is encrypted as the index of the ciphertext data;
[0029] c. If the initial plaintext data is still not encrypted after the preset encryption time has expired, the resource occupancy rate of the server cluster is continuously compared with the preset occupancy rate threshold. If the occupancy rate is lower than the preset occupancy rate threshold, the preset encryption time is updated according to the resource occupancy rate of the server cluster and the current time to obtain an updated preset encryption time, and steps a to c are repeatedly executed to continuously encrypt data until all the initial plaintext data are encrypted and then data encryption is stopped;
[0030] Wherein, updating the preset encryption duration according to the resource occupancy rate of the server cluster and the current moment to obtain an updated preset encryption duration includes:
[0031] Querying the hardware information of the server cluster, and calculating the resource occupancy rate of the server cluster according to the hardware information;
[0032] Calculate the time difference between the current time and the preset reference time;
[0033] Normalizing the resource occupancy rate and the time difference to obtain a normalized resource occupancy rate and a normalized time difference;
[0034] Inputting the normalized resource occupancy rate and the normalized time difference into a preset integration function to calculate the job duration update ratio;
[0035] The product of the preset initial operation duration and the update ratio is calculated as the updated preset encryption duration.
[0036] In some embodiments, marking the subject identifier of the ciphertext data according to the plaintext data, and distributing the ciphertext data to each of the server nodes for storage according to the index of the ciphertext data and the load value of the server node, includes:
[0037] Classifying the initial plaintext data according to a pre-trained initial plaintext classification model to obtain a category of each of the initial plaintext data, and using the category as a subject identifier of the ciphertext data corresponding to the initial plaintext data;
[0038] The ciphertext data are sorted in order from early to late according to the index of the ciphertext data to obtain the order of each ciphertext data, and the server nodes are sorted in order from small to large according to the load value to obtain the order of each server node;
[0039] The ciphertext data is distributed to server nodes having the same order for storage.
[0040] In some embodiments, the pushing of the plaintext data corresponding to the ciphertext data to the user according to the subject identifier of the ciphertext data includes:
[0041] Query preset categories of user needs, where the categories of user needs include user order information, user logistics information, and user transaction information;
[0042] In each server node of the server cluster, the subject identifiers corresponding to the ciphertext data are queried in order from the latest to the earliest according to the indexes of the ciphertext data. If the subject identifier is consistent with the category of the user requirement, the ciphertext data is decrypted according to a preset secret key to obtain initial plaintext data, and the initial plaintext data is pushed to the user;
[0043] If the subject identifier is inconsistent with the category of the user's requirement, the subject identifier of each ciphertext data is continuously queried until all ciphertext data are queried and then the query is stopped;
[0044] If the ciphertext data corresponding to the category required by the user cannot be found, an information delay prompt is sent to the user.
[0045] The embodiment of the present application also provides a data asynchronous processing device based on artificial intelligence, the device comprising:
[0046] A preprocessing unit, used for preprocessing a plaintext data table in a preset server cluster to obtain a plurality of initial plaintext data, each of which corresponds to an auto-increment primary key and a data size;
[0047] A batching unit, used for dividing the initial plaintext data into a plurality of batches according to the auto-increment primary key and the data size, each batch containing a plurality of initial plaintext data;
[0048] A distribution unit, for the server cluster including a plurality of server nodes, calculating a load value of each server node in the server cluster, and distributing the plurality of batches of initial plaintext data to the server nodes according to the load value;
[0049] An encryption unit, used to encrypt the initial plaintext data according to a preset encryption duration to obtain ciphertext data and an index of the ciphertext data;
[0050] A storage unit, used for marking a subject identifier of the ciphertext data according to the plaintext data, and distributing the ciphertext data to each of the server nodes for storage according to an index of the ciphertext data and a load value of the server node;
[0051] The push unit is used to push the plaintext data corresponding to the ciphertext data to the user according to the subject identifier of the ciphertext data.
[0052] An embodiment of the present application further provides an electronic device, the electronic device comprising:
[0053] a memory storing computer readable instructions; and
[0054] A processor executes the computer-readable instructions stored in the memory to implement the artificial intelligence-based data asynchronous processing method.
[0055] An embodiment of the present application also provides a computer-readable storage medium, in which computer-readable instructions are stored. The computer-readable instructions are executed by a processor in an electronic device to implement the artificial intelligence-based asynchronous data processing method.
[0056] The above-mentioned artificial intelligence-based data asynchronous processing method divides the plaintext data into multiple batches according to the data size of the initial plaintext data, and distributes the initial plaintext data of multiple batches to the server nodes according to the index of each batch to ensure the load balancing of the server cluster, continuously encrypts the initial plaintext data within the encryption time to obtain the ciphertext data, and continuously updates the encryption time to maintain the stability of the server clusters, and finally marks the subject identifier of each ciphertext data, and uses the subject identifier to push the initial plaintext corresponding to the ciphertext data to the user, which can perform asynchronous processing on data query tasks, thereby improving the efficiency of data query. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 It is a flowchart of a preferred embodiment of an artificial intelligence-based data asynchronous processing method involved in this application.
[0058] Figure 2 It is a functional module diagram of a preferred embodiment of the artificial intelligence-based data asynchronous processing device involved in this application.
[0059] Figure 3 It is a structural schematic diagram of an electronic device of a preferred embodiment of the artificial intelligence-based data asynchronous processing method involved in the present application. DETAILED DESCRIPTION
[0060] In order to more clearly understand the purpose, features and advantages of the present application, the present application is described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that, in the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other. In the following description, many specific details are set forth to facilitate a full understanding of the present application, and the embodiments described are only a part of the embodiments of the present application, rather than all of the embodiments.
[0061] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0062] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those generally understood by those skilled in the art to which the present application belongs. The terms used herein in the specification of the present application are only for the purpose of describing specific embodiments and are not intended to limit the present application. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.
[0063] The embodiment of the present application provides an artificial intelligence-based data asynchronous processing method, which can be applied to one or more electronic devices. The electronic device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to a microprocessor, an application-specific integrated circuit (ASIC), a programmable gate array (FPGA), a digital processor (DSP), an embedded device, etc.
[0064] The electronic device may be any electronic product that can perform human-computer interaction with a user, such as a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), a game console, an interactive network television (IPTV), a smart wearable device, etc.
[0065] The electronic device may also include a network device and / or a user device, wherein the network device includes, but is not limited to, a single network server, a server group consisting of multiple network servers, or a cloud consisting of a large number of hosts or network servers based on cloud computing.
[0066] The network where the electronic device is located includes but is not limited to the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (VPN), etc.
[0067] like Figure 1 , which is a flow chart of a preferred embodiment of the data asynchronous processing method based on artificial intelligence of the present application. According to different requirements, the order of the steps in the flow chart can be changed, and some steps can be omitted.
[0068] S10, preprocessing the plaintext data table in the preset server cluster to obtain a plurality of initial plaintext data, each of which corresponds to an auto-increment primary key and a data size.
[0069] In an optional embodiment, the preprocessing of the plaintext data table in the preset server cluster to obtain a plurality of initial plaintext data includes:
[0070] The plaintext data table contains multiple rows and columns, the type of each column of data in the plaintext data table is queried, and the column whose type is not an auto-increment primary key is used as the initial plaintext data, and each initial plaintext data contains multiple dimensions;
[0071] Query the data type and length corresponding to each dimension, and query the data size of each dimension according to the length and the data type;
[0072] The sum of the data sizes corresponding to all dimensions in each of the initial plaintext data is taken as the data size of the initial plaintext data.
[0073] In this optional embodiment, the function of the server cluster is to store plaintext data and forward data. The server cluster includes multiple server nodes, and data can be transmitted between each server node.
[0074] In this optional embodiment, the plaintext data in the server cluster is stored in the format of a plaintext data table, and the plaintext data table contains n rows and m columns, where n and m are both integers greater than 1, and each row in the plaintext data table corresponds to a plaintext data, and each column corresponds to a feature in the plaintext data.
[0075] In this optional embodiment, the data type of each column of data in the plaintext data table can be queried, and the column whose type is not an auto-increment primary key is used as the initial plaintext data, and each initial plaintext data contains multiple dimensions. The data types include auto increment primary key, varchar (string), int (integer value), float (single-precision floating point), and double (double-precision floating point).
[0076] In this optional embodiment, the value of the auto-increment primary key is a positive integer, and the difference between two adjacent auto-increment primary keys is 1. The higher the value of the auto-increment primary key, the earlier the plaintext data corresponding to the auto-increment primary key is stored in the server cluster, and the more priority the plaintext data should be encrypted.
[0077] In this optional embodiment, the data type and length corresponding to each dimension can be queried, and the data size of each dimension can be queried based on the length and the data type. Exemplarily, when the category is varchar, the size of the dimension data is length + 1; when the category is int, the size of the dimension data is 4 bytes; when the category is double, the size of the dimension data is 8 bytes; when the category is float, the size of the dimension data is 4 bytes.
[0078] In this optional embodiment, the sum of the data sizes of all dimensions in each plaintext data may be calculated as the data size corresponding to the plaintext data. The larger the data size, the larger the storage space occupied by the plaintext data in the server cluster, and the more time-consuming it is to encrypt the plaintext data.
[0079] In this way, the initial plaintext data is filtered out by querying the data type of each column in the plaintext data table, and the size of each initial plaintext data is calculated based on the type and length of the data in each initial plaintext data, providing data guidance for subsequent data batching, which is convenient for balancing the data size of each batch, thereby improving the efficiency of subsequent data encryption.
[0080] S11, dividing the initial plaintext data into multiple batches according to the auto-increment primary key and the data size, each batch containing multiple initial plaintext data.
[0081] In an optional embodiment, dividing the initial plaintext data into multiple batches according to the auto-increment primary key and the data size includes:
[0082] a. The initial plaintext data is evenly divided into a plurality of candidate batches according to a preset division threshold, each candidate batch contains a plurality of initial plaintext data, and the number of the candidate batches is equal to the division threshold. For example, the preset division threshold can be initially set to 20, and 20 candidate batches can be obtained.
[0083] b. Calculate the sum of the data sizes of all initial plaintext data in each candidate batch as the evaluation value of the batch.
[0084] c. Calculate the variance of all the evaluation values. If the variance is less than a preset first termination threshold, it indicates that the difference between the data sizes included in the candidate batches is small. Then, the multiple candidate batches are used as the final multiple batches to complete the batching of the initial plaintext data. If the variance is not less than the preset first termination threshold, it indicates that the difference between the data sizes included in all candidate batches is large. Then, update the preset partitioning threshold to obtain an updated partitioning threshold. Repeat steps a to c to obtain multiple batches of initial plaintext data. The preset first termination threshold may be 0.001. The updating of the preset partitioning threshold may be to reduce the preset partitioning threshold by 1.
[0085] d. If the final batches are still not obtained after the number of repeated divisions reaches a preset second termination threshold, the multiple candidate batches with the smallest variance are taken as the final batches, and the preset second termination threshold is equal to the initial value of the preset division threshold.
[0086] In this way, by dividing the original data multiple times and recording the variance of the batch data after each division to perform multi-batch operations, it is possible to ensure that the difference between the data sizes of each batch is small, balance the time for subsequent data encryption for each batch, and improve the efficiency of subsequent data encryption.
[0087] S12, calculating the load value of each server node in the server cluster, and distributing the multiple batches of initial plaintext data to the server nodes according to the load value.
[0088] In an optional embodiment, the calculating the load value of each server node in the server cluster and distributing the multiple batches of initial plaintext data to the server node according to the load value includes:
[0089] Querying the number of tasks processed by each server node in the server cluster as a load value of each server node;
[0090] The minimum value of the auto-increment primary key corresponding to all initial plaintext data in each batch is used as the index of the batch;
[0091] The batches are sorted in ascending order according to the indexes to obtain the order of each batch, and the server nodes are sorted in ascending order according to the load values to obtain the order of each server node;
[0092] The batches are sent to a server node having the same order for subsequent data encryption processing.
[0093] The fewer the number of processing tasks of the server node is, the lower the load of the server node is, and the server node should be assigned data processing tasks with higher priority, wherein the data processing tasks include data encryption and data transmission.
[0094] In this optional embodiment, the smaller the index is, the earlier all the initial plaintext data in the batch corresponding to the index are stored in the server cluster, and the initial plaintext data in the batch should be encrypted first.
[0095] In this way, based on the load value of the server node and the index of each batch, the batches corresponding to the smaller index are distributed to the server nodes corresponding to the smaller load value, ensuring the load balance of the server cluster, thereby improving the stability of data transmission.
[0096] S13, encrypting the initial plaintext data according to a preset encryption duration to obtain ciphertext data and an index of the ciphertext data.
[0097] In an optional embodiment, encrypting the initial plaintext data according to a preset encryption duration to obtain ciphertext data and an index of the ciphertext data includes:
[0098] a. Encrypt the initial plaintext data within a preset encryption time to obtain ciphertext data. The preset encryption time can be 2 hours, 3 hours, 4 hours, etc., and this application does not limit this.
[0099] In this optional embodiment, for the initial plaintext data in each server node, the initial plaintext data can be encrypted in ascending order according to the self-incrementing primary key of the initial plaintext data within a preset encryption time range to obtain the ciphertext data corresponding to each initial plaintext data. The encryption method can be an existing encryption algorithm such as the RSA encryption algorithm, and this application does not limit this.
[0100] b. In order to avoid excessive server load caused by long-term execution of large amounts of data encryption tasks, data encryption is suspended when the preset encryption time ends, and the moment when each ciphertext data is encrypted can be recorded separately as the index of the ciphertext data.
[0101] c. In order to restart the data encryption task when the server load is low to realize asynchronous data processing, when the preset encryption duration ends and the initial plaintext data is still not encrypted, the resource occupancy rate of the server cluster is continuously compared with the preset occupancy rate threshold. If the occupancy rate is lower than the preset occupancy rate threshold, the preset encryption duration is updated according to the resource occupancy rate of the server cluster and the current time to obtain the updated preset encryption duration, and steps a to c are repeated to continue data encryption until all the initial plaintext data are encrypted and the data encryption is stopped. The preset occupancy rate threshold may be 50%.
[0102] In an optional embodiment, updating the preset encryption duration according to the resource occupancy rate of the server cluster and the current time to obtain an updated preset encryption duration includes:
[0103] Querying the hardware information of the server cluster, and calculating the resource occupancy rate of the server cluster according to the hardware information;
[0104] Calculate the time difference between the current time and the preset reference time;
[0105] Normalizing the resource occupancy rate and the time difference to obtain a normalized resource occupancy rate and a normalized time difference;
[0106] Inputting the normalized resource occupancy rate and the normalized time difference into a preset integration function to calculate the job duration update ratio;
[0107] The product of the preset initial operation duration and the update ratio is calculated as the updated preset encryption duration.
[0108] In this optional embodiment, the resource occupancy rate S of the server cluster can be calculated based on various hardware information in the server cluster. The various hardware information include CPU occupancy rate s1, cache occupancy rate s2, storage occupancy rate s3, and I / O occupancy rate s4. The average of s1, s2, s3, and s4 is calculated as the resource occupancy rate of the server cluster. The smaller the resource occupancy rate, the smaller the load of the server cluster at the current moment, which can increase the data encryption time.
[0109] In this optional embodiment, the time difference between the current time and the preset reference time can be recorded as T. The preset reference time can be 12:00 midnight local time at the location of the server cluster. The smaller the time difference, the later the current time at the location of the server cluster, the lower the data transmission demand, and the longer the data encryption time can be.
[0110] In this optional embodiment, in order to eliminate the dimensional difference between the time difference and the resource occupancy rate, the time difference and the resource occupancy rate can be normalized according to a preset normalization algorithm to obtain a normalized time difference and a normalized resource occupancy rate. The normalized time difference can be recorded as TG, and the normalized resource occupancy rate can be recorded as SG. The preset normalization algorithm can be an existing normalization algorithm such as a maximization algorithm, a minimization algorithm, an inverse tangent function algorithm, an S-shaped growth curve algorithm, etc., and this application does not limit this.
[0111] In this optional embodiment, the normalized time difference and the normalized resource occupancy rate may be input into a preset integration function to calculate the adjustment ratio, and the preset integration function satisfies the following relationship:
[0112]
[0113] Wherein, X represents the adjustment ratio; TG represents the normalized time difference; and SG represents the normalized resource occupancy rate.
[0114] In this optional embodiment, the product of the preset encryption duration and the adjustment ratio X may be calculated as the updated preset encryption duration.
[0115] In this way, data encryption is performed during the time period when the server load is light, and the duration of data encryption is adjusted in real time according to the current time and resource utilization rate of the server cluster, thereby avoiding the negative impact of the data encryption task on data transmission. It is possible to achieve uninterrupted encryption of data during the time period when the server load is light in an asynchronous processing manner, thereby improving the stability of data encryption and data transmission.
[0116] S14, marking the subject identifier of the ciphertext data according to the plaintext data, and distributing the ciphertext data to each of the server nodes for storage according to the index of the ciphertext data and the load value of the server node.
[0117] In an optional embodiment, marking the subject identifier of the ciphertext data according to the plaintext data, and distributing the ciphertext data to each of the server nodes for storage according to the index of the ciphertext data and the load value of the server node, includes:
[0118] Classifying the initial plaintext data according to a pre-trained initial plaintext classification model to obtain a category of each of the initial plaintext data, and using the category as a subject identifier of the ciphertext data corresponding to the initial plaintext data;
[0119] The ciphertext data are sorted in order from early to late according to the index of the ciphertext data to obtain the order of each ciphertext data, and the server nodes are sorted in order from small to large according to the load value to obtain the order of each server node;
[0120] The ciphertext data is distributed to server nodes having the same order for storage.
[0121] In this optional embodiment, the pre-trained initial plaintext classification model can be an existing classification model such as XGBoost (Extreme Gradient Boosting), LightGBM (Light Gradient Boosting Machine), GBDT (Gradient Boosting Decision Tree), etc., and this application does not limit this. The input of the pre-trained initial plaintext classification model is the initial plaintext data, and the output is the category of the initial plaintext data, which includes user order information, user logistics information, and user transaction information.
[0122] In this optional embodiment, the category of the initial plaintext data may be used as the subject identifier of the corresponding ciphertext data.
[0123] In this optional embodiment, the ciphertext data can be sorted in order from early to late according to the index of the ciphertext data. The earlier the index of the ciphertext data, the earlier the ciphertext data is encrypted, and the earlier the ciphertext data can be pushed to the user; and the server nodes can be sorted in order from small to large according to the load value. The smaller the load value, the higher the priority of the server node to process the data.
[0124] In this optional embodiment, the ciphertext data may be distributed to server nodes having the same order for storage.
[0125] In this way, the load value of the server node and the index of the ciphertext data are calculated respectively, the server nodes are sorted according to the load value, and the ciphertext data is sorted according to the index, and the ciphertext data is redistributed to the server nodes with the same order, ensuring that the server cluster is in a load-balanced state, which can improve the stability of the server cluster.
[0126] S15, pushing the plaintext data corresponding to the ciphertext data to the user according to the subject identifier of the ciphertext data.
[0127] In an optional embodiment, the pushing of the plaintext data corresponding to the ciphertext data to the user according to the subject identifier of the ciphertext data includes:
[0128] Query preset categories of user needs, where the categories of user needs include user order information, user logistics information, and user transaction information;
[0129] In each server node of the server cluster, the subject identifiers corresponding to the ciphertext data are queried in order from the latest to the earliest according to the indexes of the ciphertext data. If the subject identifier is consistent with the category of the user requirement, the ciphertext data is decrypted according to a preset secret key to obtain initial plaintext data, and the initial plaintext data is pushed to the user;
[0130] If the subject identifier is inconsistent with the category of the user's requirement, the subject identifier of each ciphertext data is continuously queried until all ciphertext data are queried and then the query is stopped;
[0131] If the ciphertext data corresponding to the category required by the user cannot be found, an information delay prompt is sent to the user.
[0132] In this optional embodiment, the category of the user demand refers to the category of the request for query data sent by the user to the server, and the user demand includes user order information, user logistics information, and user transaction information.
[0133] In this optional embodiment, in each server node of the server cluster, the subject identifier of each ciphertext data can be queried in sequence from late to early according to the index of the ciphertext data. If the subject identifier is consistent with the category of the user demand, the query is stopped and the ciphertext data is decrypted according to the preset secret key to obtain the initial plaintext data, and the initial plaintext data is pushed to the user.
[0134] In this optional embodiment, if the subject identifier is inconsistent with the category of the user requirement, the query continues until all the ciphertext data has been queried.
[0135] In this optional embodiment, if the ciphertext data corresponding to the user's needs are still not found after all the ciphertext data have been queried, an information delay prompt may be sent to the user. For example, the information delay prompt may include: "Your order information is to be updated, please try again later", "Your transaction information is delayed, please check again later", "Your logistics information is still being updated, please check again later".
[0136] In this way, by comparing the user's needs with the subject identifier of the ciphertext data and pushing the corresponding plaintext information to the user, the user's goal can be quickly located to improve the efficiency of the user's information query.
[0137] The above-mentioned artificial intelligence-based data asynchronous processing method divides the plaintext data into multiple batches according to the data size of the initial plaintext data, and distributes the initial plaintext data of multiple batches to the server nodes according to the index of each batch to ensure the load balancing of the server cluster, continuously encrypts the initial plaintext data within the encryption time to obtain the ciphertext data, and continuously updates the encryption time to maintain the stability of the server clusters, and finally marks the subject identifier of each ciphertext data, and uses the subject identifier to push the initial plaintext corresponding to the ciphertext data to the user, which can perform asynchronous processing on data query tasks, thereby improving the efficiency of data query.
[0138] like Figure 2 , which is a functional module diagram of a preferred embodiment of an artificial intelligence-based data asynchronous processing device provided in an embodiment of the present application. The artificial intelligence-based data asynchronous processing device 11 includes a preprocessing unit 110, a batch unit 111, a distribution unit 112, an encryption unit 113, a storage unit 114, and a push unit 115. The module / unit referred to in this application refers to a series of computer program segments that can be executed by the processor 13 and can complete fixed functions, which are stored in the memory 12. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.
[0139] In an optional embodiment, the preprocessing unit 110 is used to preprocess the plaintext data table in the preset server cluster to obtain a plurality of initial plaintext data, each of which corresponds to an auto-increment primary key and a data size.
[0140] In an optional embodiment, the preprocessing unit 110 preprocesses the plaintext data table in the preset server cluster to obtain a plurality of initial plaintext data, including:
[0141] The plaintext data table contains multiple rows and columns, the type of each column of data in the plaintext data table is queried, and the column whose type is not an auto-increment primary key is used as the initial plaintext data, and each initial plaintext data contains multiple dimensions;
[0142] Query the data type and length corresponding to each dimension, and query the data size of each dimension according to the length and the data type;
[0143] The sum of the data sizes corresponding to all dimensions in each of the initial plaintext data is taken as the data size of the initial plaintext data.
[0144] In this optional embodiment, the function of the server cluster is to store plaintext data and forward data. The server cluster includes multiple server nodes, and data can be transmitted between each server node.
[0145] In this optional embodiment, the plaintext data in the server cluster is stored in the format of a plaintext data table, and the plaintext data table contains n rows and m columns, where n and m are both integers greater than 1, and each row in the plaintext data table corresponds to a plaintext data, and each column corresponds to a feature in the plaintext data.
[0146] In this optional embodiment, the data type of each column of data in the plaintext data table can be queried, and the column whose type is not an auto-increment primary key is used as the initial plaintext data, and each initial plaintext data contains multiple dimensions. The data types include auto increment primary key, varchar (string), int (integer value), float (single-precision floating point), and double (double-precision floating point).
[0147] In this optional embodiment, the value of the auto-increment primary key is a positive integer, and the difference between two adjacent auto-increment primary keys is 1. The higher the value of the auto-increment primary key, the earlier the plaintext data corresponding to the auto-increment primary key is stored in the server cluster, and the more priority the plaintext data should be encrypted.
[0148] In this optional embodiment, the data type and length corresponding to each dimension can be queried, and the data size of each dimension can be queried based on the length and the data type. Exemplarily, when the category is varchar, the size of the dimension data is length + 1; when the category is int, the size of the dimension data is 4 bytes; when the category is double, the size of the dimension data is 8 bytes; when the category is float, the size of the dimension data is 4 bytes.
[0149] In this optional embodiment, the sum of the data sizes of all dimensions in each plaintext data may be calculated as the data size corresponding to the plaintext data. The larger the data size, the larger the storage space occupied by the plaintext data in the server cluster, and the more time-consuming it is to encrypt the plaintext data.
[0150] In an optional embodiment, the batching unit 111 is used to divide the initial plaintext data into multiple batches according to the auto-increment primary key and the data size, and each batch contains multiple initial plaintext data.
[0151] In an optional embodiment, the batching unit 111 divides the initial plaintext data into multiple batches according to the auto-increment primary key and the data size, including:
[0152] a. The initial plaintext data is evenly divided into a plurality of candidate batches according to a preset division threshold, each candidate batch contains a plurality of initial plaintext data, and the number of the candidate batches is equal to the division threshold. For example, the preset division threshold can be initially set to 20, and 20 candidate batches can be obtained.
[0153] b. Calculate the sum of the data sizes of all initial plaintext data in each candidate batch as the evaluation value of the batch.
[0154] c. Calculate the variance of all the evaluation values. If the variance is less than a preset first termination threshold, it indicates that the difference between the data sizes included in the candidate batches is small. Then, the multiple candidate batches can be used as the final multiple batches to complete the batching of the initial plaintext data. If the variance is not less than the preset first termination threshold, it indicates that the difference between the data sizes included in all candidate batches is large. Then, update the preset partitioning threshold to obtain an updated partitioning threshold. Repeat steps a to c to obtain multiple batches of initial plaintext data. The preset first termination threshold may be 0.001. The updating of the preset partitioning threshold may be to reduce the preset partitioning threshold by 1.
[0155] d. If the final batches are still not obtained after the number of repeated divisions reaches a preset second termination threshold, the multiple candidate batches with the smallest variance can be used as the final batches, and the preset second termination threshold is equal to the initial value of the preset division threshold.
[0156] In an optional embodiment, the distribution unit 112 is used to calculate the load value of each server node in the server cluster, and distribute the multiple batches of initial plaintext data to the server node according to the load value.
[0157] In an optional embodiment, the distribution unit 112 calculates a load value of each server node in the server cluster, and distributes the multiple batches of initial plaintext data to the server node according to the load value, including:
[0158] Querying the number of tasks processed by each server node in the server cluster as a load value of each server node;
[0159] The minimum value of the auto-increment primary key corresponding to all initial plaintext data in each batch is used as the index of the batch;
[0160] The batches are sorted in ascending order according to the indexes, and the server nodes are sorted in ascending order according to the load values;
[0161] The batches are sent to a server node having the same order for subsequent data encryption processing.
[0162] The fewer the number of processing tasks of the server node is, the lower the load of the server node is, and the server node should be assigned data processing tasks with higher priority, wherein the data processing tasks include data encryption and data transmission.
[0163] In this optional embodiment, the smaller the index is, the earlier all the initial plaintext data in the batch corresponding to the index are stored in the server cluster, and the initial plaintext data in the batch should be encrypted first.
[0164] In an optional embodiment, the encryption unit 113 is used to encrypt the initial plaintext data according to a preset encryption duration to obtain ciphertext data and an index of the ciphertext data.
[0165] In an optional embodiment, the encryption unit 113 encrypts the initial plaintext data according to a preset encryption duration to obtain ciphertext data and an index of the ciphertext data, including:
[0166] a. Encrypt the initial plaintext data within a preset encryption time to obtain ciphertext data. The preset encryption time can be 2 hours, 3 hours, 4 hours, etc., and this application does not limit this.
[0167] In this optional embodiment, for the initial plaintext data in each server node, the initial plaintext data can be encrypted in ascending order according to the self-incrementing primary key of the initial plaintext data within a preset encryption time range to obtain the ciphertext data corresponding to each initial plaintext data. The encryption method can be an existing encryption algorithm such as the RSA encryption algorithm, and this application does not limit this.
[0168] b. In order to avoid excessive server load caused by long-term execution of large-scale data encryption tasks, data encryption is suspended when the preset encryption time ends to obtain multiple ciphertext data. The moment when each ciphertext data is encrypted can be recorded separately as the index of the ciphertext data.
[0169] c. In order to restart the data encryption task when the server load is low to realize asynchronous data processing, when the preset encryption duration ends and the initial plaintext data is still not encrypted, the resource occupancy rate of the server cluster is continuously compared with the preset occupancy rate threshold. If the occupancy rate is lower than the preset occupancy rate threshold, the preset encryption duration is updated according to the resource occupancy rate of the server cluster and the current time to obtain the updated preset encryption duration, and steps a to c are repeated to continue data encryption until all the initial plaintext data are encrypted and the data encryption is stopped. The preset occupancy rate threshold may be 50%.
[0170] In an optional embodiment, updating the preset encryption duration according to the resource occupancy rate of the server cluster and the current time to obtain an updated preset encryption duration includes:
[0171] Querying the hardware information of the server cluster, and calculating the resource occupancy rate of the server cluster according to the hardware information;
[0172] Calculate the time difference between the current time and the preset reference time;
[0173] Normalizing the resource occupancy rate and the time difference to obtain a normalized resource occupancy rate and a normalized time difference;
[0174] Inputting the normalized resource occupancy rate and the normalized time difference into a preset integration function to calculate the job duration update ratio;
[0175] The product of the preset initial operation duration and the update ratio is calculated as the updated preset encryption duration.
[0176] In this optional embodiment, the resource occupancy rate S of the server cluster can be calculated based on various hardware information in the server cluster. The various hardware information include CPU occupancy rate s1, cache occupancy rate s2, storage occupancy rate s3, and I / O occupancy rate s4. The average of s1, s2, s3, and s4 is calculated as the resource occupancy rate of the server cluster. The smaller the resource occupancy rate, the smaller the load of the server cluster at the current moment, which can increase the data encryption time.
[0177] In this optional embodiment, the time difference between the current time and the preset reference time can be recorded as T. The preset reference time can be 12:00 midnight local time at the location of the server cluster. The smaller the time difference, the later the current time at the location of the server cluster, the lower the data transmission demand, and the longer the data encryption time can be.
[0178] In this optional embodiment, in order to eliminate the dimensional difference between the time difference and the resource occupancy rate, the time difference and the resource occupancy rate can be normalized according to a preset normalization algorithm to obtain a normalized time difference and a normalized resource occupancy rate. The normalized time difference can be recorded as TG, and the normalized resource occupancy rate can be recorded as SG. The preset normalization algorithm can be an existing normalization algorithm such as a maximization algorithm, a minimization algorithm, an inverse tangent function algorithm, an S-shaped growth curve algorithm, etc., and this application does not limit this.
[0179] In this optional embodiment, the normalized time difference and the normalized resource occupancy rate may be input into a preset integration function to calculate the adjustment ratio, and the preset integration function satisfies the following relationship:
[0180]
[0181] Wherein, X represents the adjustment ratio; TG represents the normalized time difference; and SG represents the normalized resource occupancy rate.
[0182] In this optional embodiment, the product of the preset encryption duration and the adjustment ratio X may be calculated as the updated preset encryption duration.
[0183] In an optional embodiment, the storage unit 114 is used to mark the subject identifier of the ciphertext data according to the plaintext data, and distribute the ciphertext data to each server node for storage according to the index of the ciphertext data and the load value of the server node.
[0184] In an optional embodiment, the storage unit 114 marks the subject identifier of the ciphertext data according to the plaintext data, and distributes the ciphertext data to each of the server nodes for storage according to the index of the ciphertext data and the load value of the server node, including:
[0185] Classifying the initial plaintext data according to a pre-trained initial plaintext classification model to obtain a category of each of the initial plaintext data, and using the category as a subject identifier of the ciphertext data corresponding to the initial plaintext data;
[0186] Sorting the ciphertext data in order from earliest to latest according to the index of the ciphertext data, and sorting the server nodes in order from smallest to largest according to the load value;
[0187] The ciphertext data is distributed to server nodes having the same order for storage.
[0188] In this optional embodiment, the pre-trained initial plaintext classification model can be an existing classification model such as XGBoost (Extreme Gradient Boosting), LightGBM (Light Gradient Boosting Machine), GBDT (Gradient Boosting Decision Tree), etc., and this application does not limit this. The input of the pre-trained initial plaintext classification model is the initial plaintext data, and the output is the category of the initial plaintext data, which includes user order information, user logistics information, and user transaction information.
[0189] In this optional embodiment, the category of the initial plaintext data may be used as the subject identifier of the corresponding ciphertext data.
[0190] In this optional embodiment, the ciphertext data can be sorted in order from early to late according to the index of the ciphertext data. The earlier the index of the ciphertext data, the earlier the ciphertext data is encrypted, and the earlier the ciphertext data can be pushed to the user; and the server nodes can be sorted in order from small to large according to the load value. The smaller the load value, the higher the priority of the server node to process the data.
[0191] In this optional embodiment, the ciphertext data may be distributed to server nodes having the same order for storage.
[0192] In an optional embodiment, the push unit 115 is used to push the plaintext data corresponding to the ciphertext data to the user according to the subject identifier of the ciphertext data.
[0193] In an optional embodiment, the pushing unit 115 pushes the plaintext data corresponding to the ciphertext data to the user according to the subject identifier of the ciphertext data, including:
[0194] Query preset categories of user needs, where the categories of user needs include user order information, user logistics information, and user transaction information;
[0195] In each server node of the server cluster, the subject identifiers corresponding to the ciphertext data are queried in order from the latest to the earliest according to the indexes of the ciphertext data. If the subject identifier is consistent with the category of the user requirement, the ciphertext data is decrypted according to a preset secret key to obtain initial plaintext data, and the initial plaintext data is pushed to the user;
[0196] If the subject identifier is inconsistent with the category of the user's requirement, the subject identifier of each ciphertext data is continuously queried until all ciphertext data are queried and then the query is stopped;
[0197] If the ciphertext data corresponding to the category required by the user cannot be found, an information delay prompt is sent to the user.
[0198] In this optional embodiment, the category of the user demand refers to the category of the request for query data sent by the user to the server, and the user demand includes user order information, user logistics information, and user transaction information.
[0199] In this optional embodiment, in each server node of the server cluster, the subject identifier of each ciphertext data can be queried in sequence from late to early according to the index of the ciphertext data. If the subject identifier is consistent with the category of the user demand, the query is stopped and the ciphertext data is decrypted according to the preset secret key to obtain the initial plaintext data, and the initial plaintext data is pushed to the user.
[0200] In this optional embodiment, if the subject identifier is inconsistent with the category of the user requirement, the query continues until all the ciphertext data has been queried.
[0201] In this optional embodiment, if the ciphertext data corresponding to the user's needs are still not found after all the ciphertext data have been queried, an information delay prompt may be sent to the user. For example, the information delay prompt may include: "Your order information is to be updated, please try again later", "Your transaction information is delayed, please check again later", "Your logistics information is still being updated, please check again later".
[0202] The above-mentioned artificial intelligence-based data asynchronous processing device divides the plaintext data into multiple batches according to the data size of the initial plaintext data, and distributes the initial plaintext data of multiple batches to the server nodes according to the index of each batch to ensure the load balancing of the server cluster, continuously encrypts the initial plaintext data within the encryption time to obtain the ciphertext data, and continuously updates the encryption time to maintain the stability of the server clusters, and finally marks the subject identifier of each ciphertext data, and uses the subject identifier to push the initial plaintext corresponding to the ciphertext data to the user, which can perform asynchronous processing on data query tasks, thereby improving the efficiency of data query.
[0203] like Figure 3 , which is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device 1 includes a memory 12 and a processor 13. The memory 12 is used to store computer-readable instructions, and the processor 13 executes the computer-readable instructions stored in the memory to implement the data asynchronous processing method based on artificial intelligence in any of the above embodiments.
[0204] In an optional embodiment, the electronic device 1 further includes a bus, a computer program stored in the memory 12 and executable on the processor 13, such as an artificial intelligence-based data asynchronous processing program.
[0205] Figure 3 Only the electronic device 1 having components 12-13 is shown, and those skilled in the art will understand that Figure 3 The structure shown does not constitute a limitation on the electronic device 1 , and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0206] Combination Figure 1 The memory 12 in the electronic device 1 stores a plurality of computer-readable instructions to implement an artificial intelligence-based data asynchronous processing method, and the processor 13 can execute the plurality of instructions to implement:
[0207] Preprocess the plaintext data table in the preset server cluster to obtain multiple initial plaintext data, each initial plaintext data corresponds to an auto-increment primary key and a data size;
[0208] Dividing the initial plaintext data into multiple batches according to the auto-increment primary key and the data size, each batch containing multiple initial plaintext data;
[0209] The server cluster includes a plurality of server nodes, a load value of each server node in the server cluster is calculated, and the plurality of batches of initial plaintext data are distributed to the server nodes according to the load value;
[0210] Encrypting the initial plaintext data according to a preset encryption duration to obtain ciphertext data and an index of the ciphertext data;
[0211] Marking the subject identifier of the ciphertext data according to the plaintext data, and distributing the ciphertext data to each of the server nodes for storage according to the index of the ciphertext data and the load value of the server node;
[0212] The plaintext data corresponding to the ciphertext data is pushed to the user according to the subject identifier of the ciphertext data.
[0213] Specifically, the specific implementation method of the processor 13 for the above instructions can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0214] Those skilled in the art will appreciate that the schematic diagram is merely an example of the electronic device 1 and does not constitute a limitation on the electronic device 1. The electronic device 1 may have either a bus structure or a star structure. The electronic device 1 may also include more or less other hardware or software than shown in the diagram, or a different arrangement of components. For example, the electronic device 1 may also include input and output devices, network access devices, etc.
[0215] It should be noted that the electronic device 1 is only an example, and other existing or future electronic products that are suitable for the present application should also be included in the protection scope of the present application and included here by reference.
[0216] Among them, the memory 12 includes at least one type of readable storage medium, and the readable storage medium can be non-volatile or volatile. The readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 12 can be an internal storage unit of the electronic device 1, such as a mobile hard disk of the electronic device 1. In other embodiments, the memory 12 can also be an external storage device of the electronic device 1, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 1. Further, the memory 12 can also include both an internal storage unit of the electronic device 1 and an external storage device. The memory 12 can not only be used to store application software and various types of data installed in the electronic device 1, such as the code of the data asynchronous processing program based on artificial intelligence, but also can be used to temporarily store data that has been output or is to be output.
[0217] In some embodiments, the processor 13 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 13 is the control core (Control Unit) of the electronic device 1, and uses various interfaces and lines to connect the various components of the entire electronic device 1, and executes or executes programs or modules stored in the memory 12 (for example, executing data asynchronous processing programs based on artificial intelligence, etc.), and calls data stored in the memory 12 to execute various functions of the electronic device 1 and process data.
[0218] The processor 13 executes the operating system of the electronic device 1 and various installed applications. The processor 13 executes the applications to implement the steps in the above-mentioned embodiments of the asynchronous data processing method based on artificial intelligence, for example Figure 1 Steps shown.
[0219] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory 12 and executed by the processor 13 to complete the present application. The one or more modules / units may be a series of computer-readable instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the electronic device 1. For example, the computer program may be divided into a pre-processing unit 110, a batching unit 111, a distribution unit 112, an encryption unit 113, a storage unit 114, and a push unit 115.
[0220] The above-mentioned integrated unit implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a computer device, or a network device, etc.) or a processor to execute a part of the data asynchronous processing method based on artificial intelligence described in each embodiment of the present application.
[0221] If the module / unit integrated in the electronic device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also instruct the relevant hardware devices to complete through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by the processor, the steps of each of the above-mentioned method embodiments can be implemented.
[0222] The computer program includes computer program code, which may be in source code form, object code form, executable file or some intermediate form, 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 and other memory, etc.
[0223] Furthermore, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.
[0224] The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0225] The bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. Figure 3 Only one arrow is used in the figure, but it does not mean that there is only one bus or one type of bus. The bus is configured to realize the connection and communication between the memory 12 and at least one processor 13, etc.
[0226] Although not shown, the electronic device 1 may also include a power source (such as a battery) for supplying power to each component. Preferably, the power source may be logically connected to the at least one processor 13 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include any components such as one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, and power status indicators. The electronic device 1 may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be described in detail here.
[0227] Furthermore, the electronic device 1 may also include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device 1 and other electronic devices.
[0228] Optionally, the electronic device 1 may further include a user interface, which may be a display, an input unit (such as a keyboard), or a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch device. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device 1 and to display a visual user interface.
[0229] An embodiment of the present application also provides a computer-readable storage medium (not shown), in which computer-readable storage medium is stored computer-readable instructions, and the computer-readable instructions are executed by a processor in an electronic device to implement the artificial intelligence-based data asynchronous processing method described in any of the above embodiments.
[0230] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0231] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0232] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0233] In addition, each functional module in each embodiment of the present application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0234] In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the specification can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any specific order.
[0235] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present application and are not intended to limit it. Although the present application has been described in detail with reference to the preferred embodiments, a person of ordinary skill in the art should understand that the technical solution of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present application.
Claims
1. A data asynchronous processing method based on artificial intelligence, It is characterized in that The method comprises: Preprocess the plaintext data table in the preset server cluster to obtain multiple initial plaintext data, each initial plaintext data corresponds to an auto-increment primary key and a data size; Dividing the initial plaintext data into multiple batches according to the auto-increment primary key and the data size, each batch containing multiple initial plaintext data; Calculating a load value of each server node in the server cluster, and distributing the multiple batches of initial plaintext data to the server nodes according to the load value; The initial plaintext data is encrypted according to a preset encryption duration to obtain ciphertext data and an index of the ciphertext data, including: a. The initial plaintext data is encrypted within a preset encryption duration to obtain ciphertext data; b. When the preset encryption duration ends, data encryption is suspended, and the moment when each ciphertext data is encrypted is recorded as the index of the ciphertext data; c. If the initial plaintext data is still not encrypted after the preset encryption duration ends, the resource occupancy rate of the server cluster is continuously compared with a preset occupancy rate threshold value. If the occupancy rate is lower than the preset occupancy rate threshold value, the preset encryption duration is updated according to the resource occupancy rate of the server cluster and the current moment to obtain an updated preset encryption duration, and steps are repeated. a to c to continuously encrypt data until all initial plaintext data are encrypted and then stop encrypting data; wherein, the updating of the preset encryption duration according to the resource occupancy rate of the server cluster and the current moment to obtain the updated preset encryption duration comprises: querying the hardware information of the server cluster, and calculating the resource occupancy rate of the server cluster according to the hardware information; calculating the time difference between the current moment and the preset reference moment; normalizing the resource occupancy rate and the time difference to obtain the normalized resource occupancy rate and the normalized time difference; inputting the normalized resource occupancy rate and the normalized time difference into the preset integration function to calculate the job duration update ratio; calculating the product of the preset initial job duration and the update ratio as the updated preset encryption duration; Marking the subject identifier of the ciphertext data according to the plaintext data, and distributing the ciphertext data to each of the server nodes for storage according to the index of the ciphertext data and the load value of the server node; The plaintext data corresponding to the ciphertext data is pushed to the user according to the subject identifier of the ciphertext data.
2. The method for asynchronous data processing based on artificial intelligence as claimed in claim 1, It is characterized in that The preprocessing of the plaintext data table in the preset server cluster to obtain a plurality of initial plaintext data includes: The plaintext data table contains multiple rows and columns, the data type of each column in the plaintext data table is queried, and the column whose type is not an auto-increment primary key is used as the initial plaintext data, and each initial plaintext data contains multiple dimensions; Query the data type and length corresponding to each dimension, and query the data size of each dimension according to the length and the data type; The sum of the data sizes corresponding to all dimensions in each of the initial plaintext data is taken as the data size of the initial plaintext data.
3. The method for asynchronous data processing based on artificial intelligence as claimed in claim 1, It is characterized in that The step of dividing the initial plaintext data into multiple batches according to the auto-increment primary key and the data size includes: a. Evenly dividing the initial plaintext data into a plurality of candidate batches according to a preset division threshold, each candidate batch containing a plurality of initial plaintext data, and the number of the candidate batches is equal to the division threshold; b. Calculate the sum of the data sizes of all initial plaintext data in each candidate batch as the evaluation value of the batch; c. Calculate the variance of all the evaluation values. If the variance is less than a preset first termination threshold, it indicates that the difference between the data sizes included in the candidate batches is small. Then, use the multiple candidate batches as the final multiple batches to complete the batching of the initial plaintext data. If the variance is not less than the preset first termination threshold, it indicates that the difference between the data sizes included in all the candidate batches is large. Then, update the partitioning threshold to obtain an updated partitioning threshold. Repeat steps a to c to obtain multiple batches of initial plaintext data. d. If the final batches are still not obtained after the number of repeated divisions reaches a preset second termination threshold, the multiple candidate batches with the smallest variance are taken as the final batches, and the preset second termination threshold is equal to the initial value of the preset division threshold.
4. The method for asynchronous data processing based on artificial intelligence according to claim 1, It is characterized in that The calculating the load value of each server node in the server cluster, and distributing the multiple batches of initial plaintext data to the server nodes according to the load value, comprises: Querying the number of tasks processed by each server node in the server cluster as a load value of each server node; The minimum value of the auto-increment primary key corresponding to all initial plaintext data in each batch is used as the index of the batch; The batches are sorted in ascending order according to the indexes to obtain the order of each batch, and the server nodes are sorted in ascending order according to the load values to obtain the order of each server node; The batches are sent to a server node having the same order for subsequent data encryption processing.
5. The method for asynchronous data processing based on artificial intelligence as claimed in claim 1, It is characterized in that The method of marking the subject identifier of the ciphertext data according to the plaintext data and distributing the ciphertext data to each of the server nodes for storage according to the index of the ciphertext data and the load value of the server node includes: Classifying the initial plaintext data according to a pre-trained initial plaintext classification model to obtain a category of each of the initial plaintext data, and using the category as a subject identifier of the ciphertext data corresponding to the initial plaintext data; The ciphertext data are sorted in order from early to late according to the index of the ciphertext data to obtain the order of each ciphertext data, and the server nodes are sorted in order from small to large according to the load value to obtain the order of each server node; The ciphertext data is distributed to server nodes having the same order for storage.
6. The method for asynchronous data processing based on artificial intelligence according to claim 1, It is characterized in that The pushing of the plaintext data corresponding to the ciphertext data to the user according to the subject identifier of the ciphertext data includes: Query preset categories of user needs, where the categories of user needs include user order information, user logistics information, and user transaction information; In each server node of the server cluster, the subject identifiers corresponding to the ciphertext data are queried in order from the latest to the earliest according to the indexes of the ciphertext data. If the subject identifier is consistent with the category of the user requirement, the ciphertext data is decrypted according to a preset secret key to obtain initial plaintext data, and the initial plaintext data is pushed to the user; If the subject identifier is inconsistent with the category of the user's requirement, the subject identifier of each ciphertext data is continuously queried until all ciphertext data are queried and then the query is stopped; If the ciphertext data corresponding to the category required by the user cannot be found, an information delay prompt is sent to the user.
7. An asynchronous data processing device based on artificial intelligence, It is characterized in that The device comprises a unit for implementing the method according to any one of claims 1 to 6, the device comprising: A preprocessing unit, used for preprocessing a plaintext data table in a preset server cluster to obtain a plurality of initial plaintext data, each of which corresponds to an auto-increment primary key and a data size; A batching unit, used for dividing the initial plaintext data into a plurality of batches according to the auto-increment primary key and the data size, each batch containing a plurality of initial plaintext data; A distribution unit, for the server cluster including a plurality of server nodes, calculating a load value of each server node in the server cluster, and distributing the plurality of batches of initial plaintext data to the server nodes according to the load value; An encryption unit, used to encrypt the initial plaintext data according to a preset encryption duration to obtain ciphertext data and an index of the ciphertext data; A storage unit, used for marking a subject identifier of the ciphertext data according to the plaintext data, and distributing the ciphertext data to each of the server nodes for storage according to an index of the ciphertext data and a load value of the server node; The push unit is used to push the plaintext data corresponding to the ciphertext data to the user according to the subject identifier of the ciphertext data.
8. An electronic device, It is characterized in that The electronic device comprises: a memory storing computer readable instructions; and A processor executes computer-readable instructions stored in the memory to implement the artificial intelligence-based data asynchronous processing method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, Features: The computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions are executed by a processor in an electronic device to implement the artificial intelligence-based data asynchronous processing method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Product collaborative development system and method adopting optimum distribution of resources
CN104580440A
Blockchain-based distributed message sending and receiving methods and devices
CN109474597A