A data processing method and device
Through real-time serialization processing and field length division, combined with data cleaning and caching operations, the problems of low computing efficiency and large resource occupation in the existing technology are solved, and the effect of improving data processing efficiency and reducing system performance loss is achieved.
Patent Information
- Application Number
- CN202010564944.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-19
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2040-06-19
AI Technical Summary
The calculation efficiency in the data processing process in the prior art is low and the amount of calculation is large, which leads to increased system performance loss. When the data packet to be transmitted is too large, too much memory space is occupied, causing system resources to be occupied.
By obtaining the target data in real time for serialization processing, it is divided into fixed-length field data and variable-length field data. The field length of the data set is determined based on the field length accuracy, and the data is cleaned before data transmission. If the field length is less than or equal to the transmission The threshold performs caching operations and performs transmission processing according to the transmission protocol.
It improves the computing efficiency during data processing, reduces the amount of calculation and system performance loss, and at the same time frees up memory space and saves system resources.
Smart Images

Figure CN113760630B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a data processing method and device. Background Art
[0002] With the rapid development of the information age, people have higher and higher requirements for the speed and quantity of obtaining information. However, the transmission of large amounts of data can easily cause excessive system load and lead to risks such as downtime. In order to deal with the above problems, existing methods often use rate limiting tools such as RateLimiter (applied to guava (an open source Java library)), which constrains the maximum number of accesses within a period of time).
[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:
[0004] The existing method needs to wait for the transmission data packet to be assembled before accurately calculating it, which has low calculation efficiency and large amount of calculation, increasing system performance loss; and when the data packet to be transmitted is too large, it takes up too much memory space, resulting in a large amount of system resources being occupied. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a data processing method and device, which can improve the computing efficiency in the data processing process, reduce the amount of calculation, reduce system performance loss, and at the same time release memory space and save system resources.
[0006] To achieve the above object, according to a first aspect of an embodiment of the present invention, a data processing method is provided, comprising:
[0007] Acquire target data in real time and perform serialization processing on the target data;
[0008] Place the serialized target data into a data set and determine the field length corresponding to the data set;
[0009] Determine whether the field length corresponding to the data set is less than or equal to the data transmission threshold;
[0010] If so, a cache operation is performed on the data set, and the data set on which the cache operation is performed is transmitted according to the transmission protocol.
[0011] Furthermore, the target data after serialization is placed in a data set, and the step of determining the field length corresponding to the data set includes: placing the target data after serialization in a data set, dividing the target data into fixed-length field data and variable-length field data according to the data type, and determining the field length corresponding to the data set according to the field lengths corresponding to the fixed-length field data and the variable-length field data.
[0012] Furthermore, the step of determining the field length corresponding to the data set based on the field lengths corresponding to the fixed-length field data and the variable-length field data also includes: determining the field length accuracy based on the field length of the fixed-length field data and the field length of the variable-length field data, and when the field length accuracy is greater than or equal to the accuracy threshold, using the field length corresponding to the variable-length field data as the field length corresponding to the data set.
[0013] Furthermore, before the step of determining whether the field length of the data set is less than or equal to the data transmission threshold, the data processing method also includes: performing data cleaning on the target data in the data set according to the data attributes corresponding to the target data and the field length threshold, wherein the data attributes indicate the business type corresponding to the target data.
[0014] Furthermore, the data processing method also includes: determining whether the target data for data cleaning is variable-length field data, and if so, adjusting the field length of the data set after data cleaning.
[0015] Furthermore, when the field length of the data set is greater than the data transmission threshold, the data processing method further includes: triggering a current limiting rule and stopping the cache operation on the data set.
[0016] According to a second aspect of an embodiment of the present invention, there is provided a data processing device, including:
[0017] The target data acquisition module is used to acquire the target data in real time and perform serialization processing on the target data;
[0018] A field length determination module is used to place the serialized target data into a data set and determine the field length corresponding to the data set;
[0019] A judgment module, used to judge whether the field length corresponding to the data set exceeds the data transmission threshold;
[0020] The processing module is used to perform a cache operation on the data set when the field length corresponding to the data set is less than or equal to the data transmission threshold, and perform transmission processing on the data set performing the cache operation according to the transmission protocol.
[0021] Furthermore, the field length determination module is also used to: divide the target data into fixed-length field data and variable-length field data according to the data type, determine the field length accuracy according to the field length of the fixed-length field data and the field length of the variable-length field data, and when the field length accuracy is greater than or equal to the accuracy threshold, use the field length corresponding to the variable-length field data as the field length corresponding to the data set.
[0022] According to a third aspect of an embodiment of the present invention, there is provided an electronic device, including:
[0023] one or more processors;
[0024] a storage device for storing one or more programs,
[0025] When one or more programs are executed by one or more processors, the one or more processors implement any of the above-mentioned data processing methods.
[0026] According to a fourth aspect of an embodiment of the present invention, there is provided a computer-readable medium on which a computer program is stored. When the program is executed by a processor, any of the above-mentioned data processing methods is implemented.
[0027] An embodiment of the above invention has the following advantages or beneficial effects: because the target data is acquired in real time, the target data is serialized; the serialized target data is placed in a data set, and the field length corresponding to the data set is determined; it is determined whether the field length corresponding to the data set is less than or equal to the data transmission threshold; if so, a cache operation is performed on the data set, and the data set performing the cache operation is transmitted and processed according to the transmission protocol. Therefore, the existing method overcomes the problem that the method needs to wait for the transmission data packet to be assembled before performing accurate calculations, which has low calculation efficiency and large amount of calculation, thereby increasing system performance loss; and when the data packet to be transmitted is too large, it occupies too much memory space, resulting in a large amount of system resources being occupied. The technical problem is achieved, thereby improving the calculation efficiency in the data processing process, reducing the amount of calculation, reducing system performance loss, and releasing memory space to save system resources.
[0028] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0030] Figure 1 is a schematic diagram of the main flow of a data processing method provided according to a first embodiment of the present invention;
[0031] Figure 2a is a schematic diagram of the main flow of a data processing method provided according to a second embodiment of the present invention;
[0032] Figure 2b yes Figure 2a A schematic diagram of the current limiter corresponding to the data processing method used in an application program;
[0033] Figure 2c yes Figure 2aA schematic diagram of main modules of a data processing device corresponding to the data processing method;
[0034] Figure 2d yes Figure 2a A schematic diagram of a process of obtaining target data and serializing the target data in the data processing method;
[0035] Figure 2e yes Figure 2a A schematic diagram of dividing the target data into fixed-length field data and variable-length field data in the data processing method;
[0036] Figure 2f yes Figure 2a A schematic diagram of a data packet provided by the data processing method;
[0037] Figure 3 is a schematic diagram of main modules of a data processing device provided according to an embodiment of the present invention;
[0038] Figure 4 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0039] Figure 5 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0040] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0041] Figure 1 is a schematic diagram of the main flow of the data processing method provided according to the first embodiment of the present invention; Figure 1 As shown, the data processing method provided by the embodiment of the present invention mainly includes:
[0042] Step S101, acquiring target data in real time and performing serialization processing on the target data.
[0043] Specifically, according to an embodiment of the present invention, by acquiring target data (such as cache object data, transmission object data) in real time, it is beneficial to use an incremental calculation method to determine the field length corresponding to the data set in the subsequent process of assembling the target data into a data set, thereby improving the calculation efficiency of the data set and further improving the efficiency of subsequent data transmission.
[0044] Serialization: refers to the process of converting the state information of an object into a form that can be stored or transmitted.
[0045] Step S102, placing the serialized target data into a data set, and determining the field length corresponding to the data set.
[0046] According to an embodiment of the present invention, the above-mentioned step of placing the serialized target data in a data set and determining the field length corresponding to the data set includes: placing the serialized target data in a data set, dividing the target data into fixed-length field data and variable-length field data according to the data type, and determining the field length corresponding to the data set according to the field lengths corresponding to the fixed-length field data and the variable-length field data.
[0047] Specifically, in the software development process, many development languages provide a rich variety of data types. According to the number of bytes occupied by different data types, the target data can be divided into fixed-length field data (such as target data with data types such as Boolean, integer, long integer, floating point number, etc.) and variable-length field data (such as target data with data types such as string).
[0048] Through the above settings, the target data is divided into fixed-length field data and variable-length field data according to the data type, wherein the corresponding field length of the fixed-length field data is fixed, and the field length corresponding to the fixed-length field data can be determined according to the byte length occupied by the specific data type; and for the variable-length field length, since the corresponding field length is not fixed, it needs to be calculated according to the specific stored content. Through the above settings, the calculation method of the field length of some target data is simplified, that is, the field length in the data set can be estimated, which reduces the amount of calculation before data transmission and improves the calculation efficiency.
[0049] Further, according to an embodiment of the present invention, the above-mentioned step of determining the field length corresponding to the data set based on the field lengths corresponding to the fixed-length field data and the variable-length field data also includes: determining the field length accuracy based on the field length of the fixed-length field data and the field length of the variable-length field data, and when the field length accuracy is greater than or equal to the accuracy threshold, using the field length corresponding to the variable-length field data as the field length corresponding to the data set.
[0050] In actual applications, the triggering of current limiting operations in many business scenarios is performed within a certain range. Therefore, the field length of the data to be transmitted (i.e., the data set containing the target data) does not need to be accurately calculated. Through the above settings, as long as the accuracy of the field length corresponding to the current limiting operation is met in the business scenario, only the field length corresponding to the variable-length field data is calculated, and this is used as the field length corresponding to the data set, which further reduces the amount of calculation for assembling data packets (i.e., data sets) before data transmission, improves calculation efficiency, and reduces system performance loss.
[0051] Current limiting operation: refers to the operation of limiting the transmission data flow when the amount of data is too large during data transmission, which puts great pressure on data bandwidth and system performance, and there is also a risk of system downtime. In order to reduce system pressure, the operation of limiting the transmission data flow is adopted.
[0052] According to a specific implementation of the embodiment of the present invention, the field length accuracy rate may be determined by utilizing the ratio of the field length of the variable-length field data to the total field length of the variable-length field data and the fixed-length field data.
[0053] It should be noted that the above field length accuracy is set based on the fact that in most cases, the field length corresponding to the variable-length field data is much larger than the field length corresponding to the fixed-length field data. If, in a certain data set, the field length corresponding to the fixed-length field data is much larger than the field length of the variable-length field data, the method for determining the field length accuracy should also be adaptively adjusted.
[0054] Step S103: determine whether the field length corresponding to the data set is less than or equal to the data transmission threshold.
[0055] In the above settings, the data transmission threshold can be determined according to actual conditions (such as bandwidth, signal strength, server resources, etc.).
[0056] Specifically, according to an embodiment of the present invention, before the step of determining whether the field length of a data set is less than or equal to a data transmission threshold, the data processing method further includes: performing data cleaning on the target data in the data set according to data attributes corresponding to the target data and a field length threshold, wherein the data attributes indicate a business type corresponding to the target data.
[0057] Exemplarily, for data transmission of monitoring services, the system operation logs, server resources and other data of the business system obtained are non-business data unrelated to the monitoring business, and their priority and importance are relatively low. Therefore, the target data of this data attribute can be discarded (i.e., the above-mentioned data cleaning is performed). According to a specific implementation of an embodiment of the present invention, for a data packet (such as a subset of a data set) whose corresponding field length exceeds the field length threshold, that is, the data packet is very large, which not only requires the memory space of the business system, but also occupies a large network overhead in the subsequent data transmission process, and at the same time causes the risk of the field length corresponding to the data set exceeding the data transmission threshold, the target data can also be cleaned to release memory space and save system resources.
[0058] Furthermore, according to an embodiment of the present invention, the data processing method further includes: determining whether the target data for data cleaning is variable-length field data, and if so, adjusting the field length of the data set after data cleaning.
[0059] After the target data in the data set is cleaned, the field length corresponding to the data set will change accordingly. However, in most of the business scenarios mentioned above, the triggering and executing of the current limiting operation is performed within a certain range. The field length of the data to be transmitted (i.e., the data set containing the target data) does not need to be accurately calculated. Therefore, the field length corresponding to the data set can be estimated by calculating the field length corresponding to the variable-length field data to reduce the amount of calculation and improve the calculation efficiency. Through the above settings, since the field length corresponding to the data set will definitely change after data cleaning, by judging whether the object of data cleaning is variable-length field data, it can be determined whether the field length corresponding to the data set needs to be recalculated. In the case where the target data for data cleaning is fixed-length field data, the field length corresponding to the data set can be left unchanged, and the method of estimating the field length corresponding to the data set by the field length corresponding to the variable-length field data can be continued, which further reduces the amount of calculation, improves the calculation efficiency, and reduces the system performance loss.
[0060] Step S104: When the field length corresponding to the data set is less than or equal to the data transmission threshold, the data set is sent to the cache device, and the data set is transmitted according to the transmission protocol.
[0061] Through the above settings, sending the data set to the cache device can not only improve the efficiency of subsequent data transmission, but also flexibly set the data transmission threshold, limit the size of the data set, and reduce the network overhead and bandwidth pressure for the transmission processing of the data set.
[0062] Further, according to an embodiment of the present invention, when the field length of the data set is greater than the data transmission threshold, the data processing method further includes: triggering a current limiting rule and stopping the cache operation on the data set.
[0063] Current limiting rule: indicates that if the field length corresponding to the data to be transmitted (ie the above-mentioned data set) exceeds the data transmission threshold, the assembly operation corresponding to the data to be transmitted is suspended and the data is stopped from being sent to the cache device.
[0064] According to the technical solution of the embodiment of the present invention, the target data is acquired in real time and serialized; the serialized target data is placed in a data set, and the field length corresponding to the data set is determined; it is determined whether the field length corresponding to the data set is less than or equal to the data transmission threshold; if so, a cache operation is performed on the data set, and the data set performing the cache operation is transmitted and processed according to the transmission protocol. Therefore, the technical means overcomes the problem that the existing method needs to wait for the transmission data packet to be assembled before performing accurate calculation, which has low calculation efficiency and large amount of calculation, thereby increasing system performance loss; and when the data packet to be transmitted is too large, it occupies too much memory space, resulting in a large amount of system resources being occupied. The technical problem is thus achieved by improving the calculation efficiency in the data processing process, reducing the amount of calculation, reducing system performance loss, and releasing memory space to save system resources.
[0065] Figure 2a is a schematic diagram of the main flow of a data processing method provided according to a second embodiment of the present invention; the embodiment of the present invention is an application scenario for processing data of an application program, such as Figure 2b , 2c As shown, the data processing device corresponding to the data processing method provided in the embodiment of the present invention can be set in a current limiter, and the data processing method provided in the embodiment of the present invention is executed by the current limiter, and the current limiter can be set inside the application program; Figure 2a As shown, the data processing method provided by the embodiment of the present invention mainly includes:
[0066] Step S201, acquiring target data in real time and performing serialization processing on the target data.
[0067] Specifically, according to an embodiment of the present invention, by acquiring target data such as cache object data and transmission object data in an application in real time, it is beneficial to use an incremental calculation method to determine the field length corresponding to the data set in the subsequent process of assembling the target data into a data set, thereby improving the calculation efficiency of the data set and further improving the efficiency of subsequent data transmission.
[0068] Specifically, according to an embodiment of the present invention, the above serialization refers to the process of converting the state information of an object into a form that can be stored or transmitted. Specifically, the process corresponding to step S201 is as follows: Figure 2d As shown, the target data (i.e., the object to be transmitted in the figure) is obtained, and the target data is serialized (i.e., the process of converting the state information of the object into a form that can be stored or transmitted), so that the target data is converted into a form that can be transmitted over the network.
[0069] Step S202, placing the serialized target data into a data set, and dividing the target data into fixed-length field data and variable-length field data according to the data type.
[0070] Specifically, in the software development process, many development languages provide a rich variety of data types. According to the number of bytes occupied by different data types, the target data can be divided into fixed-length field data (such as target data with data types such as Boolean, integer, long integer, floating point number, etc.) and variable-length field data (such as target data with data types such as string).
[0071] like Figure 2e As shown, for Java language (an object-oriented programming language), the Boolean data it provides occupies 1 byte, floating-point data occupies 4 bytes, double-precision floating-point data occupies 8 bytes, integer data occupies 4 bytes, and long integer data occupies 8 bytes, so it can be divided into fixed-length field data a1; while the bytes occupied by the string (string) are not fixed, and the specific length is determined by the content stored therein, so it can be divided into variable-length field data x.
[0072] Step S203, determining the field length accuracy rate according to the field length of the fixed-length field data and the field length of the variable-length field data.
[0073] Through the above settings, the target data is divided into fixed-length field data and variable-length field data according to the data type, wherein the corresponding field length of the fixed-length field data is fixed, and the field length corresponding to the fixed-length field data can be determined according to the byte length occupied by the specific data type; and for the variable-length field length, since the corresponding field length is not fixed, it needs to be calculated according to the specific stored content. Through the above settings, the calculation method of the field length of some target data is simplified, that is, the field length in the data set can be estimated, which reduces the amount of calculation before data transmission and improves the calculation efficiency.
[0074] Step S204: When the field length accuracy is greater than or equal to the accuracy threshold, the field length corresponding to the variable-length field data is used as the field length corresponding to the data set.
[0075] In actual applications, the triggering of current limiting operations in many business scenarios is performed within a certain range. Therefore, the field length of the data to be transmitted (i.e., the data set containing the target data) does not need to be accurately calculated. Through the above settings, as long as the accuracy of the field length corresponding to the current limiting operation is met in the business scenario, only the field length corresponding to the variable-length field data is calculated, and this is used as the field length corresponding to the data set, which further reduces the amount of calculation for assembling data packets (i.e., data sets) before data transmission, improves calculation efficiency, and reduces system performance loss.
[0076] According to the embodiment of the present invention, the theoretical basis of the above step S204 is:
[0077] The field length f(x) corresponding to the data set = the field length f(y) of the serialized target data + the field length a0 added by the network protocol;
[0078] The field length f(y) of the serialized target data = the field length x corresponding to the variable-length field data + the field length a1 corresponding to the fixed-length field.
[0079] After replacing the equation, we can get the following relationship:
[0080] f(x)=x+a0+a1 (1)
[0081] Since a0 and a1 are both constants, let:
[0082] b=a0+a1 (2)
[0083] Combining equation (1) and equation (2), we can get:
[0084] f(x)=x+b (3)
[0085] It can be seen from Formula 3 that the field length corresponding to the data set is ultimately determined mainly by the field length x corresponding to the variable-length field.
[0086] When x is much larger than b, the influence of b can be ignored, that is,
[0087] f(x)≈x (4)
[0088] It can be seen from formula (4) that when the field length accuracy is greater than or equal to the accuracy threshold (that is, when the field length corresponding to the variable-length field data is much greater than the field length corresponding to the fixed-length field data), the field length corresponding to the variable-length field can be used to estimate the field length corresponding to the data set.
[0089] Step S205 , performing data cleaning on the target data in the data set according to the data attributes and field length threshold corresponding to the target data.
[0090] When it is necessary to monitor the corresponding business of the application to ensure that the business system can operate normally, timely feedback can be given in the event of a business system failure, and the system maintenance personnel can be notified to handle it. In order to complete the monitoring business, it is necessary to collect business system operation logs, server resources, etc. as target data, but the data attributes of these target data belong to non-business data, and their corresponding priority and importance are also low. In order not to affect the normal operation of the business system, these target data can be cleaned. In another case, for a data packet (such as a subset of a data set), the field length corresponding to exceeds the field length threshold (i.e., abnormal target data), that is, the data packet is very large, which not only requires the memory space of the business system, but also occupies a large network overhead in the subsequent data transmission process, and at the same time causes the risk that the field length corresponding to the data set exceeds the data transmission threshold. The target data can also be cleaned to release memory space and save system resources.
[0091] Step S206, determining whether the target data for data cleaning is variable-length field data, and if so, adjusting the field length of the data set after data cleaning.
[0092] Specifically, the size of the data packet (i.e., the field length corresponding to the data set mentioned above) is determined by the variable-length content (i.e., the field length corresponding to the variable-length field data) x and the fixed-length content (i.e., the field length a1 corresponding to the fixed-length field data and the field length a0 of the content added by the transmission protocol) b. In the Java language, the data packet collected by the business system (i.e., the above-mentioned data set) is represented as follows: Figure 2f shown.
[0093] Furthermore, according to an embodiment of the present invention, the data processing method further includes: determining whether the target data for data cleaning is variable-length field data, and if so, adjusting the field length of the data set after data cleaning.
[0094] Through the above settings, since the field length corresponding to the data set will definitely change after data cleaning, by judging whether the object of data cleaning is variable-length field data, it can be determined whether the field length corresponding to the data set needs to be recalculated. If the target data for data cleaning is fixed-length field data, the field length corresponding to the data set can be left unchanged, and the method of estimating the field length corresponding to the data set by the field length corresponding to the variable-length field data can be continued, which further reduces the amount of calculation, improves the calculation efficiency, and reduces the system performance loss.
[0095] Figure 2f In the fixed-length content, the fixed-length content consists of field 3, start time, and offset time. The field lengths corresponding to the fixed-length content are:
[0096] b=int(4)+long(8)+long(8)=20
[0097] Define the field length of the data set as size, and the data transmission threshold as m. Assume that m = 1MB = 1*1024*1024 = 1048576 bytes. Since it is much larger than the field length 20 corresponding to the fixed-length content, the impact of the fixed-length content can be ignored. The accuracy of the field after ignoring is: 1024*1024 / (1024*1024+20)≈99.997%, which meets the accuracy threshold requirement.
[0098] Step S207, determine whether the field length corresponding to the data set is less than or equal to the data transmission threshold. If so, that is, the field length corresponding to the data set is less than or equal to the data transmission threshold, then execute step S208; if not, that is, the field length corresponding to the data set is greater than the data transmission threshold, then execute step S209.
[0099] In the above settings, the data transmission threshold can be determined according to actual conditions.
[0100] Step S208: perform a cache operation on the data set, and perform transmission processing on the data set on which the cache operation is performed according to a transmission protocol.
[0101] Through the above settings, sending the data set to the cache device (i.e. performing cache processing) can not only improve the efficiency of subsequent data transmission, but also flexibly set the data transmission threshold, limit the size of the data set, and reduce the network overhead and bandwidth pressure for transmission processing of the data set.
[0102] Step S209, triggering the current limiting rule and stopping the cache operation on the data set.
[0103] Current limiting rule: indicates that if the field length corresponding to the data to be transmitted (ie the above-mentioned data set) exceeds the data transmission threshold, the assembly operation corresponding to the data to be transmitted is suspended and the data is stopped from being sent to the cache device.
[0104] According to the technical solution of the embodiment of the present invention, the target data is acquired in real time and serialized; the serialized target data is placed in a data set, and the field length corresponding to the data set is determined; it is determined whether the field length corresponding to the data set is less than or equal to the data transmission threshold; if so, a cache operation is performed on the data set, and the data set performing the cache operation is transmitted and processed according to the transmission protocol. Therefore, the technical means overcomes the problem that the existing method needs to wait for the transmission data packet to be assembled before performing accurate calculation, which has low calculation efficiency and large amount of calculation, thereby increasing system performance loss; and when the data packet to be transmitted is too large, it occupies too much memory space, resulting in a large amount of system resources being occupied. The technical problem is thus achieved by improving the calculation efficiency in the data processing process, reducing the amount of calculation, reducing system performance loss, and releasing memory space to save system resources.
[0105] Figure 3 is a schematic diagram of main modules of a data processing device provided according to an embodiment of the present invention; Figure 3 As shown, the data processing device 300 provided in this embodiment of the present invention mainly includes:
[0106] The target data acquisition module 301 is used to acquire the target data in real time and perform serialization processing on the target data.
[0107] Specifically, according to an embodiment of the present invention, by acquiring target data (such as cache object data, transmission object data) in real time, it is beneficial to use an incremental calculation method to determine the field length corresponding to the data set in the subsequent process of assembling the target data into a data set, thereby improving the calculation efficiency of the data set and further improving the efficiency of subsequent data transmission.
[0108] Serialization: refers to the process of converting the state information of an object into a form that can be stored or transmitted.
[0109] The field length determination module 302 is used to place the serialized target data into a data set and determine the field length corresponding to the data set.
[0110] According to an embodiment of the present invention, the above-mentioned field length determination module 302 is also used to: place the serialized target data in a data set, divide the target data into fixed-length field data and variable-length field data according to the data type, and determine the field length corresponding to the data set according to the field lengths corresponding to the fixed-length field data and the variable-length field data.
[0111] Specifically, in the software development process, many development languages provide a rich variety of data types. According to the number of bytes occupied by different data types, the target data can be divided into fixed-length field data (such as target data with data types such as Boolean, integer, long integer, floating point number, etc.) and variable-length field data (such as target data with data types such as string).
[0112] Through the above settings, the target data is divided into fixed-length field data and variable-length field data according to the data type, wherein the corresponding field length of the fixed-length field data is fixed, and the field length corresponding to the fixed-length field data can be determined according to the byte length occupied by the specific data type; and for the variable-length field length, since the corresponding field length is not fixed, it needs to be calculated according to the specific stored content. Through the above settings, the calculation method of the field length of some target data is simplified, that is, the field length in the data set can be estimated, which reduces the amount of calculation before data transmission and improves the calculation efficiency.
[0113] Further, according to an embodiment of the present invention, the above-mentioned field length determination module 302 is also used to: determine the field length accuracy based on the field length of the fixed-length field data and the field length of the variable-length field data, and when the field length accuracy is greater than or equal to the accuracy threshold, the field length corresponding to the variable-length field data is used as the field length corresponding to the data set.
[0114] In actual applications, the triggering of current limiting operations in many business scenarios is performed within a certain range. Therefore, the field length of the data to be transmitted (i.e., the data set containing the target data) does not need to be accurately calculated. Through the above settings, as long as the accuracy of the field length corresponding to the current limiting operation is met in the business scenario, only the field length corresponding to the variable-length field data is calculated, and this is used as the field length corresponding to the data set, which further reduces the amount of calculation for assembling data packets (i.e., data sets) before data transmission, improves calculation efficiency, and reduces system performance loss.
[0115] Current limiting operation: refers to the operation of limiting the transmission data flow when the amount of data is too large during data transmission, which puts great pressure on data bandwidth and system performance, and there is also a risk of system downtime. In order to reduce system pressure, the operation of limiting the transmission data flow is adopted.
[0116] According to a specific implementation of the embodiment of the present invention, the field length accuracy rate may be determined by utilizing the ratio of the field length of the variable-length field data to the total field length of the variable-length field data and the fixed-length field data.
[0117] It should be noted that the above field length accuracy is set based on the fact that in most cases, the field length corresponding to the variable-length field data is much larger than the field length corresponding to the fixed-length field data. If, in a certain data set, the field length corresponding to the fixed-length field data is much larger than the field length of the variable-length field data, the method for determining the field length accuracy should also be adaptively adjusted.
[0118] The judgment module 303 is used to judge whether the field length corresponding to the data set exceeds the data transmission threshold.
[0119] In the above settings, the data transmission threshold can be determined according to actual conditions.
[0120] Specifically, according to an embodiment of the present invention, the above-mentioned data processing device 300 also includes a data cleaning module. Before the step of determining whether the field length of the data set is less than or equal to the data transmission threshold, the data cleaning module is used to: perform data cleaning on the target data in the data set according to the data attributes corresponding to the target data and the field length threshold, wherein the data attributes indicate the business type corresponding to the target data.
[0121] Exemplarily, for data transmission of monitoring services, the system operation logs, server resources and other data of the business system obtained are non-business data unrelated to the monitoring business, and their priority and importance are relatively low. Therefore, the target data of this data attribute can be discarded (i.e., the above-mentioned data cleaning is performed). According to a specific implementation of an embodiment of the present invention, for a data packet (such as a subset of a data set) whose corresponding field length exceeds the field length threshold, that is, the data packet is very large, which not only requires the memory space of the business system, but also occupies a large network overhead in the subsequent data transmission process, and at the same time causes the risk of the field length corresponding to the data set exceeding the data transmission threshold, the target data can also be cleaned to release memory space and save system resources.
[0122] Further, according to an embodiment of the present invention, the data processing device 300 further includes an adjustment module for determining whether the target data for data cleaning is variable-length field data, and if so, adjusting the field length of the data set after data cleaning.
[0123] After the target data in the data set is cleaned, the field length corresponding to the data set will change accordingly. However, in most of the business scenarios mentioned above, the triggering and executing of the current limiting operation is performed within a certain range. The field length of the data to be transmitted (i.e., the data set containing the target data) does not need to be accurately calculated. Therefore, the field length corresponding to the data set can be estimated by calculating the field length corresponding to the variable-length field data to reduce the amount of calculation and improve the calculation efficiency. Through the above settings, since the field length corresponding to the data set will definitely change after data cleaning, by judging whether the object of data cleaning is variable-length field data, it can be determined whether the field length corresponding to the data set needs to be recalculated. In the case where the target data for data cleaning is fixed-length field data, the field length corresponding to the data set can be left unchanged, and the method of estimating the field length corresponding to the data set by the field length corresponding to the variable-length field data can be continued, which further reduces the amount of calculation, improves the calculation efficiency, and reduces the system performance loss.
[0124] The processing module 304 is used to send the data set to the cache device and perform transmission processing on the data set according to the transmission protocol when the field length corresponding to the data set is less than or equal to the data transmission threshold.
[0125] Through the above settings, sending the data set to the cache device can not only improve the efficiency of subsequent data transmission, but also flexibly set the data transmission threshold, limit the size of the data set, and reduce the network overhead and bandwidth pressure for the transmission processing of the data set.
[0126] Further, according to an embodiment of the present invention, the above-mentioned data processing device 300 also includes a current limiting rule triggering module. When the field length of the data set is greater than the data transmission threshold, the current limiting rule triggering module is used to: trigger the current limiting rule and stop performing caching operations on the data set.
[0127] Current limiting rule: indicates that if the field length corresponding to the data to be transmitted (ie the above-mentioned data set) exceeds the data transmission threshold, the assembly operation corresponding to the data to be transmitted is suspended and the data is stopped from being sent to the cache device.
[0128] According to the technical solution of the embodiment of the present invention, the target data is acquired in real time and serialized; the serialized target data is placed in a data set, and the field length corresponding to the data set is determined; it is determined whether the field length corresponding to the data set is less than or equal to the data transmission threshold; if so, a cache operation is performed on the data set, and the data set performing the cache operation is transmitted and processed according to the transmission protocol. Therefore, the technical means overcomes the problem that the existing method needs to wait for the transmission data packet to be assembled before performing accurate calculation, which has low calculation efficiency and large amount of calculation, thereby increasing system performance loss; and when the data packet to be transmitted is too large, it occupies too much memory space, resulting in a large amount of system resources being occupied. The technical problem is thus achieved by improving the calculation efficiency in the data processing process, reducing the amount of calculation, reducing system performance loss, and releasing memory space to save system resources.
[0129] Figure 4 An exemplary system architecture 400 is shown to which the data processing method or data processing device according to the embodiment of the present invention can be applied.
[0130] like Figure 4 As shown, the system architecture 400 may include terminal devices 401, 402, 403, a network 404 and a server 405 (this architecture is only an example, and the components included in the specific architecture may be adjusted according to the specific application). The network 404 is used to provide a medium for a communication link between the terminal devices 401, 402, 403 and the server 405. The network 404 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0131] Users can use terminal devices 401, 402, 403 to interact with server 405 through network 404 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 401, 402, 403, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0132] The terminal devices 401 , 402 , and 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0133] The server 405 may be a server that provides various services, such as a background management server (only for example) that supports shopping websites browsed by users using the terminal devices 401, 402, and 403. The background management server may analyze and process the received target data and other data, and feed back the processing results (such as data sets, field lengths corresponding to the data sets - only for example) to the terminal device.
[0134] It should be noted that the data processing method provided in the embodiment of the present invention is generally executed by the server 405 , and accordingly, the data processing device is generally disposed in the server 405 .
[0135] It should be understood that Figure 4 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0136] Reference below Figure 5 , which shows a schematic diagram of the structure of a computer system 500 of a terminal device suitable for implementing an embodiment of the present invention. Figure 5 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0137] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0138] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.
[0139] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the system of the present invention are executed.
[0140] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0141] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0142] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes a target data acquisition module, a field length determination module, a judgment module and a processing module. The names of these modules do not constitute a limitation on the modules themselves in some cases, for example, the target data acquisition module may also be described as "a module for acquiring target data in real time and performing serialization processing on the target data".
[0143] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: acquiring target data in real time and serializing the target data; placing the serialized target data in a data set and determining the field length corresponding to the data set; determining whether the field length corresponding to the data set is less than or equal to the data transmission threshold; if so, performing a cache operation on the data set, and performing transmission processing on the data set performing the cache operation according to the transmission protocol.
[0144] According to the technical solution of the embodiment of the present invention, the target data is acquired in real time and serialized; the serialized target data is placed in a data set, and the field length corresponding to the data set is determined; it is determined whether the field length corresponding to the data set is less than or equal to the data transmission threshold; if so, a cache operation is performed on the data set, and the data set performing the cache operation is transmitted and processed according to the transmission protocol. Therefore, the technical means overcomes the problem that the existing method needs to wait for the transmission data packet to be assembled before performing accurate calculation, which has low calculation efficiency and large amount of calculation, thereby increasing system performance loss; and when the data packet to be transmitted is too large, it occupies too much memory space, resulting in a large amount of system resources being occupied. The technical problem is thus achieved by improving the calculation efficiency in the data processing process, reducing the amount of calculation, reducing system performance loss, and releasing memory space to save system resources.
[0145] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A data processing method, characterized in that: include: Acquire target data in real time, and perform serialization processing on the target data; Placing the serialized target data in a data set, and determining the field length corresponding to the data set; specifically comprising: dividing the target data into fixed-length field data and variable-length field data according to the data type, and determining the field length corresponding to the data set according to the field lengths corresponding to the fixed-length field data and the variable-length field data; Determining whether the field length corresponding to the data set is less than or equal to a data transmission threshold; If so, a cache operation is performed on the data set, and the data set on which the cache operation is performed is transmitted according to a transmission protocol.
2. The data processing method according to claim 1, characterized in that: The step of determining the field length corresponding to the data set based on the field lengths corresponding to the fixed-length field data and the variable-length field data also includes: determining the field length accuracy based on the field length of the fixed-length field data and the field length of the variable-length field data, and when the field length accuracy is greater than or equal to the accuracy threshold, using the field length corresponding to the variable-length field data as the field length corresponding to the data set.
3. The data processing method according to claim 1, characterized in that: Before the step of determining whether the field length of the data set is less than or equal to a data transmission threshold, the data processing method further includes: performing data cleaning on the target data in the data set according to data attributes corresponding to the target data and a field length threshold, wherein the data attributes indicate a business type corresponding to the target data.
4. The data processing method according to claim 3, characterized in that: The data processing method further includes: determining whether the target data for data cleaning is variable-length field data, and if so, adjusting the field length of the data set after data cleaning.
5. The data processing method according to claim 1, characterized in that: When the field length of the data set is greater than a data transmission threshold, the data processing method further includes: triggering a current limiting rule and stopping the cache operation on the data set.
6. A data processing device, characterized in that: include: A target data acquisition module is used to acquire target data in real time and perform serialization processing on the target data; A field length determination module, used to place the serialized target data into a data set and determine the field length corresponding to the data set; and dividing the target data into fixed-length field data and variable-length field data according to the data type, and determining the field length corresponding to the data set according to the field lengths corresponding to the fixed-length field data and the variable-length field data; A judgment module, used to judge whether the field length corresponding to the data set exceeds a data transmission threshold; The processing module is used to perform a cache operation on the data set when the field length corresponding to the data set is less than or equal to the data transmission threshold, and to perform transmission processing on the data set performing the cache operation according to the transmission protocol.
7. The data processing device according to claim 6, characterized in that: The field length determination module is also used to determine the field length accuracy based on the field length of the fixed-length field data and the field length of the variable-length field data. When the field length accuracy is greater than or equal to the accuracy threshold, the field length corresponding to the variable-length field data is used as the field length corresponding to the data set.
8. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.
9. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
