Data transmission method, electronic device, storage medium and program product
By adjusting the storage amount and data compression processing on the receiving end, the problem of excessive interactions in traditional data compression technology is solved, which improves data transmission speed and reduces resource waste.
Patent Information
- Application Number
- CN202411311062.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2025-01-10
AI Technical Summary
In traditional data compression technology, the number of interactions between the sending end and the receiving end is too high, resulting in reduced data transmission speed and waste of resources.
By determining at the receiving end whether the storage amount is greater than or equal to the amount of data to be sent, data transmission is performed if satisfied, and the storage amount is adjusted to reduce the number of interactions when necessary, and data compression processing is adopted to reduce the amount of data.
It effectively reduces the number of interactions between the sending end and the receiving end, reduces resource waste, and improves data transmission speed.
Smart Images

Figure CN119299514A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data compression, and in particular to a data transmission method, electronic equipment, storage medium and program product. Background Art
[0002] Data transmission enables different computers to exchange data through the network. In order to significantly reduce data storage space and network costs and increase data transmission speed, data compression technology is used to compress the original data before transmission.
[0003] Traditional data compression technology compresses data before transmission, but there is a problem of too many interactions between the sender and the receiver, which not only reduces the data transmission speed but also causes a waste of resources.
[0004] How to improve data transmission speed while ensuring data transmission effect and reduce resource waste still needs to be solved. Summary of the invention
[0005] The embodiments of the present application provide a data transmission method, an electronic device, a storage medium and a program product, so as to achieve the effect of improving the data transmission speed and reducing the waste of resources while ensuring the data transmission effect.
[0006] In a first aspect, an embodiment of the present application provides a data transmission method, applied to a sending end, comprising:
[0007] In response to a data transmission request sent by a receiving end, the data to be transmitted is processed to obtain processed data and a data volume of the processed data, wherein the processing includes compression processing;
[0008] If it is determined that the storage capacity of the receiving end is greater than or equal to the data volume of the processed data, the processed data is sent to the receiving end.
[0009] In a possible implementation manner, if it is determined that the storage capacity of the receiving end is greater than or equal to the data volume of the processed data, sending the processed data to the receiving end includes:
[0010] sending the amount of the processed data to the receiving end;
[0011] When the storage capacity adjustment result sent by the receiving end is received and the current storage capacity is greater than or equal to the data capacity of the processed data, the processed data is sent to the receiving end.
[0012] In a possible implementation manner, compressing the data to be sent includes:
[0013] When the number of repeated characters in the data to be sent is greater and / or the occupancy of the processor in the sending end is smaller, the compressed data with a smaller output data volume after the data to be sent is compressed is used as the processed data.
[0014] In a possible implementation manner, compressing the data to be sent includes:
[0015] If the data amount of the data to be sent is greater than or equal to the preset data amount, the data to be sent is compressed.
[0016] In a possible implementation, the method further includes:
[0017] When the data amount of the data to be sent is less than the preset data amount, and / or the estimated data amount of the compressed data to be sent is greater than the data amount of the data to be sent, if it is determined that the storage capacity of the receiving end is greater than or equal to the data amount of the data to be sent, the data to be sent is sent to the receiving end.
[0018] In a possible implementation manner, compressing the data to be sent includes:
[0019] The data to be sent is compressed, and a compression mark is added to form the processed data.
[0020] In a second aspect, the present application provides a data transmission method, applied to a receiving end, comprising:
[0021] Send a data sending request and its own storage capacity to the sender;
[0022] The processed data sent by the sending end is obtained and stored, wherein the processed data is processed data sent when the sending end determines that the storage capacity of the receiving end is greater than or equal to the data amount of the processed data, and the processing includes compression processing.
[0023] In a possible implementation manner, before obtaining the data sent by the sending end, the method further includes:
[0024] Acquire the data volume of the processed data sent by the sending end, and adjust the storage capacity of the sending end according to the data volume of the processed data to be greater than or equal to the data volume of the processed data;
[0025] The storage capacity adjustment result is sent to the sending end.
[0026] In a possible implementation, the method further includes:
[0027] The data to be processed sent by the sending end is obtained and stored.
[0028] In a third aspect, an embodiment of the present application provides an electronic device, including: a memory, a processor;
[0029] The memory stores computer-executable instructions;
[0030] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the first aspect and / or various possible implementations of the first aspect as described above, or executes the second aspect and / or various possible implementations of the second aspect as described above.
[0031] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-readable storage medium is stored computer execution instructions, and when the computer execution instructions are executed by a processor, they are used to implement the first aspect above and / or various possible implementation methods of the first aspect, or to implement the second aspect above and / or various possible implementation methods of the second aspect.
[0032] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the first aspect above and / or various possible implementations of the first aspect, or implements the second aspect above and / or various possible implementations of the second aspect.
[0033] The data transmission method, electronic device, storage medium and program product provided in the embodiments of the present application solve the technical problem that too many interactions between the sending end and the receiving end not only reduce the data transmission speed but also cause waste of resources by first determining the storage capacity of the receiving end and then sending data when the storage capacity is greater than or equal to the data volume. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0035] Figure 1 A schematic diagram of a scenario of the data transmission method provided in this application;
[0036] Figure 2 Schematic diagram of the data transmission method provided by this application applied to the sending end Figure 1 ;
[0037] Figure 3 Schematic diagram of the data transmission method provided by this application applied to the sending end Figure 2 ;
[0038] Figure 4 Schematic diagram of the data transmission method applied to the receiving end provided in this application Figure 1 ;
[0039] Figure 5 Schematic diagram of the data transmission method applied to the receiving end provided in this application Figure 2 ;
[0040] Figure 6 A flowchart of the data transmission method provided by this application;
[0041] Figure 7 A schematic diagram of the structure of the data transmission device provided by this application;
[0042] Figure 8 A schematic diagram of the structure of another data transmission device provided by the present application;
[0043] Fig. 9 A schematic diagram of the structure of the electronic device provided in this application.
[0044] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0045] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0046] Figure 1 A schematic diagram of a scenario of the data transmission method provided in this application, such as Figure 1 As shown, the specific application scenario of the present application is data transmission between different electronic devices (such as computers) through the network. In order to significantly reduce the storage space and network cost of data and increase the data transmission speed, data compression technology is used to compress the original data before transmission. When performing data query, the larger the amount of data in the database, the lower the query performance. Data compression can effectively improve the query performance of the database.
[0047] In the prior art, the data is compressed and transmitted by using data compression technology, but there is a technical problem that the number of interactions between the sending end and the receiving end is too many, which not only reduces the data transmission speed, but also causes a waste of resources.
[0048] The data transmission method provided in the present application solves the technical problem that too many interactions between the sending and receiving ends not only reduce the data transmission speed but also cause waste of resources by first determining the storage capacity of the receiving end and then sending data when the storage capacity is greater than or equal to the data volume.
[0049] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0050] Figure 2 Schematic diagram of the data transmission method provided in this application Figure 1 The data transmission method is applied to the transmitting end. The transmitting end and the receiving end described below are both electronic devices, which may be a personal computer, a mobile phone, a tablet computer, a smart watch, etc., which is not limited in this embodiment. Data transmission can be performed between the transmitting end and the receiving end, and the specific method of data transmission is not limited in this embodiment.
[0051] like Figure 2 As shown, the method includes:
[0052] S201, responding to a data sending request sent by a receiving end, processing the data to be sent to obtain processed data and the data volume of the processed data.
[0053] The processing includes compression processing, and the compression processing method can be selected according to actual needs. The processing can also include other processing, such as filtering out interference data, data sorting, etc.
[0054] Among them, after responding to the data sending request sent by the receiving end, the data to be sent can be determined according to the data sending request. For example, when querying data, the data sending request can be understood as a data query request. At this time, it is necessary to first determine the target data to be queried according to the data query request, and use the target data as the data to be sent.
[0055] The data to be sent may also be data prepared in advance, and the data sending request is used to trigger the sending end to process the data to be sent and then send the processed data.
[0056] After the data to be sent is processed, the processed data and the data volume of the processed data can be obtained. If the processing includes compression processing, the data volume of the processed data is smaller than the data volume of the data to be sent.
[0057] S202: If it is determined that the storage capacity of the receiving end is greater than or equal to the data volume of the processed data, the processed data is sent to the receiving end.
[0058] Before sending the processed data, the sending end may first request to know the storage capacity of the receiving end.
[0059] When the storage capacity of the receiving end is greater than or equal to the data volume of the processed data, it means that the current storage capacity of the receiving end is sufficient to receive the processed data once, and in this case, the processed data is sent to the receiving end. Thus, the receiving end is prevented from receiving the processed data in batches due to insufficient storage capacity, and the number of data exchanges between the sending end and the receiving end is reduced.
[0060] In the case where the storage capacity of the receiving end is less than the data volume of the processed data, the data volume of the processed data can be sent to the receiving end first. After receiving the data volume of the processed data, the receiving end adjusts its own storage capacity to be greater than or equal to the data volume of the processed data in order to reduce the number of data transmission interactions between the sending end and the receiving end. The receiving end can adjust its storage capacity by deleting, compressing, transferring, etc. the stored data, or by using other methods to adjust its own storage capacity.
[0061] The data transmission method provided in the embodiment of the present application responds to the data transmission request sent by the receiving end, processes the data to be transmitted (including compression processing) first, and then obtains the processed data and the data volume of the processed data. When it is determined that the storage capacity of the receiving end is greater than or equal to the data volume of the processed data, the processed data is sent to the receiving end. Thus, the problem of too many interactions between the sending end and the receiving end during the compressed data transmission process is solved, and the waste of resources is reduced. In addition, data transmission in the form of compressed data can increase the data transmission speed.
[0062] Figure 3 Schematic diagram of the data transmission method provided in this application Figure 2 ,like Figure 3 As shown, in this embodiment Figure 2 Based on the embodiment, a data transmission method is described in detail, and the method includes:
[0063] S301, responding to a data sending request sent by a receiving end, processing the data to be sent to obtain processed data and the data volume of the processed data.
[0064] For the relevant description of step S301, reference may be made to the relevant description of step S201, which will not be repeated here.
[0065] S302: Send the data volume of the processed data to the receiving end.
[0066] Before sending the processed data to the receiving end, in order to prevent the receiving end from needing to transmit the processed data in batches due to insufficient storage capacity, the data volume of the processed data may be sent to the receiving end first.
[0067] After receiving the amount of the processed data, the receiving end adjusts its own storage capacity to be greater than or equal to the amount of the processed data. The receiving end may adjust the storage capacity by deleting, compressing, transferring, etc. the stored data, or by other methods.
[0068] After adjusting its own storage capacity, the receiving end sends the storage capacity adjustment result to the sending end.
[0069] S303: When the storage capacity adjustment result sent by the receiving end is that the current storage capacity is greater than or equal to the data capacity of the processed data, the processed data is sent to the receiving end.
[0070] The storage capacity adjustment result includes the adjusted storage capacity, that is, the current storage capacity. When the storage capacity adjustment result is that the current storage capacity is greater than or equal to the data capacity of the processed data, it means that the current storage capacity of the receiving end can be satisfied to receive the processed data once. At this time, sending the processed data to the receiving end can prevent the receiving end from needing to receive the processed data in batches due to insufficient storage capacity, thereby reducing the number of data exchanges between the sending end and the receiving end.
[0071] The data transmission method provided in the embodiment of the present application responds to the data transmission request sent by the receiving end, processes the data to be sent first (including compression processing), and then obtains the processed data and the data volume of the processed data. The data volume of the processed data is then sent to the receiving end so that the receiving end adjusts its own storage capacity to be greater than or equal to the data volume of the processed data. When it is determined that the storage capacity adjustment result of the receiving end is that the current storage capacity is greater than or equal to the data volume of the processed data, the processed data is sent to the receiving end. Thus, the problem of too many interactions between the sending end and the receiving end during the compressed data transmission process is solved, and resource waste is reduced. In addition, data transmission in the form of compressed data can increase the data transmission speed.
[0072] In some embodiments, when step S201 or step S301 compresses the data to be sent, it includes step 1 described below.
[0073] Step 1: When the number of repeated characters in the data to be sent is greater and / or the occupancy of the processor in the sending end is smaller, the compressed data with a smaller output data volume after compressing the data to be sent is used as the processed data.
[0074] When the number of repeated characters in the data to be sent is greater, the compression processing of the data to be sent is configured to a higher level. When the compression processing level (Compress Level) is higher, the data window obtained is larger, and the compressed data with a smaller data volume is obtained after compression. Preferably, the compression processing level can be configured to 2. When the compression processing level is 0, it means that communication compression is turned off, and the data to be sent is not compressed at this time.
[0075] When the CPU (Central Processing Unit) occupancy is smaller, the compression processing of the data to be sent is configured to a higher level. When the compression processing level is higher, the data window obtained is larger, and the compressed data with a smaller data volume is obtained after compression. Preferably, the compression processing level can be configured to 2. When the compression processing level is 0, it means that communication compression is turned off, and the data to be sent is not compressed at this time.
[0076] When the number of repeated characters in the data to be sent is greater and the processor occupancy is smaller, the compression processing of the data to be sent is configured to a higher level. When the level of compression processing is higher, the data window obtained is larger, and the compressed data with a smaller data volume is obtained after compression. Preferably, the level of compression processing can be configured to 2. When the level of compression processing is 0, it means that communication compression is turned off, and the data to be sent is not compressed at this time.
[0077] It should be noted that when the amount of data to be sent is large, if the processor occupancy is small at this time, using a higher level of compression processing can effectively reduce the amount of data, making the amount of the processed data smaller.
[0078] The method provided in this embodiment is that when the number of repeated characters in the data to be sent is greater and / or the occupancy of the processor in the sending end is smaller, the compressed data with a smaller output data volume is used as the processed data. In this way, the resources occupied by the compressed data are reasonably allocated, thereby improving the processing effect of the compressed data and making the data volume of the processed data smaller. The data volume of the processed data is smaller, so that the receiving end can receive the processed data in one time, reducing the number of interactions between the sending end and the receiving end and reducing resource waste. The data volume of the processed data is smaller, and the data transmission speed can be further improved.
[0079] In some embodiments, in order to avoid unnecessary compression processing, the compression processing of the to-be-sent data includes:
[0080] Step 1: If the amount of the data to be sent is greater than or equal to the preset amount of data, compress the data to be sent.
[0081] The preset data amount (Compress_Min) can be set according to actual needs and is not limited in this embodiment. The preset data amount can be 50 bits (Binary digit, BIT for short), that is, the data to be sent is compressed only when the data amount of the data to be sent is greater than or equal to 50 bits.
[0082] Optionally, if the amount of the data to be sent is small, the data to be sent may not be compressed and may be directly sent to the receiving end.
[0083] The method provided in this embodiment can avoid unnecessary compression processing, reduce the occupancy of the processor, and improve the operating speed of the processor.
[0084] In some embodiments, the data transmission method further includes the following step 1:
[0085] Step one: when the amount of data to be sent is less than the preset data amount, and / or the estimated amount of data after compression of the data to be sent is greater than the amount of data to be sent, if it is determined that the storage capacity of the receiving end is greater than or equal to the amount of data to be sent, the data to be sent is sent to the receiving end.
[0086] That is to say, there are three situations in which the data to be sent may not be compressed.
[0087] In the first case, if the data size of the data to be sent is less than the preset data size, the data size of the data to be sent is small, and the data to be sent is not compressed. The preset data size is, for example, 50 bits.
[0088] In the second case, if it is estimated that the amount of data to be sent after compression processing is greater than the amount of data to be sent, that is, the amount of data to be sent will increase after compression processing, then the data to be sent may not be compressed. It is understandable that the current compression algorithm will add 16 bits of information to the header of the data to be sent when performing compression processing, and in order to be able to read the complete compressed package, it is necessary to add an additional 4 bits of compressed package size to the header, which may cause the amount of data after compression processing to be greater than the amount of data before compression processing. For example, the amount of data to be sent is 10 bits, assuming that the size of 10 bits after compression processing is 6 bits, after adding 16 bits and 4 bits as described above, the amount of data becomes 26 bits (6 bits + 16 bits + 4 bits). 26 bits are greater than 10 bits, but will require more storage space, which is not conducive to efficient data transmission. Therefore, in this case, the data to be sent may not be compressed.
[0089] The third case includes the first case and the second case, that is, when the amount of the data to be sent is small and it is estimated that the amount of data will increase after compression processing, the data to be sent is not compressed.
[0090] When the storage capacity of the receiving end is greater than or equal to the data volume of the data to be sent, the data volume to be sent is directly sent to the receiving end. Optionally, the data volume of the data to be sent can be sent to the receiving end first, so that the receiving end adjusts its own storage capacity to be greater than or equal to the data volume of the data to be sent according to the data volume of the data to be sent.
[0091] The method provided in this embodiment does not compress the data to be sent when the amount of data to be sent is small and / or the amount of data will increase after compression processing. Instead, when the storage capacity of the receiving end is greater than or equal to the amount of data to be sent, the amount of data to be sent is directly sent to the receiving end. This prevents unnecessary compression processing and improves the data transmission efficiency between the sending end and the receiving end.
[0092] In some embodiments, when compressing the data to be sent, the process includes:
[0093] Step 1: compress the data to be sent and add a compression mark to form the processed data.
[0094] After the data to be sent is compressed, the compression flag is added as 1. When the data to be sent is not compressed, the compression flag is added as 0. After receiving the processed data, the receiving end can determine whether to decompress the processed data according to the compression flag.
[0095] The processed data includes the compressed packet size (eg, 4 bits), a compression flag (1 or 0), and message content. When the compression flag is 1, the message content is compressed message content, and when the compression flag is 0, the message content is uncompressed message content.
[0096] In some embodiments, the maximum data volume (Compress_Max) when the transmitting end sends data to the receiving end can also be set, that is, the data volume of the data sent by the transmitting end cannot exceed the maximum data volume. The maximum data volume can be adjusted according to actual needs.
[0097] See also Figure 4 The present application also provides a data transmission method, which is applied to a receiving end. The data transmission method includes:
[0098] S401, sending a data sending request and its own storage capacity to the sending end.
[0099] The data sending request may be a data query request.
[0100] The internal storage capacity refers to the storage capacity that can be used for data storage.
[0101] S402: Obtain and store the processed data sent by the sending end.
[0102] The processed data is processed data that is sent when the sending end determines that the storage capacity of the receiving end is greater than or equal to the data volume of the processed data, and the processing includes compression processing.
[0103] After receiving the data transmission request, the transmitting end responds to the data transmission request, processes the data to be transmitted, and obtains the processed data and the data volume of the processed data. When the storage capacity of the receiving end is greater than or equal to the data volume of the processed data, the processed data is sent to the receiving end. For the relevant description of how the transmitting end processes the data to be transmitted and how to send the processed data, reference can be made to the relevant description of the above embodiment, which will not be repeated here.
[0104] When the storage capacity of the receiving end is greater than or equal to the data capacity of the processed data, the receiving end can receive and store the processed data at one time, thereby reducing the number of data transmission interactions between the sending end and the receiving end.
[0105] When storing the processed data, it needs to be decompressed before storing. Optionally, the processed data carries a compression flag of 1, indicating that it is compressed data. The receiving end determines that the processed data is compressed data by the compression flag being 1, and then decompresses the processed data into a decompression buffer.
[0106] The data method provided in this embodiment, when the sending end determines that the storage capacity of the receiving end is greater than or equal to the data volume of the processed data, the processing data is sent to the receiving end. Thus, the problem of too many interactions between the sending end and the receiving end during the compressed data transmission process is solved, and the waste of resources is reduced. In addition, data transmission in the form of compressed data can increase the data transmission speed.
[0107] Figure 5 Schematic diagram of the data transmission method provided in this application Figure 2 ,like Figure 5 As shown, in this embodiment Figure 4 Based on the embodiment, a data transmission method is described in detail, and the method includes:
[0108] S501, sending a data sending request and its own storage capacity to a sending end.
[0109] For the relevant description of step S501, reference may be made to the relevant description of step S401, which will not be repeated here.
[0110] S502: Obtain the data volume of the processed data sent by the sending end, and adjust the storage capacity of the sending end according to the data volume of the processed data to be greater than or equal to the data volume of the processed data.
[0111] The processed data is data obtained after the sender processes the data to be sent after responding to the data sending request, and the processing includes compression processing.
[0112] After receiving the storage capacity of the receiving end, if the sending end considers that the storage capacity is insufficient, the sending end sends the data volume of the processed data to the receiving end so that the receiving end adjusts its own storage capacity to be greater than or equal to the data volume of the processed data.
[0113] S503: Send the storage capacity adjustment result to the sending end.
[0114] The storage capacity adjustment result includes the adjusted storage capacity, that is, the current adjustment capacity. When the sending end determines that the current storage capacity of the receiving end is greater than or equal to the data capacity of the processed data, the sending end sends the processed data to the receiving end.
[0115] S504: Obtain and store the processed data sent by the sending end.
[0116] For the relevant description of step S504, reference may be made to the relevant description of step S402, which will not be repeated here.
[0117] In the method provided by this embodiment, the sending end responds to the data sending request sent by the receiving end, and first processes the data to be sent (including compression processing) to obtain the processed data and the data volume of the processed data. The data volume of the processed data is then sent to the receiving end so that the receiving end adjusts its own storage capacity to be greater than or equal to the data volume of the processed data. When it is determined that the storage capacity adjustment result of the receiving end is that the current storage capacity is greater than or equal to the data volume of the processed data, the processed data is sent to the receiving end. In this way, the problem of too many interactions between the sending end and the receiving end during the compressed data transmission process is solved, and resource waste is reduced. In addition, data transmission in the form of compressed data can increase the data transmission speed.
[0118] In some embodiments, the data transmission method further includes:
[0119] Step 1: Obtain and store the data to be processed sent by the sender.
[0120] When the sending end does not compress the data to be sent, the receiving end directly stores the data to be sent when receiving the data to be sent. For the relevant description of the sending end not compressing the data to be sent, please refer to the above relevant description, which will not be repeated here. Optionally, the data to be sent carries a compression flag of 0, indicating that it is not compressed data. The receiving end determines that the data to be sent does not need to be decompressed by the compression flag being 0, and directly moves the data to be sent into the decompression buffer.
[0121] See also Figure 6 For the convenience of understanding, the present embodiment takes data query as an example to describe the data transmission method provided above and applied to the sending end and the receiving end.
[0122] like Figure 6 As shown, the sending end includes a user state interface, and receives a data sending request (also understood as a data query request) sent by the receiving end through the user state interface. The sending buffer of the sending end sets a preset data amount (Compress_Min) and a maximum data amount (Compress_Max) when sending data to the receiving end. When the data amount of the data to be sent is greater than or equal to the preset data amount (Compress_Min), the data to be sent is moved into the compression buffer to compress the data to be sent. The processed data obtained after the compression process and the data to be sent that have not been compressed are both sent to the compression buffer of the receiving end through the SOKET kernel state in the form of data packets. The compression buffer determines the data amount of the processed data or the data amount of the data to be sent. The receiving end determines whether decompression is required by judging whether the compression flag is 1. If the processed data is received, the compression flag is 1, and the processed data needs to be decompressed to the decompression buffer. If the data to be sent is received, the compression flag is 0, decompression is not required, and the data to be sent is directly moved into the decompression buffer. The data in the decompression buffer is sent to the database server through the receiving buffer. It should be emphasized that the amount of data received by the decompression buffer is less than or equal to the maximum amount of data (Compress_Max).
[0123] Figure 7 A schematic diagram of the structure of the data transmission device provided in this application, such as Figure 7 As shown, the data transmission device 70 provided in this embodiment includes:
[0124] The processing module 701 is used to respond to the data sending request sent by the receiving end and process the data to be sent;
[0125] The acquisition module 702 is used to acquire the processed data and the data volume of the processed data, wherein the processing includes compression processing.
[0126] The communication module 703 is configured to send the processed data to the receiving end if it is determined that the storage capacity of the receiving end is greater than or equal to the data capacity of the processed data.
[0127] In one possible implementation, the communication module 703 is used to send the data volume of the processed data to the receiving end; when the storage volume adjustment result sent by the receiving end is that the current storage volume is greater than or equal to the data volume of the processed data, the processed data is sent to the receiving end.
[0128] In one possible implementation, the processing module 701 is used to compress the data to be sent and output the compressed data with a smaller data volume as the processed data when the number of repeated characters in the data to be sent is greater and / or the occupancy of the processor in the sending end is smaller.
[0129] In a possible implementation, the processing module 701 is used to compress the data to be sent if the data amount of the data to be sent is greater than or equal to a preset data amount.
[0130] In one possible implementation, the communication module 703 is used to send the data to be sent to the receiving end if it is determined that the storage capacity of the receiving end is greater than or equal to the data amount of the data to be sent, when the data amount of the data to be sent is less than a preset data amount and / or the estimated data amount of the data to be sent after compression is greater than the data amount of the data to be sent.
[0131] In a possible implementation, the processing module 701 is used to compress the data to be sent and add a compression mark to form the processed data.
[0132] The data transmission device 70 provided in this embodiment can execute the data transmission method provided in the above method embodiment and applied to the sending end. Its implementation principle and technical effect are similar, and will not be described in detail in this embodiment.
[0133] Figure 8 A schematic diagram of the structure of the data transmission device provided in this application, such as Figure 7 As shown, the data transmission device 80 provided in this embodiment includes:
[0134] Communication module 801, used to send a data transmission request and its own storage capacity to the transmission end;
[0135] The acquisition module 802 is used to acquire and store the processed data sent by the sending end, wherein the processed data is the processed data sent when the sending end determines that the storage capacity of the receiving end is greater than or equal to the data amount of the processed data, and the processing includes compression processing.
[0136] In one possible implementation, the communication module 801 is used to obtain the data volume of the processed data sent by the sending end, adjust its own storage capacity to be greater than or equal to the data volume of the processed data according to the data volume of the processed data; and send the storage capacity adjustment result to the sending end.
[0137] In a possible implementation, the acquisition module 802 is used to acquire and store the data to be processed sent by the sender.
[0138] The data transmission device 80 provided in this embodiment can execute the data transmission method provided in the above method embodiment and applied to the receiving end. Its implementation principle and technical effect are similar, and will not be described in detail in this embodiment.
[0139] Fig. 9 This is a schematic diagram of the structure of the electronic device provided in this application. Fig. 9 As shown, the electronic device 90 provided in this embodiment includes: at least one processor 901 and a memory 902. Optionally, the electronic device 90 further includes a communication component 903. The processor 901, the memory 902 and the communication component 903 are connected via a bus 904.
[0140] In the specific implementation process, at least one processor 901 executes the computer execution instructions stored in the memory 902, so that at least one processor 901 executes the above-mentioned data transmission method applied to the sending end, or executes the above-mentioned data transmission method applied to the receiving end.
[0141] The specific implementation process of the processor 901 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.
[0142] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0143] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk memory.
[0144] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.
[0145] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.
[0146] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.
[0147] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.
[0148] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
[0149] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.
[0150] The units described as segmented components may or may not be physically separated, and the components shown as units 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 units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0151] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0152] If the function 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 technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0153] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0154] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention, which follow the general principles of the present invention and include common knowledge or customary technical means in the art not disclosed by the present invention, are not limited to the precise structure described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A data transmission method, characterized in that: Applied to the sending end, including: In response to a data transmission request sent by a receiving end, the data to be transmitted is processed to obtain processed data and a data volume of the processed data, wherein the processing includes compression processing; If it is determined that the storage capacity of the receiving end is greater than or equal to the data volume of the processed data, the processed data is sent to the receiving end.
2. The method according to claim 1, characterized in that If it is determined that the storage capacity of the receiving end is greater than or equal to the data volume of the processed data, sending the processed data to the receiving end includes: sending the amount of the processed data to the receiving end; When the storage capacity adjustment result sent by the receiving end is received and the current storage capacity is greater than or equal to the data capacity of the processed data, the processed data is sent to the receiving end.
3. The method according to claim 1 or 2, characterized in that: The compression processing of the data to be sent includes: When the number of repeated characters in the data to be sent is greater and / or the occupancy of the processor in the sending end is smaller, the compressed data with a smaller output data volume after the data to be sent is compressed is used as the processed data.
4. The method according to claim 1 or 2, characterized in that: The compression processing of the data to be sent includes: If the data amount of the data to be sent is greater than or equal to the preset data amount, the data to be sent is compressed.
5. The method according to claim 1 or 2, characterized in that: The method further comprises: When the data amount of the data to be sent is less than the preset data amount, and / or the estimated data amount of the compressed data to be sent is greater than the data amount of the data to be sent, if it is determined that the storage capacity of the receiving end is greater than or equal to the data amount of the data to be sent, the data to be sent is sent to the receiving end.
6. The method according to claim 1 or 2, characterized in that: The compression processing of the data to be sent includes: The data to be sent is compressed, and a compression mark is added to form the processed data.
7. A data transmission method, characterized in that: Applied to the receiving end, including: Send a data sending request and its own storage capacity to the sender; The processed data sent by the sending end is obtained and stored, wherein the processed data is processed data sent when the sending end determines that the storage capacity of the receiving end is greater than or equal to the data amount of the processed data, and the processing includes compression processing.
8. The method according to claim 7, characterized in that Before obtaining the data sent by the sending end, the method further includes: Acquire the data volume of the processed data sent by the sending end, and adjust the storage capacity of the sending end according to the data volume of the processed data to be greater than or equal to the data volume of the processed data; The storage capacity adjustment result is sent to the sending end.
9. The method according to claim 7, characterized in that: The method further comprises: The data to be processed sent by the sending end is obtained and stored.
10. An electronic device, characterized in that: include: Memory, processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor executes the method according to any one of claims 1 to 5, or executes the method according to any one of claims 6 to 9.