Data transmission method, device, storage medium and electronic device
By hashing the response interface and response data, determining the target data and returning it to the client terminal, the problem of failure to effectively reduce network traffic transmission in the prior art is solved, and the effect of reducing network bandwidth occupation and improving data transmission speed is achieved.
Patent Information
- Application Number
- CN202211357661.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-01
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2042-11-01
AI Technical Summary
When the prior art optimizes the traffic transmission of network system, it still needs to transmit the traffic that originally needed to be transmitted, which fails to effectively reduce the transmission of service data network traffic and increases the system complexity.
By obtaining the request data transmitted by the client terminal, determining the response interface and response data based on the request data, hashing the attribute information and response data of the response interface to obtain the target hash value, and then determining the target data and returning it to the client terminal.
It reduces the amount of data transmission, effectively reduces the use of network bandwidth, improves the data transmission speed in the network, and solves the problem of large network transmission bandwidth occupancy without increasing costs.
Smart Images

Figure CN115801677B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data transmission, and in particular to a data transmission method, device, storage medium and electronic device. Background Art
[0002] In the Internet era, due to the explosive growth of data that needs to be transmitted, the requirements for Internet bandwidth are also increasing day by day. In order to prevent Internet bandwidth from affecting user experience, it is necessary to ensure network stability and data transmission without delay and lag. At present, the first way is to obtain the initial type information of the API by reading the service configuration of the API with the help of the API management server. The API management server determines the API pending strategy based on the API type information, and sends the determined processing strategy to the WOC to instruct the WOC to respond to the API pending data; the second way is to optimize the traffic transmission of the network system based on the current traffic between each network node and its corresponding weighted value.
[0003] However, the first method requires the use of an intermediate server for processing, which increases the overall complexity of the system; although the second method calculates the shortest path for traffic transmission, it still needs to transmit the traffic that originally needs to be transmitted, that is, it does not effectively reduce the transmission of business data network traffic. Summary of the invention
[0004] In view of this, an object of the embodiments of the present application is to provide a data transmission method, device, storage medium and electronic device for solving the problem of large network transmission bandwidth occupancy.
[0005] In a first aspect, an embodiment of the present application provides a data transmission method, which includes:
[0006] Obtain request data transmitted by the client terminal;
[0007] Determine a response interface and response data based on the request data;
[0008] Performing a hash calculation on the attribute information of the response interface to obtain a target first hash value, and performing a hash calculation on the response data to obtain a target second hash value;
[0009] Based on the target first hash value and the target second hash value, target data is determined, and the target data is returned to the client terminal.
[0010] In a possible implementation manner, performing hash calculation on the attribute information of the response interface to obtain a target first hash value includes:
[0011] Extracting the address information and / or user authentication information of the response interface, wherein the user authentication information includes the user identification and user password in the request data;
[0012] A target first hash value is obtained by at least performing a hash calculation on the address information and / or performing a hash calculation on the address information and the user authentication information.
[0013] In a possible implementation manner, performing hash calculation on the response data to obtain a target second hash value includes:
[0014] determining a frequency of requests from the client terminal;
[0015] When the request frequency is less than or equal to a preset threshold, performing hash calculation on the response data to obtain a target second hash value;
[0016] When the request frequency is greater than the preset threshold, a hash calculation is performed on part of the response data to obtain a target second hash value, wherein the part of the data is update data.
[0017] In a possible implementation manner, determining target data based on the target first hash value and the target second hash value, and returning the target data to the client terminal includes:
[0018] Determine from a first database a historical second hash value corresponding to the target first hash value, wherein the first database includes a mapping relationship between the historical first hash value and the historical second hash value;
[0019] Determining whether the historical second Hash value is the same as the target second Hash value;
[0020] If they are the same, the target second hash value is returned to the client terminal so that the client terminal obtains and displays the response data corresponding to the request data from the second database based on the target second hash value, wherein the second database includes a mapping relationship between historical second hash values and historical response data.
[0021] In a possible implementation manner, determining target data based on the target first hash value and the target second hash value, and returning the target data to the client terminal includes:
[0022] Determine from a first database a historical second hash value corresponding to the target first hash value, wherein the first database includes a mapping relationship between the historical first hash value and the historical second hash value;
[0023] Determining whether the historical second Hash value is the same as the target second Hash value;
[0024] If different, the target second hash value and the response data are returned to the client terminal, so that the client terminal displays the response data, and stores the mapping relationship between the target second hash value and the response data returned this time.
[0025] In a second aspect, an embodiment of the present application further provides a data transmission device, comprising:
[0026] An acquisition module configured to acquire request data transmitted by a client terminal;
[0027] A first determination module configured to determine a response interface and response data based on the request data;
[0028] a calculation module configured to perform a hash calculation on the attribute information of the response interface to obtain a target first hash value, and to perform a hash calculation on the response data to obtain a target second hash value;
[0029] The second determination module is configured to determine target data based on the target first hash value and the target second hash value, and return the target data to the client terminal.
[0030] In a possible implementation, the calculation module is specifically configured as follows:
[0031] Extracting the address information and / or user authentication information of the response interface, wherein the user authentication information includes the user identification and user password in the request data;
[0032] A hash calculation is performed on the address information to obtain a target first hash value, or a hash calculation is performed on the address information and the user authentication information to obtain a target first hash value.
[0033] In a possible implementation, the calculation module is further configured to:
[0034] determining a frequency of requests from the client terminal;
[0035] When the request frequency is less than or equal to a preset threshold, performing hash calculation on the response data to obtain a target second hash value;
[0036] When the request frequency is greater than the preset threshold, a hash calculation is performed on part of the response data to obtain a target second hash value, wherein the part of the data is update data.
[0037] In a third aspect, an embodiment of the present application further provides a storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the following steps are performed:
[0038] Obtain request data transmitted by the client terminal;
[0039] Determine a response interface and response data based on the request data;
[0040] Performing a hash calculation on the attribute information of the response interface to obtain a target first hash value, and performing a hash calculation on the response data to obtain a target second hash value;
[0041] Based on the target first hash value and the target second hash value, target data is determined, and the target data is returned to the client terminal.
[0042] In a fourth aspect, an embodiment of the present application further provides an electronic device, comprising: a processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the memory through a bus, and when the machine-readable instructions are executed by the processor, the following steps are performed:
[0043] Obtain request data transmitted by the client terminal;
[0044] Determine a response interface and response data based on the request data;
[0045] Performing a hash calculation on the attribute information of the response interface to obtain a target first hash value, and performing a hash calculation on the response data to obtain a target second hash value;
[0046] Based on the target first hash value and the target second hash value, target data is determined, and the target data is returned to the client terminal.
[0047] The embodiment of the present application obtains a target first hash value by performing a hash calculation on the attribute information of the response interface, and obtains a target second hash value by performing a hash calculation on the response data, and then determines the target data based on the target first hash value and the target second hash value, and returns the target data to the client terminal, wherein the target data may be response data or the target second hash value, thereby reducing the amount of data transmission, and thus being able to effectively reduce the occupancy of the network bandwidth to a certain extent, and improve the data transmission speed in the network, thereby solving the problem of large network transmission bandwidth occupancy without increasing costs.
[0048] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solutions in the present application or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0050] Figure 1 A flow chart of a data transmission method provided by the present application is shown;
[0051] Figure 2 A flowchart of performing hash calculation on attribute information of a response interface to obtain a target first hash value in a data transmission method provided by the present application is shown;
[0052] Figure 3 A flowchart of performing hash calculation on response data to obtain a target second hash value in a data transmission method provided by the present application is shown;
[0053] Figure 4 A flow chart showing a method for data transmission provided by the present application for determining target data based on a target first hash value and a target second hash value, and returning the target data to a client terminal;
[0054] Figure 5 A flowchart of an example of a data transmission method provided by the present application is shown;
[0055] Figure 6 A schematic diagram of the structure of a data transmission device provided by the present application is shown;
[0056] Figure 7 A schematic structural diagram of an electronic device provided by the present application is shown. DETAILED DESCRIPTION
[0057] Various aspects and features of the present application are described herein with reference to the accompanying drawings.
[0058] It should be understood that various modifications may be made to the embodiments of the present application. Therefore, the above description should not be considered as limiting, but only as an example of an embodiment. Other modifications within the scope and spirit of the present application will occur to those skilled in the art.
[0059] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.
[0060] These and other characteristics of the present application will become apparent from the following description of a preferred form of embodiment given as a non-limiting example with reference to the accompanying drawings.
[0061] It should also be understood that, although the present application has been described with reference to some specific examples, those skilled in the art will be able to realize many other equivalent forms of the present application that have the features described in the claims and are therefore within the scope of protection defined thereby.
[0062] The above and other aspects, features and advantages of the present application will become more apparent in view of the following detailed description when taken in conjunction with the accompanying drawings.
[0063] Specific embodiments of the present application are described hereinafter with reference to the accompanying drawings; however, it should be understood that the embodiments applied for are merely examples of the present application, which may be implemented in a variety of ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that obscure the present application. Therefore, the specific structural and functional details applied for herein are not intended to be limiting, but merely serve as a basis and representative basis for the claims to teach those skilled in the art to use the present application in a variety of ways with substantially any suitable detailed structure.
[0064] This specification may use the phrases "in one embodiment," "in another embodiment," "in yet another embodiment," or "in other embodiments," all of which may refer to one or more of the same or different embodiments according to the present application.
[0065] In the first aspect, in order to facilitate the understanding of the present application, a data transmission method provided by the present application is first described in detail. Figure 1 As shown, the data transmission method provided by the embodiment of the present application is as follows Figure 1 The method steps shown can solve the existing problem of large network transmission bandwidth occupancy. Specifically, the steps include S101-S104.
[0066] S101, obtaining request data transmitted by a client terminal.
[0067] In a specific implementation, the request data transmitted by the client terminal can represent a request for login, a request for access, a request for sending, etc., that is, all request data that can be transmitted through an application program interface (API) can be used as request data in an embodiment of the present application.
[0068] The client terminal may be an electronic device such as a computer, a laptop or a mobile phone in an intranet.
[0069] S102, determining a response interface and response data based on the request data.
[0070] After receiving the request data transmitted by the client terminal, the server or controller responds to the request data, that is, generates response data corresponding to the request data. For example, when the request data represents a request for login, the response data is a prompt page for successful login or the home page after completing the login, or a prompt page for failed login, etc.
[0071] At the same time, the response interface for data transmission for the client terminal is determined based on the attribute information of the client terminal, the current network status, and the current interface status. Of course, the response interface corresponding to the client terminal can also be determined based on the interface determination rules so that data can be transmitted for the client terminal through the response interface.
[0072] S103, performing hash calculation on the attribute information of the response interface to obtain a target first hash value, and performing hash calculation on the response data to obtain a target second hash value.
[0073] After determining the response interface, extract the attribute information of the response interface, and perform a hash calculation on the attribute information of the response interface to obtain a target first hash value. Figure 2 A flow chart of a method for performing hash calculation on attribute information of a response interface to obtain a target first hash value is shown, wherein specific steps include S201 and S202.
[0074] S201, extracting the address information and / or user authentication information of the response interface, wherein the user authentication information includes the user identification and user password in the request data.
[0075] S202: Obtain a target first hash value by at least performing a hash calculation on the address information and / or performing a hash calculation on the address information and user authentication information.
[0076] In a specific implementation, the address information and / or user authentication information of the response interface are extracted. Specifically, when the request data involves authority verification, such as a representation request for login, etc., the address information and user authentication information of the response interface are extracted, wherein the user authentication information includes the user ID and user password in the request data, so as to verify the client terminal through the user ID and user password; when the request data does not involve authority verification, such as a representation request for access, a request to send, etc., the address information of the response interface is extracted.
[0077] When the request data involves authority verification, the address information and user authentication information are hashed to obtain the target first hash value; when the request data does not involve authority verification, the address information is hashed to obtain the target first hash value, where the target first hash value is a string.
[0078] Similarly, after determining the response data, a hash calculation is performed on the response data to obtain a target second hash value. Optionally, Figure 3 A flow chart of a method for performing hash calculation on response data to obtain a target second hash value is shown, wherein specific steps include S301-S303.
[0079] S301, determining the request frequency from the client terminal.
[0080] S302: When the request frequency is less than or equal to a preset threshold, perform hash calculation on the response data to obtain a target second hash value.
[0081] S303, when the request frequency is greater than a preset threshold, performing hash calculation on part of the response data to obtain a target second hash value, wherein the part of the data is updated data.
[0082] Here, considering that the client terminal frequently obtains data within a certain period of time, in order to reduce the amount of data transmission, before performing hash calculation on the response data, the request frequency from the client terminal is first determined and compared with the preset threshold.
[0083] When the request frequency is less than or equal to the preset threshold, that is, the client terminal sends request data at a low frequency, that is, the response data returned for the request data may be quite different. Therefore, a hash calculation is performed on the response data to obtain the target second hash value.
[0084] In the case where the request frequency is greater than the preset threshold, that is, the client terminal sends the request data at a high frequency, that is, the response data returned for the request data may be less different. At this time, the response data can be disassembled, and then a hash calculation is performed on part of the response data to obtain the target second hash value, where the part of the data is the updated data. Optionally, the updated data in the response data can be determined in real time or at a preset update position.
[0085] Optionally, the hash calculation may adopt md5.
[0086] S104, determining target data based on the target first hash value and the target second hash value, and returning the target data to the client terminal.
[0087] After obtaining the target first hash value and the target second hash value, the target data is determined based on the target first hash value and the target second hash value, and then the determined target data is returned to the client terminal. As one example, Figure 4A flow chart of a method for determining target data based on a target first hash value and a target second hash value and returning the target data to a client terminal is shown, wherein specific steps include S401-S404.
[0088] S401, determining a historical second Hash value corresponding to a target first Hash value from a first database, wherein the first database includes a mapping relationship between the historical first Hash value and the historical second Hash value.
[0089] S402: Determine whether the historical second Hash value is the same as the target second Hash value.
[0090] S403, if the two are the same, returning the target second hash value to the client terminal, so that the client terminal obtains and displays the response data corresponding to the request data from the second database based on the target second hash value, wherein the second database includes a mapping relationship between historical second hash values and historical response data.
[0091] S404: If they are different, returning the target second Hash value and the response data to the client terminal so that the client terminal displays the response data, and constructing and storing a mapping relationship between the target second Hash value and the response data.
[0092] In a specific implementation, the first database can be a database of a response interface, a cache database, or a hasap in java, etc., as long as it is a storage unit that supports temporary storage of data. Optionally, the first database is implemented using a Hash Map.
[0093] After obtaining the target first hash value and the target second hash value, determine the historical second hash value corresponding to the target first hash value from the first database, and optionally determine whether the first database includes the same historical first hash value as the target first hash value. If so, determine the historical second hash value corresponding to the historical first hash value as the historical second hash value corresponding to the target first hash value. The first database includes a mapping relationship between the historical first hash value and the historical second hash value, and the generation process of the historical first hash value and the historical second hash value is the same as the generation process of the target first hash value and the target second hash value, which will not be described in detail here.
[0094] After obtaining the historical second hash value corresponding to the target first hash value, determine whether the historical second hash value is the same as the target second hash value. If the same, it indicates that the client terminal has requested the response data within the target time period, wherein the target time period is a preset time period starting from the current time point. At this time, the target second hash value is returned to the client terminal so that the client terminal obtains the response data corresponding to the request data from the second database based on the target second hash value, wherein the second database includes a mapping relationship between the historical second hash value and the historical response data, and optionally, the second database is implemented using Index DB technology. Afterwards, the client terminal displays the response data to complete the response to the request data. In other words, in the case of determining that the client terminal has requested the response data within the target time period, there is no need to transmit the response data again, and only the second hash value corresponding to the response data needs to be transmitted, which greatly reduces the amount of data transmission, thereby effectively reducing the occupancy of the network bandwidth, and improving the data transmission speed in the network, that is, solving the problem of large network transmission bandwidth occupancy without increasing costs.
[0095] It is worth noting that after receiving the target second hash value and the response data, the client terminal constructs a mapping relationship between the target second hash value and the response data, and stores the mapping relationship in a second database that exists in the client terminal.
[0096] In addition, when the historical second hash value is different from the target second hash value, that is, the response data has not been requested within the target time period, the target second hash value and the response data are directly returned to the client terminal so that the client terminal displays the response data to complete the data transmission; at the same time, a mapping relationship between the target second hash value and the response data is constructed and stored.
[0097] Of course, there is also a historical second hash value corresponding to the target first hash value in the first database, that is, the client terminal has never made a data request through the response interface, or the client terminal has never made a data request to the server. At this time, the target second hash value and the response data are also directly returned to the client terminal, and the mapping relationship between the target second hash value and the response data is constructed and stored; at the same time, the mapping relationship between the target first hash value and the target second hash value is constructed and stored.
[0098] The embodiment of the present application obtains a target first hash value by performing a hash calculation on the attribute information of the response interface, and obtains a target second hash value by performing a hash calculation on the response data, and then determines the target data based on the target first hash value and the target second hash value, and returns the target data to the client terminal, wherein the target data may be response data or the target second hash value, thereby reducing the amount of data transmission, and thus being able to effectively reduce the occupancy of the network bandwidth to a certain extent, and improve the data transmission speed in the network, thereby solving the problem of large network transmission bandwidth occupancy without increasing costs.
[0099] The embodiment of the present application preferably adopts a web application system implemented in a browser / server mode (Browser / Server, B / S architecture).
[0100] As one example, Figure 5 A flowchart of data transmission between a client terminal and a service server is shown, and the specific steps are as follows:
[0101] When the client terminal user logs in to the management system and opens the system homepage, during the login operation, the client terminal sends request data, which carries the API information for calling the device map service data, such as the API address information of / index / deviceAddress and the user authentication information of {"userId":"123456"}.
[0102] After determining the API, the request data is sent to the business server through the API. After receiving the request data, the business server responds to the request data to obtain response data, that is, Result Data, such as Result Data {"Beijing":[{"xxx device":{ / / device information}]}.
[0103] After that, perform md5 (i.e., hash algorithm) on the api information to obtain api And Params Key, and perform md5 on ResultData to obtain new Result Data Hash. Further, based on the api And Params Key, obtain old Result Data Hash from the first database, which is a global Hash Map created by the business server, wherein the data model stored in the Hash Map is {"api And Params Key":"Result Data Hash (i.e., the md5 value of Result Data)"}.
[0104] If the old Result Data Hash is different from the new Result Data Hash, the Result Data and the new Result Data Hash are sent to the client terminal. After receiving the Result Data and the new Result Data Hash, the client terminal displays the Result Data and stores the Result Data and the new Result Data Hash in the second database, wherein the data model during storage can be set to {"result Data Hash":"result Data" (i.e., the business data of the API interface response)}.
[0105] If the old Result Data Hash is the same as the new Result Data Hash, the new Result Data Hash is sent to the client terminal. After receiving the new Result Data Hash, the client terminal obtains the Result Data from the second database based on the new Result Data Hash and displays it.
[0106] From the above example, it can be seen that when the data size of Result Data is 100kb, the data size of new Result Data Hash obtained by using the hash algorithm may be only about 1kb. Without sending Result Data, only sending new Result Data Hash can also enable the client terminal to obtain Result Data, thereby achieving the purpose of reducing data transmission volume, effectively reducing network bandwidth occupancy, and improving data transmission speed in the network.
[0107] Based on the same inventive concept, the second aspect of the present application also provides a data transmission device corresponding to a data transmission method. Since the principle of solving the problem by the data transmission device in the present application is similar to the above-mentioned data transmission method of the present application, the implementation of the data transmission device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0108] Figure 6 A schematic diagram of a data transmission device provided in an embodiment of the present application is shown, which specifically includes:
[0109] An acquisition module 601 is configured to acquire request data transmitted by a client terminal;
[0110] A first determination module 602, configured to determine a response interface and response data based on the request data;
[0111] A calculation module 603 is configured to perform a hash calculation on the attribute information of the response interface to obtain a target first hash value, and to perform a hash calculation on the response data to obtain a target second hash value;
[0112] The second determination module 604 is configured to determine target data based on the target first hash value and the target second hash value, and return the target data to the client terminal.
[0113] In yet another embodiment, the calculation module 603 is specifically configured as follows:
[0114] Extracting the address information and / or user authentication information of the response interface, wherein the user authentication information includes the user identification and user password in the request data;
[0115] A target first hash value is obtained by at least performing a hash calculation on the address information and / or performing a hash calculation on the address information and the user authentication information.
[0116] In yet another embodiment, the calculation module 603 is further configured to:
[0117] determining a frequency of requests from the client terminal;
[0118] When the request frequency is less than or equal to a preset threshold, performing hash calculation on the response data to obtain a target second hash value;
[0119] When the request frequency is greater than the preset threshold, a hash calculation is performed on part of the response data to obtain a target second hash value, wherein the part of the data is update data.
[0120] In yet another embodiment, the second determining module 604 is specifically configured as follows:
[0121] Determine from a first database a historical second hash value corresponding to the target first hash value, wherein the first database includes a mapping relationship between the historical first hash value and the historical second hash value;
[0122] Determining whether the historical second Hash value is the same as the target second Hash value;
[0123] If they are the same, the target second hash value is returned to the client terminal so that the client terminal obtains and displays the response data corresponding to the request data from the second database based on the target second hash value, wherein the second database includes a mapping relationship between historical second hash values and historical response data.
[0124] In yet another embodiment, the second determining module 604 is further configured to:
[0125] Determine from a first database a historical second hash value corresponding to the target first hash value, wherein the first database includes a mapping relationship between the historical first hash value and the historical second hash value;
[0126] Determining whether the historical second Hash value is the same as the target second Hash value;
[0127] If different, the target second hash value and the response data are returned to the client terminal, so that the client terminal displays the response data, and stores the mapping relationship between the target second hash value and the response data returned this time.
[0128] The embodiment of the present application obtains a target first hash value by performing a hash calculation on the attribute information of the response interface, and obtains a target second hash value by performing a hash calculation on the response data, and then determines the target data based on the target first hash value and the target second hash value, and returns the target data to the client terminal, wherein the target data may be response data or the target second hash value, thereby reducing the amount of data transmission, and thus being able to effectively reduce the occupancy of the network bandwidth to a certain extent, and improve the data transmission speed in the network, thereby solving the problem of large network transmission bandwidth occupancy without increasing costs.
[0129] An embodiment of the present application provides a storage medium, which is a computer-readable medium and stores a computer program. When the computer program is executed by a processor, the method provided by any embodiment of the present application is implemented, including the following steps S11 to S14:
[0130] S11, obtaining request data transmitted by the client terminal;
[0131] S12, determining a response interface and response data based on the request data;
[0132] S13, performing hash calculation on the attribute information of the response interface to obtain a target first hash value, and performing hash calculation on the response data to obtain a target second hash value;
[0133] S14, determining target data based on the target first hash value and the target second hash value, and returning the target data to the client terminal.
[0134] When the computer program is executed by the processor to perform hash calculation on the attribute information of the response interface to obtain the target first hash value, the processor also executes the following steps: extracting the address information and / or user authentication information of the response interface, wherein the user authentication information includes the user identifier and user password in the request data; and obtaining the target first hash value by at least performing hash calculation on the address information and / or performing hash calculation on the address information and the user authentication information.
[0135] When the computer program is executed by the processor to perform hash calculation on the response data to obtain a target second hash value, the processor also executes the following steps: determining the request frequency from the client terminal; when the request frequency is less than or equal to a preset threshold, performing hash calculation on the response data to obtain a target second hash value; when the request frequency is greater than the preset threshold, performing hash calculation on part of the response data to obtain the target second hash value, wherein the part of the data is update data.
[0136] When the computer program is executed by the processor to determine the target data based on the target first hash value and the target second hash value and return the target data to the client terminal, the processor also executes the following steps: determining the historical second hash value corresponding to the target first hash value from the first database, wherein the first database includes a mapping relationship between the historical first hash value and the historical second hash value; determining whether the historical second hash value is the same as the target second hash value; if they are the same, returning the target second hash value to the client terminal, so that the client terminal obtains and displays the response data corresponding to the request data from the second database based on the target second hash value, wherein the second database includes a mapping relationship between the historical second hash value and the historical response data.
[0137] When the computer program is executed by the processor to determine the target data based on the target first hash value and the target second hash value and return the target data to the client terminal, the processor also executes the following steps: determining the historical second hash value corresponding to the target first hash value from a first database, wherein the first database includes a mapping relationship between the historical first hash value and the historical second hash value; determining whether the historical second hash value is the same as the target second hash value; if different, returning the target second hash value and the response data to the client terminal so that the client terminal displays the response data and stores the mapping relationship between the target second hash value returned this time and the response data.
[0138] The embodiment of the present application obtains a target first hash value by performing a hash calculation on the attribute information of the response interface, and obtains a target second hash value by performing a hash calculation on the response data, and then determines the target data based on the target first hash value and the target second hash value, and returns the target data to the client terminal, wherein the target data may be response data or the target second hash value, thereby reducing the amount of data transmission, and thus being able to effectively reduce the occupancy of the network bandwidth to a certain extent, and improve the data transmission speed in the network, thereby solving the problem of large network transmission bandwidth occupancy without increasing costs.
[0139] The present application also provides an electronic device. The structural diagram of the electronic device can be as follows: Figure 7 As shown, at least a memory 701 and a processor 702 are included, the memory 701 stores a computer program, and the processor 702 implements the method provided by any embodiment of the present application when executing the computer program on the memory 701. Exemplarily, the steps of the electronic device computer program are as follows S21 to S24:
[0140] S21, obtaining request data transmitted by the client terminal;
[0141] S22, determining a response interface and response data based on the request data;
[0142] S23, performing hash calculation on the attribute information of the response interface to obtain a target first hash value, and performing hash calculation on the response data to obtain a target second hash value;
[0143] S24, determining target data based on the target first hash value and the target second hash value, and returning the target data to the client terminal.
[0144] When the processor performs hash calculation on the attribute information of the response interface stored in the execution memory to obtain the target first hash value, it also executes the following computer program: extracting the address information and / or user authentication information of the response interface, wherein the user authentication information includes the user identifier and user password in the request data; and obtaining the target first hash value by at least performing hash calculation on the address information and / or performing hash calculation on the address information and the user authentication information.
[0145] When the processor performs a hash calculation on the response data stored in the execution memory to obtain a target second hash value, it also executes the following computer program: determining a request frequency from the client terminal; when the request frequency is less than or equal to a preset threshold, performing a hash calculation on the response data to obtain a target second hash value; when the request frequency is greater than the preset threshold, performing a hash calculation on part of the response data to obtain a target second hash value, wherein the part of the data is update data.
[0146] When the processor determines the target data based on the target first hash value and the target second hash value stored in the execution memory and returns the target data to the client terminal, it also executes the following computer program: determining the historical second hash value corresponding to the target first hash value from the first database, wherein the first database includes a mapping relationship between the historical first hash value and the historical second hash value; determining whether the historical second hash value is the same as the target second hash value; if they are the same, returning the target second hash value to the client terminal, so that the client terminal obtains and displays the response data corresponding to the request data from the second database based on the target second hash value, wherein the second database includes a mapping relationship between the historical second hash value and the historical response data.
[0147] When the processor determines the target data based on the target first hash value and the target second hash value stored in the execution memory and returns the target data to the client terminal, it also executes the following computer program: determining the historical second hash value corresponding to the target first hash value from the first database, wherein the first database includes a mapping relationship between the historical first hash value and the historical second hash value; determining whether the historical second hash value is the same as the target second hash value; if different, returning the target second hash value and the response data to the client terminal so that the client terminal displays the response data, and storing the mapping relationship between the target second hash value returned this time and the response data.
[0148] The embodiment of the present application obtains a target first hash value by performing a hash calculation on the attribute information of the response interface, and obtains a target second hash value by performing a hash calculation on the response data, and then determines the target data based on the target first hash value and the target second hash value, and returns the target data to the client terminal, wherein the target data may be response data or the target second hash value, thereby reducing the amount of data transmission, and thus being able to effectively reduce the occupancy of the network bandwidth to a certain extent, and improve the data transmission speed in the network, thereby solving the problem of large network transmission bandwidth occupancy without increasing costs.
[0149] Optionally, in this embodiment, the above-mentioned storage medium may include, but is not limited to, various media that can store program codes, such as a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk. Optionally, in this embodiment, the processor executes the method steps recorded in the above-mentioned embodiment according to the program code stored in the storage medium. Optionally, the specific examples in this embodiment can refer to the examples described in the above-mentioned embodiment and the optional implementation mode, and this embodiment is not repeated here. Obviously, those skilled in the art should understand that the above-mentioned modules or steps of the present application can be implemented with a general computing device, which can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices. Optionally, they can be implemented with executable program codes of computing devices, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from here, or they can be made into individual integrated circuit modules respectively, or multiple modules or steps in them can be made into a single integrated circuit module to implement. In this way, the present application is not limited to any specific combination of hardware and software.
[0150] In addition, although exemplary embodiments have been described herein, the scope includes any and all embodiments based on the present application with equivalent elements, modifications, omissions, combinations (e.g., various embodiments intersecting schemes), adaptations or changes. The elements in the claims will be interpreted broadly based on the language adopted in the claims, and are not limited to the examples described in this specification or during the implementation of the application, and the examples will be interpreted as non-exclusive. Therefore, this specification and examples are intended to be considered as examples only, and the true scope and spirit are indicated by the following claims and the full scope of their equivalents.
[0151] The above description is intended to be illustrative rather than restrictive. For example, the above examples (or one or more of them) can be used in combination with each other. For example, those of ordinary skill in the art can use other embodiments when reading the above description. In addition, in the above-mentioned specific embodiments, various features can be grouped together to simplify the application. This should not be interpreted as an intention that a disclosed feature that does not require protection is necessary for any claim. On the contrary, the subject matter of the present application may be less than all the features of a specific disclosed embodiment. Thus, the following claims are incorporated into the specific embodiments as examples or embodiments, wherein each claim is independently used as a separate embodiment, and it is considered that these embodiments can be combined with each other in various combinations or arrangements. The scope of the present application should be determined with reference to the attached claims and the full scope of equivalent forms granted by these claims.
[0152] Multiple embodiments of the present application are described in detail above, but the present application is not limited to these specific embodiments. Those skilled in the art can make various variations and modifications to the embodiments based on the concept of the present application, and these variations and modifications should all fall within the scope of protection required by the present application.
Claims
1. A data transmission method, characterized in that: include: Obtain request data transmitted by the client terminal; Determine a response interface and response data based on the request data; Performing a hash calculation on the attribute information of the response interface to obtain a target first hash value, and performing a hash calculation on the response data to obtain a target second hash value; Determine target data based on the target first hash value and the target second hash value, and return the target data to the client terminal; The determining target data based on the target first hash value and the target second hash value, and returning the target data to the client terminal, comprises: Determine from a first database a historical second hash value corresponding to the target first hash value, wherein the first database includes a mapping relationship between the historical first hash value and the historical second hash value; Determining whether the historical second Hash value is the same as the target second Hash value; If they are the same, returning the target second hash value to the client terminal, so that the client terminal obtains and displays the response data corresponding to the request data from a second database based on the target second hash value, wherein the second database includes a mapping relationship between historical second hash values and historical response data; If different, the target second hash value and the response data are returned to the client terminal, so that the client terminal displays the response data, and stores the mapping relationship between the target second hash value and the response data returned this time.
2. The data transmission method according to claim 1, characterized in that: The performing hash calculation on the attribute information of the response interface to obtain a target first hash value includes: Extracting the address information and / or user authentication information of the response interface, wherein the user authentication information includes the user identification and user password in the request data; A target first hash value is obtained by at least performing a hash calculation on the address information and / or performing a hash calculation on the address information and the user authentication information.
3. The data transmission method according to claim 1, characterized in that: The performing hash calculation on the response data to obtain a target second hash value includes: determining a frequency of requests from the client terminal; When the request frequency is less than or equal to a preset threshold, performing hash calculation on the response data to obtain a target second hash value; When the request frequency is greater than the preset threshold, a hash calculation is performed on part of the response data to obtain a target second hash value, wherein the part of the data is update data.
4. A data transmission device, characterized in that: include: An acquisition module configured to acquire request data transmitted by a client terminal; A first determination module, configured to determine a response interface and response data based on the request data; a calculation module configured to perform a hash calculation on the attribute information of the response interface to obtain a target first hash value, and to perform a hash calculation on the response data to obtain a target second hash value; A second determination module configured to determine target data based on the target first hash value and the target second hash value, and return the target data to the client terminal; The second determination module is specifically configured as follows: Determine from a first database a historical second hash value corresponding to the target first hash value, wherein the first database includes a mapping relationship between the historical first hash value and the historical second hash value; Determining whether the historical second Hash value is the same as the target second Hash value; If they are the same, returning the target second hash value to the client terminal, so that the client terminal obtains and displays the response data corresponding to the request data from a second database based on the target second hash value, wherein the second database includes a mapping relationship between historical second hash values and historical response data; If different, the target second hash value and the response data are returned to the client terminal, so that the client terminal displays the response data, and stores the mapping relationship between the target second hash value and the response data returned this time.
5. The data transmission device according to claim 4, characterized in that: The calculation module is specifically configured as follows: Extracting the address information and / or user authentication information of the response interface, wherein the user authentication information includes the user identification and user password in the request data; A target first hash value is obtained by at least performing a hash calculation on the address information and / or performing a hash calculation on the address information and the user authentication information.
6. The data transmission device according to claim 4, characterized in that: The computing module is further configured as: determining a frequency of requests from the client terminal; When the request frequency is less than or equal to a preset threshold, performing hash calculation on the response data to obtain a target second hash value; When the request frequency is greater than the preset threshold, a hash calculation is performed on part of the response data to obtain a target second hash value, wherein the part of the data is update data.
7. A storage medium, characterized in that: The computer readable storage medium stores a computer program, which executes the following steps when executed by a processor: Obtain request data transmitted by the client terminal; Determine a response interface and response data based on the request data; Performing a hash calculation on the attribute information of the response interface to obtain a target first hash value, and performing a hash calculation on the response data to obtain a target second hash value; Determine target data based on the target first hash value and the target second hash value, and return the target data to the client terminal; The determining target data based on the target first hash value and the target second hash value, and returning the target data to the client terminal, comprises: Determine from a first database a historical second hash value corresponding to the target first hash value, wherein the first database includes a mapping relationship between the historical first hash value and the historical second hash value; Determining whether the historical second Hash value is the same as the target second Hash value; If they are the same, returning the target second hash value to the client terminal, so that the client terminal obtains and displays the response data corresponding to the request data from a second database based on the target second hash value, wherein the second database includes a mapping relationship between historical second hash values and historical response data; If different, the target second hash value and the response data are returned to the client terminal, so that the client terminal displays the response data, and stores the mapping relationship between the target second hash value and the response data returned this time.
8. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor and the memory communicate via a bus. When the machine-readable instructions are executed by the processor, the following steps are performed: Obtain request data transmitted by the client terminal; Determine a response interface and response data based on the request data; Performing a hash calculation on the attribute information of the response interface to obtain a target first hash value, and performing a hash calculation on the response data to obtain a target second hash value; Determine target data based on the target first hash value and the target second hash value, and return the target data to the client terminal; The determining target data based on the target first hash value and the target second hash value, and returning the target data to the client terminal, comprises: Determine from a first database a historical second hash value corresponding to the target first hash value, wherein the first database includes a mapping relationship between the historical first hash value and the historical second hash value; Determining whether the historical second Hash value is the same as the target second Hash value; If they are the same, returning the target second hash value to the client terminal, so that the client terminal obtains and displays the response data corresponding to the request data from a second database based on the target second hash value, wherein the second database includes a mapping relationship between historical second hash values and historical response data; If different, the target second hash value and the response data are returned to the client terminal, so that the client terminal displays the response data, and stores the mapping relationship between the target second hash value and the response data returned this time.
Citation Information
Patent Citations
Page redrawing method, device and equipment and storage medium
CN112214270A
Method and device for realizing transparent tandem connection, electronic equipment and storage medium
CN112866115A