CN111800512B - Data transmission method and server - Google Patents

Data transmission method and server Download PDF

Info

Publication number
CN111800512B
CN111800512B CN202010646575.6A CN202010646575A CN111800512B CN 111800512 B CN111800512 B CN 111800512B CN 202010646575 A CN202010646575 A CN 202010646575A CN 111800512 B CN111800512 B CN 111800512B
Authority
CN
China
Prior art keywords
data
task data
backup
client
original
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010646575.6A
Other languages
Chinese (zh)
Other versions
CN111800512A (en
Inventor
雷中南
贺磊
洪钊洪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Qianhai Baidi Network Co ltd
Original Assignee
Shenzhen Qianhai Baidi Network Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Qianhai Baidi Network Co ltd filed Critical Shenzhen Qianhai Baidi Network Co ltd
Priority to CN202010646575.6A priority Critical patent/CN111800512B/en
Publication of CN111800512A publication Critical patent/CN111800512A/en
Application granted granted Critical
Publication of CN111800512B publication Critical patent/CN111800512B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1074Peer-to-peer [P2P] networks for supporting data block transmission mechanisms
    • H04L67/1078Resource delivery mechanisms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application discloses a data transmission method and a server side, which are used for ensuring idempotent of data service when the server side provides the data service for a client side. The method comprises the following steps: the server side obtains target task data after assembling n pieces of original task data, and backs up the target task data to obtain backup task data. When the client requests the data again, the server can extract the data needed by the client from the backup task data and provide the data for the client, so that the same data can be provided for the client each time the client requests the data, and the idempotent of the data service is ensured.

Description

Data transmission method and server
Technical Field
The embodiment of the application relates to the field of data transmission, in particular to a data transmission method and a server.
Background
When a client executes a data processing task, the client needs to request data from a server, and the process is that the client firstly sends a data downloading request to the server to request the server to send the data; after receiving the data downloading request, the server performs data preparation, namely, acquires the original data which needs to be issued to the client, assembles the acquired original data to obtain assembled target data, and returns the target data to the client.
In the data request mode, in order to protect the privacy and the security of the data of the client, after the target data is returned to the client, the server deletes the target data and the original data corresponding to the target data, so as to avoid the privacy leakage of the client caused by the leakage of the target data and the original data.
However, after both the original data and the target data are deleted, when the client needs to request the data again, the server cannot return the same target data to the client any more because both the original data and the target data are deleted, which results in that the data download service provided by the server does not have idempotent property.
Disclosure of Invention
The embodiment of the application provides a data transmission method and a server side, which are used for ensuring idempotent of data service when the server side provides the data service for a client side.
An embodiment of the present application provides a data transmission method, applied to a server, where the method includes:
receiving a data request sent by a client, wherein the data request is used for requesting the server to send target task data;
responding to the data request, acquiring n pieces of original task data, wherein each piece of original task data is a sub-item in the target task data, and n is a positive integer;
Assembling the n original task data into the target task data;
backing up the target task data to obtain backup task data, wherein the backup task data is used for providing the backup task data in a subsequent data request of the client;
and responding to the data request, and sending the target task data to the client.
Preferably, the method further comprises:
receiving processing progress information sent by the client when the data processing of the target task data is completed, wherein the processing progress information is used for indicating the current processing progress of the target task data;
and deleting the backup task data according to the processing progress information.
Preferably, the backing up the target task data includes:
backing up the target task data in a cache to obtain the backup task data, and setting the valid period of the backup task data;
the deleting the backup task data according to the processing progress information comprises the following steps:
and deleting the backup task data when the valid period of the backup task data is reached according to the processing progress information based on the effective storage mechanism of the cache.
Preferably, each piece of original task data corresponds to one piece of identification information, and the identification information between each piece of original task data is different;
the assembling the n pieces of original task data into the target task data includes:
respectively taking the identification information of each piece of original task data as a key, taking the original task data corresponding to the key as a value, and forming n pieces of key value pair data;
and assembling the n key value data into the target task data.
Preferably, the n pieces of identification information of the n pieces of original task data are n serial numbers with an arrangement sequence;
the assembling the n key value data into the target task data includes:
sorting the data by the n key values according to the arrangement sequence of the n serial numbers;
and assembling the sorted n key value data into the target task data.
Preferably, after the target task data is sent to the client, the method further includes:
receiving a subsequent data request of the client, wherein the subsequent data request is used for requesting the server to send m pieces of original task data in the backup task data, and m is a positive integer and is less than or equal to n;
Responding to the subsequent data request, and extracting m pieces of original task data corresponding to the subsequent data request from the backup task data;
and assembling the m pieces of original task data into data to be sent, and sending the data to be sent to the client.
Preferably, the subsequent data request includes a sequence number corresponding to each original task data in the m original task data, and the m sequence numbers have an arrangement sequence;
the extracting the m pieces of original task data corresponding to the subsequent data request from the backup task data includes:
extracting m original task data corresponding to the serial numbers respectively from the backup task data to obtain m original task data;
the assembling the m pieces of original task data into data to be sent includes:
taking each serial number in m serial numbers as a key, and taking original task data corresponding to each key as a value to form m key value pair data;
sorting the data according to the m key values according to the arrangement sequence of the m serial numbers;
and assembling the m sorted key value data into the data to be sent.
A second aspect of an embodiment of the present application provides a data transmission method, applied to a client, where the method includes:
Sending a data request to a server, wherein the data request is used for requesting the server to send target task data;
receiving the target task data sent by the server based on the data request, and performing data processing on the target task data, wherein the target task data is obtained by assembling n pieces of original task data by the server, and n is a positive integer;
when the data processing of the target task data is completed, the target task data is not stored and discarded.
Preferably, the method further comprises:
and when the data processing of the target task data is completed, asynchronously sending processing progress information to the server, wherein the processing progress information is used for indicating the current processing progress of the target task data, so that the server deletes the backup task data according to the processing progress information.
Preferably, the data processing for the target task data includes:
performing data processing on the target task data, and when the target task data is lost, sending a subsequent data request to the server, wherein the subsequent data request is used for requesting the server to send m original task data in backup task data, and the backup task data is backup of the target task data, wherein m is a positive integer, and m is less than or equal to n;
And receiving the m pieces of original task data sent by the server based on the subsequent data request, and carrying out data processing by combining the m pieces of original task data.
A third aspect of the embodiments of the present application provides a server, where the server includes:
the receiving unit is used for receiving a data request sent by the client, wherein the data request is used for requesting the server to send target task data;
the acquisition unit is used for responding to the data request and acquiring n pieces of original task data, wherein each piece of original task data is a sub-item in the target task data, and n is a positive integer;
an assembling unit, configured to assemble the n pieces of original task data into the target task data;
the backup unit is used for backing up the target task data to obtain backup task data, and the backup task data is used for providing the backup task data in a subsequent data request of the client;
and the sending unit is used for responding to the data request and sending the target task data to the client.
Preferably, the receiving unit is further configured to receive processing progress information sent by the client when the data processing on the target task data is completed, where the processing progress information is used to indicate a current processing progress of the target task data;
The server side further comprises:
and the deleting unit is used for deleting the backup task data according to the processing progress information.
Preferably, the backup unit is specifically configured to backup the target task data in a cache, obtain the backup task data, and set an expiration date of the backup task data;
the deleting unit is specifically configured to delete the backup task data when the valid period of the backup task data is reached according to the processing progress information based on the cached valid storage mechanism.
Preferably, each piece of original task data corresponds to one piece of identification information, and the identification information between each piece of original task data is different;
the assembling unit is specifically configured to take the identification information of each piece of original task data as a key, take the original task data corresponding to the key as a value, form n pieces of key value pair data, and assemble the n pieces of key value pair data into the target task data.
Preferably, the n pieces of identification information of the n pieces of original task data are n serial numbers with an arrangement sequence;
the assembling unit is specifically configured to sort the n key values according to the arrangement sequence of the n serial numbers, and assemble the n sorted key values into the target task data.
Preferably, the receiving unit is further configured to receive a subsequent data request of the client, where the subsequent data request is used to request the server to send m pieces of original task data in the backup task data, where m is a positive integer, and m is less than or equal to n;
the acquisition unit is further used for responding to the subsequent data request and extracting m pieces of original task data corresponding to the subsequent data request from the backup task data;
the assembling unit is further configured to assemble the m pieces of original task data into data to be sent, and send the data to be sent to the client.
Preferably, the subsequent data request includes a sequence number corresponding to each original task data in the m original task data, and the m sequence numbers have an arrangement sequence;
the obtaining unit is specifically configured to extract m pieces of original task data corresponding to the serial numbers from the backup task data, so as to obtain m pieces of original task data;
the assembling unit is specifically configured to take each serial number of m serial numbers as a key, take original task data corresponding to each key as a value, form m key value pair data, sort the m key value pair data according to the arrangement sequence of the m serial numbers, and assemble the m sorted key value pair data into the data to be sent.
A fourth aspect of the present embodiment provides a client, where the client includes:
the sending unit is used for sending a data request to the server, wherein the data request is used for requesting the server to send target task data;
a receiving unit, configured to receive the target task data sent by the server based on the data request;
the data processing unit is used for carrying out data processing on the target task data, wherein the target task data is obtained by assembling n original task data by the server side, and n is a positive integer;
and the execution unit is used for not storing the target task data and discarding the target task data when the data processing of the target task data is completed.
Preferably, the sending unit is further configured to asynchronously send processing progress information to the server when the data processing of the target task data is completed, where the processing progress information is used to indicate a current processing progress of the target task data, so that the server deletes backup task data according to the processing progress information.
Preferably, the data processing unit is specifically configured to perform data processing on the target task data, and when the target task data has a data loss, send a subsequent data request to the server, where the subsequent data request is used to request the server to send m pieces of original task data in backup task data, where m is a positive integer, and m is less than or equal to n;
The receiving unit is further used for receiving the m pieces of original task data sent by the server side based on the subsequent data request;
the data processing unit is specifically used for carrying out data processing by combining the m pieces of original task data.
A fifth aspect of the embodiments of the present application provides a server, including:
a processor, a memory, and an input/output device;
the processor is connected with the memory and the input and output equipment;
the input/output equipment is used for receiving a data request sent by the client, wherein the data request is used for requesting the server to send target task data;
the processor is configured to respond to the data request, obtain n pieces of original task data, where each piece of original task data is a subitem in the target task data, n is a positive integer, assemble the n pieces of original task data into the target task data, and backup the target task data to obtain backup task data, where the backup task data is used to provide the backup task data in a subsequent data request of the client;
the input and output device is further configured to send the target task data to the client in response to the data request.
A sixth aspect of the embodiments of the present application provides a computer storage medium having stored therein instructions that, when executed on a computer, cause the computer to perform the method of the foregoing first aspect.
From the above technical solutions, the embodiments of the present application have the following advantages:
the server side obtains target task data after assembling n pieces of original task data, and backs up the target task data to obtain backup task data. When the client requests the data again, the server can extract the data needed by the client from the backup task data and provide the data for the client, so that the same data can be provided for the client each time the client requests the data, and the idempotent of the data service is ensured.
Drawings
Fig. 1 is a schematic flow chart of a data transmission method in an embodiment of the present application;
FIG. 2 is a schematic diagram of another flow chart of the data transmission method in the embodiment of the application;
FIG. 3 is a schematic diagram of another flow chart of the data transmission method in the embodiment of the application;
fig. 4 is a schematic structural diagram of a server in an embodiment of the present application;
fig. 5 is a schematic structural diagram of a client in an embodiment of the present application;
fig. 6 is a schematic diagram of another structure of a server in an embodiment of the present application.
Detailed Description
The embodiment of the application provides a data transmission method and a server side, which are used for ensuring idempotent of data service when the server side provides the data service for a client side.
Referring to fig. 1, an embodiment of a data transmission method in the embodiment of the present application includes:
101. receiving a data request sent by a client;
in this embodiment, the client may need to perform one or more data processing tasks. When executing the data processing task, the client needs to acquire target task data corresponding to the data processing task from the server so as to process the acquired target task data. At this time, the client sends a data request to the server, and the server receives the data request.
102. Responding to the data request, and acquiring n pieces of original task data;
the client performs a data processing task that may be directed to one or more items of data. For example, when calculating sales profits, it is necessary to acquire a plurality of data such as sales and sales costs. Thus, the target task data corresponding to the data processing task also includes one or more items of data.
Therefore, after receiving the data request, the server side responds to the data request to obtain n pieces of original task data, wherein each piece of original task data is a sub-item in the target task data, namely the target task data comprises n pieces of original task data, and n is a positive integer.
In this embodiment, the server may obtain the n pieces of original task data from the database, or may obtain the n pieces of original task data from a local storage, or may obtain the n pieces of original task data from other nodes, where a specific obtaining manner is not limited.
103. Assembling n pieces of original task data into target task data;
in order to facilitate the transmission of the target task data, after n pieces of original task data are acquired, the server side assembles the n pieces of original task data into target task data required by the client side. At this time, the target task data corresponds to an array, n original task data form n elements in the array, and the n elements can be orderly arranged, so that the client can conveniently process the target task data.
104. Backing up target task data to obtain backup task data;
after the target task data is obtained through assembly, in order that the client can obtain the same original task data in the subsequent data request, the server needs to backup the target task data to obtain backup task data. Therefore, in the subsequent data request, the server can extract the same original task data from the backup task data and provide the same original task data to the client, so that idempotent of the data service provided by the server is ensured.
105. Responding to the data request, and sending target task data to the client;
after the target task data are obtained through assembly, the server side responds to the data request of the client side and sends the target task data to the client side, so that the client side can execute the task of data processing according to the target task data.
In this embodiment, after assembling n pieces of original task data, the server side obtains target task data, and performs backup on the target task data to obtain backup task data. When the client requests the data again, the server can extract the data needed by the client from the backup task data and provide the data for the client, so that the same data can be provided for the client each time the client requests the data, and the idempotent of the data service is ensured.
Having described the process by which the server transmits the target task data to the client, the operations performed by the client after receiving the target task data will be further described below. Referring to fig. 2, another embodiment of a data transmission method according to the present application includes:
201. sending a data request to a server;
when executing the data processing task, the client sends a data request to the server so as to acquire target task data corresponding to the data processing task, and performs data processing on the acquired target task data.
202. Receiving target task data sent by a server based on a data request, and performing data processing on the target task data;
after receiving the data request of the client, the server assembles n pieces of original task data to obtain target task data, and sends the target task data to the client, so that the client can execute data processing on the received target task data. Wherein n is a positive integer.
203. Storing the target task data and discarding the target task data;
in order to prevent the target task data from occupying storage resources of the client and save management cost of the client on the target task data, when the client finishes data processing of the target task data, the client does not store the target task data and discards the target task data so as to save storage space of the client.
Embodiments of the present application will be described in further detail below on the basis of the embodiments shown in the foregoing fig. 1 to 2. Referring to fig. 3, another embodiment of the data transmission method in the embodiment of the present application includes:
301. the server receives a data request sent by the client;
302. the server side responds to the data request to acquire n pieces of original task data;
The operations performed in steps 301 to 302 are similar to those performed in steps 101 to 102 in the embodiment shown in fig. 1, and will not be repeated here.
303. The server side assembles n original task data into target task data;
in this embodiment, the server may perform any form of assembly on the original task data. In one embodiment, each piece of raw task data corresponds to one piece of identification information, and the identification information is different between each piece of raw task data. When the original task data are assembled, the identification information of each original task data is used as a key, the original task data corresponding to each key is used as a value, and n key value pair data are formed. Thereafter, the n key-value pair data may be assembled into target task data.
For example, seq (reference numeral) is taken as the identification information of the original task data, seq1 is the identification information of the original task data 1, and seq2 is the identification information of the original task data 2. Taking seq1 as the key of the original task data 1 and seq2 as the key of the original task data 2, the key values of the data seq1: value1 and the data seq2: value2 can be formed respectively, wherein value1 refers to the original task data 1 and value2 refers to the original task data 2. Similarly, n key-value pair data may be formed.
It should be noted that the identification information of the original task data may be in any form, for example, may be letters, numbers or other text symbols, so long as the identification information can be used to identify a unique one of the original task data, which is not limited herein.
Specifically, the identification information may be a serial number, and the n pieces of identification information of the n pieces of original task data may be n serial numbers having an arrangement order. Therefore, after n key values are obtained for the data, the n key values may be sorted according to the arrangement sequence of the n serial numbers, and the sorted n key values may be assembled into the target task data.
For example, following the above example, n pieces of identification information may be the identification information of seq1, seq2, … …, seqn, which are sequentially arranged in order, and n pieces of key-value pair data of seq1: value1, seq2: value2, … …, seqn: value n may be formed. And then, sorting the data according to the arrangement sequence of the identification information corresponding to the data respectively by the n key values, and assembling the sorted n key values into target task data to obtain the target task data [ seq1: value1, seq2: value2, seq3: value3, …, seqn: value ].
The key value pair data and the ordered assembly are formed on the original task data, so that the client can quickly identify and disassemble multiple items of sub data in the target task data when receiving the target task data, and the processing of the target task data by the client is facilitated.
In addition, the method of assembling the original task data by the server may be an unordered method, that is, it is not necessary to assemble a plurality of original task data in any order, and the method is not particularly limited herein as long as the method is a method capable of assembling a plurality of original task data to obtain the target task data.
304. The server side backs up the target task data to obtain backup task data;
in this embodiment, in order to facilitate obtaining the backup task data, the server may backup the target task data to the cache, that is, establish a backup of the target task data in the cache.
The cache may be a Redi s cache, a Memcached cache, an Ehcache, or a Tair cache, and the specific cache type is not limited, and preferably a Redis cache is used.
In addition, in order to avoid occupying excessive storage space when backup task data is continuously increased, the server side can set the valid period of the backup task data, and delete the corresponding backup task data when the valid period is reached.
305. The server side responds to the data request and sends target task data to the client side;
the operations performed in this step are similar to those performed in step 105 in the embodiment shown in fig. 1, and will not be described here again.
306. The client performs data processing on the target task data;
and the client performs data processing on the target task data after receiving the target task data. The specific way of data processing may be data calculation, data analysis or data comparison and the like, and the specific way is not limited.
307. The client sends a subsequent data request to the server;
in the data processing process of the target task data, when abnormal conditions such as poor network conditions, shutdown, restarting and the like occur to the control equipment of the client, part or all of the target task data may be lost. In this case, since the server side has established the backup of the target task data, the client side may request the data to the server side again, that is, send a subsequent data request to the server side, where m is a positive integer, and m is less than or equal to n, for requesting the server side to send m pieces of original task data in the backup task data, that is, the data requested by the subsequent data request may be part or all of the original task data in the backup task data.
308. The server responds to the subsequent data requests and extracts m pieces of original task data corresponding to the subsequent data requests from the backup task data;
after receiving the subsequent data request of the client, the server extracts m pieces of original task data corresponding to the subsequent data request from the backup task data.
Specifically, the subsequent data request of the client may include a sequence number corresponding to each original task data in the m original task data, where the m sequence numbers have an arrangement sequence. Therefore, the server side can search the original task data corresponding to the m serial numbers in the backup task data according to the m serial numbers, and finally extract m original task data.
For example, following the example illustrated in step 303, after the target task data [ seq1: value1, seq2: value2, seq3: value3, …, seqn: value n ] is obtained, the target task data is backed up, and the obtained backup task data is also [ seq1: value1, seq2: value2, seq3: value3, …, seqn: value n ]. The subsequent data request of the client comprises sequence numbers of m original task data, the arrangement sequence of the m sequence numbers is seq1, seq3, seq4, seq8, … and seqm, and the server searches corresponding m original task data in the backup task data according to the m sequence numbers, so that the original task data respectively corresponding to the seq 1-seqm are obtained.
309. The server side assembles m pieces of original task data into data to be transmitted;
after m pieces of original task data corresponding to the subsequent data request are extracted, the server side assembles the m pieces of original task data, and the assembled m pieces of original task data can be called as data to be sent.
Specifically, each serial number of m serial numbers of the m original task data may be used as a key, and the original task data corresponding to each key may be used as a value, so as to form m key value pair data. And then, sorting the data according to the m key values according to the arrangement sequence of the m serial numbers, and assembling the sorted m key values into the data to be transmitted.
For example, following the example illustrated in step 308, when obtaining the raw task data corresponding to seq1 to seqm, each serial number of the m serial numbers is used as a key, and the raw task data corresponding to each key is used as a value, m key value pair data are formed, which are respectively seq1: value1, seq3: value3, seq4: value4, seq8: value8, …, seqm: value. And then, sorting the m key values according to the arrangement sequence of the m serial numbers, and assembling the m key values after sorting into data to be sent, so that the data to be sent is [ seq1: value1, seq3: value3, seq4: value4, seq8: value8, …, seqm: value ] can be obtained.
310. The client receives m pieces of original task data sent by the server based on the subsequent data request, and performs data processing by combining the m pieces of original task data;
after the server side assembles the data to be sent comprising m pieces of original task data based on the subsequent data request of the client side, the data to be sent is sent to the client side, so that the client side can receive the m pieces of needed original task data, and the data processing task can be continuously executed by combining the m pieces of original task data, so that the data processing of the target task data can be completed.
311. Storing the target task data and discarding the target task data;
the operation performed in this step is similar to the operation performed in step 203 in the embodiment shown in fig. 2, and will not be described here again.
312. The client sends processing progress information to the server;
when the data processing of the target task data is completed, the client sends processing progress information to the server, wherein the processing progress information indicates the current processing progress of the target task data, namely that the target task data is processed currently, and the client notifies the server that the target task data is processed.
The client may send the processing progress information synchronously or asynchronously. Asynchronous transmission has an advantage in that if the network condition is poor when the data processing is completed, the client can resume the normal retransmission of the processing progress information after a period of time without immediately transmitting the information when the data processing is completed, so that the network resources can be effectively utilized, and failure of information transmission can be avoided.
It should be noted that, when the data processing of the target task data is completed, the client may execute step 311 first, and then execute step 312; step 312 may be performed first, and then step 311 may be performed. The specific examples are not limited thereto.
313. The server deletes the backup task data according to the processing progress information;
after the server receives the processing progress information sent by the client, it can be determined that the target task data has completed data processing. At this time, it is no longer necessary to keep a backup of the target task data (i.e., backup task data) for the client. Therefore, the server deletes the backup task data according to the received processing progress information.
The effective storage mechanism of the cache refers to that data stored in the cache is automatically cleaned and deleted by the cache when the effective period is reached. Therefore, in this embodiment, if the backup task data is stored in the cache, since the valid period of the backup task data is set in the cache, the backup task data reaching the valid period can be automatically deleted when the target task data is obtained according to the processing progress information to complete the data processing based on the valid storage mechanism of the cache, thereby saving the storage space of the cache.
In addition, the server side can also directly delete the backup task data manually, namely, when the target task data is determined to finish data processing, the server side manually deletes the backup task data.
In this embodiment, when abnormal situations such as data loss occur, the client may send a subsequent data request to the server to request the same original task data in the backup task data, so as to further ensure idempotency of the data service of the server.
The data transmission method in the embodiment of the present application is described above, and the following describes a server in the embodiment of the present application, referring to fig. 4, in which an embodiment of the server in the embodiment of the present application includes:
a receiving unit 401, configured to receive a data request sent by a client, where the data request is used to request a server to send target task data;
an obtaining unit 402, configured to obtain n pieces of original task data in response to a data request, where each piece of original task data is a sub-item in the target task data, and n is a positive integer;
an assembling unit 403, configured to assemble n pieces of original task data into target task data;
the backup unit 404 is configured to backup the target task data to obtain backup task data, where the backup task data is used to provide backup task data in a subsequent data request of the client;
And the sending unit 405 is configured to send the target task data to the client in response to the data request.
In a preferred implementation manner of this embodiment, the receiving unit 401 is further configured to receive processing progress information sent by the client when completing data processing on the target task data, where the processing progress information is used to indicate a current processing progress of the target task data;
the server side further comprises:
and a deleting unit 406, configured to delete the backup task data according to the processing progress information.
In another preferred implementation manner of this embodiment, the backup unit 404 is specifically configured to backup target task data in a cache, obtain backup task data, and set an expiration date of the backup task data;
the deleting unit 406 is specifically configured to delete the backup task data when the valid period of the backup task data is reached according to the processing progress information based on the cached valid storage mechanism.
In another preferred implementation manner of this embodiment, each piece of original task data corresponds to one piece of identification information, and the identification information between each piece of original task data is different;
the assembling unit 403 is specifically configured to take the identification information of each piece of original task data as a key, take the original task data corresponding to the key as a value, form n pieces of key value pair data, and assemble the n pieces of key value pair data into target task data.
In another preferred implementation manner of this embodiment, n pieces of identification information of n pieces of original task data are n serial numbers with an arrangement sequence;
the assembling unit 403 is specifically configured to sort the n key values according to the arrangement order of the n serial numbers, and assemble the n sorted key values into the target task data.
In another preferred implementation manner of this embodiment, the receiving unit 401 is further configured to receive a subsequent data request of the client, where the subsequent data request is used to request the server to send m pieces of original task data in the backup task data, where m is a positive integer, and m is less than or equal to n;
the obtaining unit 402 is further configured to respond to the subsequent data request, and extract m pieces of original task data corresponding to the subsequent data request from the backup task data;
the assembling unit 403 is further configured to assemble m pieces of original task data into data to be transmitted, and transmit the data to be transmitted to the client.
In another preferred implementation manner of this embodiment, the subsequent data request includes a sequence number corresponding to each of m pieces of original task data, where m pieces of sequence numbers have an arrangement order;
the obtaining unit 402 is specifically configured to extract m pieces of original task data corresponding to the sequence numbers from the backup task data, to obtain m pieces of original task data;
The assembling unit 403 is specifically configured to use each serial number of the m serial numbers as a key, use original task data corresponding to each key as a value, form m key value pair data, sort the m key value pair data according to an arrangement sequence of the m serial numbers, and assemble the m sorted key value pair data into data to be sent.
In this embodiment, the operations performed by each unit in the server are similar to those described in the embodiments shown in fig. 1 and 3, and are not repeated here.
In this embodiment, after the assembling unit 403 assembles n pieces of original task data, target task data is obtained, and the backup unit 404 performs backup on the target task data, so as to obtain backup task data. When the client requests the data again, the acquiring unit 402 may extract the data required by the client from the backup task data and provide the data to the client, thereby ensuring that the same data can be provided to the client each time the client requests the data, and ensuring idempotent of the data service.
Referring to fig. 5, in an embodiment of the present application, a client includes:
a sending unit 501, configured to send a data request to a server, where the data request is used to request the server to send target task data;
A receiving unit 502, configured to receive target task data sent by a server based on a data request;
a data processing unit 503, configured to perform data processing on target task data, where the target task data is obtained by assembling n pieces of original task data by a server, and n is a positive integer;
and an execution unit 504 for, when the data processing of the target task data is completed, not storing the target task data and discarding the target task data.
In a preferred implementation manner of this embodiment, the sending unit 501 is further configured to asynchronously send, when data processing of the target task data is completed, processing progress information to the server, where the processing progress information is used to indicate a current processing progress of the target task data, so that the server deletes the backup task data according to the processing progress information.
In another preferred implementation manner of this embodiment, the data processing unit 503 is specifically configured to perform data processing on target task data, and when data loss occurs in the target task data, send a subsequent data request to the server, where the subsequent data request is used to request the server to send m pieces of original task data in backup task data, where m is a positive integer, and m is less than or equal to n, where the backup task data is backup of the target task data;
The receiving unit 502 is further configured to receive m pieces of original task data sent by the server based on the subsequent data request;
the data processing unit 503 is specifically configured to perform data processing in combination with m pieces of original task data.
In this embodiment, the operations performed by each unit in the client are similar to those described in the embodiments shown in fig. 2 and 3, and are not repeated here.
Referring to fig. 6, an embodiment of a server in the embodiment of the present application includes:
the server 600 may include one or more central processing units (central process ing units, CPU) 601 and a memory 605, where the memory 605 stores one or more application programs or data.
Wherein the memory 605 may be volatile storage or persistent storage. The program stored in the memory 605 may include one or more modules, each of which may include a series of instruction operations in the server. Still further, the central processor 601 may be configured to communicate with the memory 605 to execute a series of instruction operations in the memory 605 on the server 600.
The server 600 may also include one or more power supplies 602, one or more wired or wireless network interfaces 603, one or more input/output interfaces 604, and/or one or more operating systems, such as Windows ServerTM, mac OS XTM, unixTM, linuxTM, freeBSDTM, etc.
The cpu 601 may perform the operations performed by the service end in the embodiments shown in fig. 1 and 3, and detailed descriptions thereof are omitted herein.
Embodiments of the present application also provide a computer storage medium, where one embodiment includes: the computer storage medium stores instructions that, when executed on a computer, cause the computer to perform the operations performed by the server in the embodiments shown in fig. 1 and 3.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of elements is merely a logical functional division, and there may be additional divisions of actual implementation, e.g., multiple elements or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of 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.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a random access memory (RAM, random access memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.

Claims (12)

1. A data transmission method, applied to a server, the method comprising:
receiving a data request sent by a client, wherein the data request is used for requesting the server to send target task data;
responding to the data request, acquiring n pieces of original task data, wherein each piece of original task data is a sub-item in the target task data, and n is a positive integer;
assembling the n original task data into the target task data;
backing up the target task data to obtain backup task data, wherein the backup task data is used for providing the backup task data in a subsequent data request of the client; the backup task data are reserved or deleted according to the processing progress information of the target task data by the client;
and responding to the data request, and sending the target task data to the client.
2. The data transmission method according to claim 1, characterized in that the method further comprises:
receiving processing progress information sent by the client when the data processing of the target task data is completed, wherein the processing progress information is used for indicating the current processing progress of the target task data;
And deleting the backup task data according to the processing progress information.
3. The data transmission method according to claim 2, wherein the backing up the target task data includes:
backing up the target task data in a cache to obtain the backup task data, and setting the valid period of the backup task data;
the deleting the backup task data according to the processing progress information comprises the following steps:
and deleting the backup task data when the valid period of the backup task data is reached according to the processing progress information based on the effective storage mechanism of the cache.
4. The data transmission method according to claim 1, wherein each of the original task data corresponds to one piece of identification information, and the identification information is different between each of the original task data;
the assembling the n pieces of original task data into the target task data includes:
respectively taking the identification information of each piece of original task data as a key, taking the original task data corresponding to the key as a value, and forming n pieces of key value pair data;
and assembling the n key value data into the target task data.
5. The data transmission method according to claim 4, wherein n pieces of identification information of the n pieces of original task data are n serial numbers in which an arrangement order exists;
the assembling the n key value data into the target task data includes:
sorting the data by the n key values according to the arrangement sequence of the n serial numbers;
and assembling the sorted n key value data into the target task data.
6. The data transmission method according to any one of claims 1 to 5, wherein after the target task data is transmitted to the client, the method further comprises:
receiving a subsequent data request of the client, wherein the subsequent data request is used for requesting the server to send m pieces of original task data in the backup task data, and m is a positive integer and is less than or equal to n;
responding to the subsequent data request, and extracting m pieces of original task data corresponding to the subsequent data request from the backup task data;
and assembling the m pieces of original task data into data to be sent, and sending the data to be sent to the client.
7. The data transmission method according to claim 6, wherein the subsequent data request includes a sequence number corresponding to each of the m pieces of original task data, and m pieces of the sequence numbers have an arrangement order;
The extracting the m pieces of original task data corresponding to the subsequent data request from the backup task data includes:
extracting m original task data corresponding to the serial numbers respectively from the backup task data to obtain m original task data;
the assembling the m pieces of original task data into data to be sent includes:
taking each serial number in m serial numbers as a key, and taking original task data corresponding to each key as a value to form m key value pair data;
sorting the data according to the m key values according to the arrangement sequence of the m serial numbers;
and assembling the m sorted key value data into the data to be sent.
8. A data transmission method, applied to a client, the method comprising:
sending a data request to a server, wherein the data request is used for requesting the server to send target task data;
receiving the target task data sent by the server based on the data request, and performing data processing on the target task data, wherein the target task data is obtained by assembling n pieces of original task data by the server, and n is a positive integer; the target task data is provided with corresponding backup task data, the backup task data is generated by the server for backing up the target task data, the backup task data is used for providing the backup task data in a subsequent data request of the client, and the backup task data is reserved or deleted according to the processing progress information of the target task data by the client;
When the data processing of the target task data is completed, the target task data is not stored and discarded.
9. The data transmission method according to claim 8, characterized in that the method further comprises:
and when the data processing of the target task data is completed, asynchronously sending processing progress information to the server, wherein the processing progress information is used for indicating the current processing progress of the target task data, so that the server deletes the backup task data according to the processing progress information.
10. The data transmission method according to claim 8, wherein the performing data processing on the target task data includes:
performing data processing on the target task data, and when the target task data is lost, sending a subsequent data request to the server, wherein the subsequent data request is used for requesting the server to send m original task data in backup task data, and the backup task data is backup of the target task data, wherein m is a positive integer, and m is less than or equal to n;
and receiving the m pieces of original task data sent by the server based on the subsequent data request, and carrying out data processing by combining the m pieces of original task data.
11. A server, the server comprising:
the receiving unit is used for receiving a data request sent by the client, wherein the data request is used for requesting the server to send target task data;
the acquisition unit is used for responding to the data request and acquiring n pieces of original task data, wherein each piece of original task data is a sub-item in the target task data, and n is a positive integer;
an assembling unit, configured to assemble the n pieces of original task data into the target task data;
the backup unit is used for backing up the target task data to obtain backup task data, and the backup task data is used for providing the backup task data in a subsequent data request of the client; the backup task data are reserved or deleted according to the processing progress information of the target task data by the client;
and the sending unit is used for responding to the data request and sending the target task data to the client.
12. A server, comprising:
a processor, a memory, and an input/output device;
the processor is connected with the memory and the input and output equipment;
The input/output equipment is used for receiving a data request sent by the client, wherein the data request is used for requesting the server to send target task data;
the processor is configured to respond to the data request, obtain n pieces of original task data, where each piece of original task data is a subitem in the target task data, n is a positive integer, assemble the n pieces of original task data into the target task data, and backup the target task data to obtain backup task data, where the backup task data is used to provide the backup task data in a subsequent data request of the client; the backup task data are reserved or deleted according to the processing progress information of the target task data by the client;
the input and output device is further configured to send the target task data to the client in response to the data request.
CN202010646575.6A 2020-07-07 2020-07-07 Data transmission method and server Active CN111800512B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010646575.6A CN111800512B (en) 2020-07-07 2020-07-07 Data transmission method and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010646575.6A CN111800512B (en) 2020-07-07 2020-07-07 Data transmission method and server

Publications (2)

Publication Number Publication Date
CN111800512A CN111800512A (en) 2020-10-20
CN111800512B true CN111800512B (en) 2023-08-04

Family

ID=72810329

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010646575.6A Active CN111800512B (en) 2020-07-07 2020-07-07 Data transmission method and server

Country Status (1)

Country Link
CN (1) CN111800512B (en)

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103838762B (en) * 2012-11-26 2017-09-29 中国银联股份有限公司 Uninterrupted data processing unit and method based on tables of data rotation
CN106921712B (en) * 2015-12-28 2020-07-03 阿里巴巴集团控股有限公司 Service processing method and device

Also Published As

Publication number Publication date
CN111800512A (en) 2020-10-20

Similar Documents

Publication Publication Date Title
US9369521B2 (en) Naming of distributed business transactions
CN110427299B (en) Log processing method, related device and system for micro-service system application
CN110968478B (en) Log acquisition method, server and computer storage medium
CN106251202A (en) Maliciously order recognition methods and device
CN111046011B (en) Log collection method, system, device, electronic equipment and readable storage medium
CN112506702B (en) Disaster recovery method, device, equipment and storage medium for data center
CN107682172B (en) Control center device, service system processing method and medium
CN111818117A (en) Data updating method and device, storage medium and electronic equipment
CN102932391A (en) Method and device for processing data in peer to server/peer (P2SP) system, and P2SP system
CN110753084A (en) Uplink data reading method, cache server and computer readable storage medium
US20220035806A1 (en) Method and system for anomaly detection based on statistical closed-form isolation forest analysis
CN111177601B (en) Page rendering processing method, device, equipment and readable storage medium
CN112118153A (en) Grpc and spring mvc-based link monitoring method and system
CN111800512B (en) Data transmission method and server
CN110011845B (en) Log collection method and system
CN111800409B (en) Interface attack detection method and device
CN110134547B (en) Middleware-based repeated data deleting method and related device
WO2015129020A1 (en) Data transmission method and data transmission device
JP7004477B2 (en) Incident Response Assistance System, Incident Response Assistance Method and Incident Response Assistance Program
US20220405103A1 (en) Data processing system, data processing method, and data processing program
CN112637355B (en) Multi-concurrency single-channel based wireless data processing method, device, equipment and medium
JP2012230721A (en) System failure recovery method for virtual server and system for the same
CN111241135B (en) Commodity searching method, commodity searching device, computer equipment and storage medium
US20220334875A1 (en) Selection of candidate computing device to replace target computing device
US11757818B2 (en) Storage space optimization for emails

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant