CN107819806B - Method, device and system for optimizing APP interface data - Google Patents

Method, device and system for optimizing APP interface data Download PDF

Info

Publication number
CN107819806B
CN107819806B CN201610824810.8A CN201610824810A CN107819806B CN 107819806 B CN107819806 B CN 107819806B CN 201610824810 A CN201610824810 A CN 201610824810A CN 107819806 B CN107819806 B CN 107819806B
Authority
CN
China
Prior art keywords
data
app
static
static data
server
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
CN201610824810.8A
Other languages
Chinese (zh)
Other versions
CN107819806A (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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201610824810.8A priority Critical patent/CN107819806B/en
Publication of CN107819806A publication Critical patent/CN107819806A/en
Application granted granted Critical
Publication of CN107819806B publication Critical patent/CN107819806B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • 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/565Conversion or adaptation of application format or content
    • H04L67/5651Reducing the amount or size of exchanged application data
    • 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

Landscapes

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

Abstract

The application discloses a method for optimizing APP interface data by an APP terminal and a device for optimizing the APP interface data by the APP terminal; and a method for optimizing APP interface data at a server corresponding to the above method, and a device for optimizing APP interface data at a server corresponding to the above device, and a system for optimizing APP interface data. The method for optimizing the APP interface data at the APP end comprises the following steps: the APP interface sends a data query request to the server side; receiving service data corresponding to the data query request returned by the server; and combining the current static data with the dynamic data in the service data returned by the server side to form complete data. By adopting the method, the problem that the method for reducing the APP interface data in the prior art is not universal enough is solved.

Description

Method, device and system for optimizing APP interface data
Technical Field
The application relates to the field of data communication, in particular to a method for optimizing APP interface data by an APP terminal and a device for optimizing the APP interface data by the APP terminal; the application also relates to a method for optimizing the APP interface data at the server side and a device for optimizing the APP interface data at the server side; and a system for optimizing APP interface data.
Background
In a wireless network environment, due to the fact that position movement, obstacle blocking and relatively poor wired network infrastructure, packet loss rate and retransmission rate are relatively high under a wireless condition. When the interface data is large, the data exceeds the maximum transmission unit of the network channel, and the data is sent in a sub-package mode. The larger the data packet is, the more the packets are divided, the higher the probability of packet loss and retransmission is, so that the longer the time for the client to receive the complete data is, and the display speed of the page is influenced finally. Therefore, for data of an application program (APP) interface, the smaller the data is, the better the data can be returned in a transmission unit, and therefore, the page is displayed fastest and the user experience is best.
At present, the industry does not have a general solution to the problem, and a common mode is to specifically analyze a related interface, then simplify a result data field, and finally achieve the purpose of reducing APP interface data.
Based on the current mode in the industry, the method is relatively not general enough, and research personnel are required to perform specific analysis on each interface to reduce APP interface data.
In summary, the methods for reducing the APP interface data in the prior art are not general enough, and companies that research and develop APP need to technically invest a large amount of manpower to optimize the interface data, which wastes human resources and increases development cost.
Disclosure of Invention
The application provides a method for optimizing APP interface data by an APP terminal and a device for optimizing the APP interface data by the APP terminal; the application also provides a method for optimizing the APP interface data at the server side and a device for optimizing the APP interface data at the server side; and a system for optimizing APP interface data, which aims to solve the problem that the method for reducing the APP interface data in the prior art is not universal.
The embodiment of the application provides a method for optimizing APP interface data at an APP terminal, which comprises the following steps:
the APP interface sends a data query request to the server side;
receiving service data corresponding to the data query request returned by the server;
and combining the current static data with the dynamic data in the service data returned by the server side to form complete data.
Optionally, the data query request includes a static data parameter; before the step of sending the data query request to the server side by the APP interface, the method further includes:
inquiring whether the APP end has cache static data corresponding to the data to be inquired by the data inquiry request; and if so, setting the value of the static data parameter in the data query request as a state value indicating that the cache static data exists at the APP terminal.
Optionally, the querying whether the APP side has cached static data corresponding to the data to be queried by the data query request includes:
generating a cache key according to the data query request; and inquiring whether cache static data corresponding to the data to be inquired by the data inquiry request exists in the APP local cache according to the cache key.
Optionally, the static data parameters include:
the md5 value of the cached static data.
Optionally, the method includes:
and if the result that whether the cache static data corresponding to the data to be inquired by the data inquiry request exists at the APP terminal is negative, setting the value of the static data parameter as a state value indicating that the cache static data does not exist at the APP terminal.
Optionally, the service data returned by the server includes: dynamic data, or, includes: dynamic data and static data.
Optionally, the current static data includes:
if the service data returned by the server only contains dynamic data, the current static data is the cache static data of the APP local cache;
and if the service data returned by the server side contains dynamic data and static data, the current static data is the static data returned by the server side.
Optionally, before the step of combining the current static data with the dynamic data in the service data returned by the server to form complete data, the method further includes:
and if the service data returned by the server side contains dynamic data and static data, updating the cached static data by adopting the static data returned by the server side.
The embodiment of the application also provides a method for optimizing APP interface data at a server side, which comprises the following steps:
receiving a data query request of an APP interface;
identifying service identification information contained in the data query request, and acquiring data of a corresponding service according to the service identification information;
separating static data from dynamic data in the service data;
and at least sending the dynamic data to the APP terminal according to a preset condition.
Optionally, the method includes:
the data query request comprises static data parameters.
Optionally, the values of the static data parameters include:
and the state value of the cached static data in the data query request.
Optionally, the static data parameters include:
the md5 value of the cached static data in the data query request.
Optionally, the predetermined condition includes:
the static data and/or the dynamic data are transmitted at certain time intervals.
Optionally, the sending at least the dynamic data to the APP end includes:
judging whether the static data is the same as the cached static data of the data to be inquired by the data inquiry request; if so, the server side sends the dynamic data to the APP side; and if not, the server side sends the dynamic data and the static data to the APP side.
Optionally, the determining whether the static data is the same as the cached static data of the data to be queried by the data query request includes:
judging whether the md5 value of the cached static data of the data to be inquired by the data inquiry request is the same as the md5 value of the static data;
if so, judging that the static data is the same as the cached static data of the data to be inquired by the data inquiry request;
if not, the static data is judged to be different from the cache static data of the data to be inquired by the data inquiry request.
The embodiment of the application further provides a device for optimizing APP interface data at the APP end, the device includes:
the request unit is used for sending a data query request to the server side by the APP interface;
the receiving unit is used for receiving the service data which is returned by the server and corresponds to the data query request;
and the merging unit is used for merging the current static data and the dynamic data returned by the server side by the APP side according to the service data returned by the receiving unit to form complete data.
The embodiment of the present application further provides a device for optimizing APP interface data at a server side, the device includes:
the device comprises a receiving unit, a processing unit and a processing unit, wherein the receiving unit is used for receiving a data query request of an APP interface;
an obtaining unit, configured to identify service identification information included in the data query request in the receiving unit, and obtain data of a corresponding service according to the service identification information;
the separation unit is used for separating static data and dynamic data in the service data in the acquisition unit;
and the sending unit is used for sending the dynamic data to the APP terminal at least according to a preset condition.
The embodiment of the present application further provides a system for optimizing APP interface data, the system includes:
the device of APP interface data is optimized to APP end to and the device of APP interface data is optimized to the server side.
Compared with the prior art, the method has the following advantages:
in the method for reducing the APP interface data provided by the prior art, the purpose of reducing the APP interface data is finally achieved by specifically analyzing the relevant interfaces and then simplifying the result data field. Research personnel are required to specifically analyze each interface to reduce APP interface data, the method is not universal, a large amount of manpower is required to be technically input to optimize the interface data, manpower resources are wasted, and development cost is improved.
The application provides a method for optimizing APP interface data at an APP terminal, which comprises the following steps: the APP interface sends a data query request to the server side; receiving service data corresponding to the data query request returned by the server; and the APP terminal combines the current static data with the dynamic data returned by the server terminal to form complete data.
According to the method for optimizing the APP interface data at the APP end, on the operation level, the scheme abstracts and separates dynamic data and static data in the interface, the unexpired static data can be directly obtained from the APP locally, only the dynamic data needs to be obtained from the server end, and due to the fact that the occupation ratio of the dynamic data to the whole dynamic and static data is small, most of the dynamic data can be returned in one transmission unit, the situation that the dynamic data are sent as many as possible and the static data are sent as few as possible is guaranteed, so that the size of the APP interface data is reduced on the whole, the display speed of a page is accelerated, and the user experience is greatly improved; on the technical level, the scheme provides a general APP interface data optimization scheme, static data is cached at an APP end by adopting a unified mechanism, whether the static data changes is verified at a server end, only dynamic data is returned at the server end according to the change condition, or the static data and the dynamic data are returned, the general scheme is provided, and the waste of manpower is reduced. The scheme makes full use of the characteristic that the data has the difference between static data and dynamic data and the dynamic data has smaller occupation ratio relative to the whole dynamic and static data, returns the dynamic data with small data volume, improves the final display speed of the page, and improves the user experience, especially the user experience under the weak network condition.
The application also provides a method for optimizing the APP interface data at the server side; the application also provides a device for optimizing the APP interface data by the APP end, which corresponds to the method for optimizing the APP interface data by the APP end; the application also provides a device for optimizing the APP interface data at the server end, which corresponds to the method for optimizing the APP interface data at the server end; the application also provides a system for optimizing APP interface data.
Drawings
Fig. 1 is a flowchart of a method for optimizing APP interface data at an APP end according to a first embodiment of the present application;
fig. 2 is a flowchart of a method for optimizing APP interface data at a server according to a second embodiment of the present application;
fig. 3 is a schematic diagram of an apparatus for optimizing APP interface data at an APP end according to a third embodiment of the present application.
Fig. 4 is a schematic diagram of an apparatus for optimizing APP interface data at a server according to a fourth embodiment of the present application.
Fig. 5 is a schematic diagram of a system for optimizing APP interface data according to a fifth embodiment of the present application.
Fig. 6 is a timing diagram of system interaction for optimizing APP interface data according to a fifth embodiment of the present application.
Detailed Description
In order that the above objects, features and advantages of the present application can be more clearly understood, the present application will be described in further detail with reference to the accompanying drawings and detailed description. It should be noted that the embodiments and features of the embodiments of the present application may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. This application is capable of implementation in many different ways than those herein set forth and of similar import by those skilled in the art without departing from the spirit and scope of this application, and it is therefore not limited to the specific implementations disclosed below.
The embodiment of the application provides a method for optimizing APP interface data at an APP end and a method for optimizing the APP interface data at a server end; the embodiment of the application also provides a device for optimizing the APP interface data at the APP end and a device for optimizing the APP interface data at the server end; and a system for optimizing APP interface data.
The first embodiment of the application provides a method for optimizing APP interface data at an APP terminal. The embodiment of the method for optimizing the APP interface data at the APP terminal is as follows:
please refer to fig. 1, which shows a flowchart of a method for optimizing APP interface data at an APP end according to an embodiment of the present application.
The method for optimizing the APP interface data comprises the following steps:
and step S101, the APP interface sends a data query request to the server side.
The purpose of this step is that when the APP needs the server to provide data, the APP must send a data query request to the server through the APP interface, and only when the APP sends the data query request to the server, the server can make a corresponding response to the request and return data meeting the requirements of the APP.
The APP interface is an interface configured with dynamic and static data separation, and is responsible for merging static data and dynamic data, and merging can adopt a merging script or a code section capable of realizing a merging function.
The interface data mainly refers to data returned by an interface, the size of the data is particularly important in a wireless environment, and the user experience is directly influenced if the data is not processed well.
The data query request comprises static data parameters; before the step of sending the data query request to the server by the APP interface, the method may further include: inquiring whether the APP end has cache static data corresponding to the data to be inquired by the data inquiry request; and if so, setting the value of the static data parameter in the data query request as a state value indicating that the cache static data exists at the APP terminal.
Whether the query APP side has cached static data corresponding to the data to be queried by the data query request may include: generating a cache key according to the data query request; and inquiring whether the cache static data of the data to be inquired corresponding to the data inquiry request is in the APP local cache according to the cache key.
And if the result that whether the cache static data corresponding to the data to be inquired by the data inquiry request exists at the APP terminal is negative, setting the value of the static data parameter as a state value indicating that the cache static data does not exist at the APP terminal.
In this embodiment, whether the APP side has cached static data corresponding to the data to be queried by the data query request is queried, and if yes, the value of the static data parameter in the data query request is set to a state value indicating that the APP side has the cached static data, for example, the state value indicating that the cached static data exists is set to 1; if the cached static data does not exist, setting the static data parameter to a state value indicating that the cached static data does not exist at the APP terminal, for example, setting the state value in which the cached static data does not exist to 0.
The cache key refers to the name of an object, and the content of the object can be known according to the key.
The key is illustrated below by a specific example:
when the APP side needs to cache the flight information of beijing-shanghai returned by the server side, the APP side can cache all static data in the returned flight information, and the caching process is as follows: static data of an airline company, a planning model, a takeoff airport, an arrival airport, takeoff time, arrival time and the like are put into a character string and are used as a record, all Beijing-Shanghai flight records are cached into a cache through a hash table, a parameter 'Beijing-Shanghai' is input, the 'Beijing-Shanghai' is a key, and all static data in all the Beijing-Shanghai flight information lists are stored in the cache pointed by the key.
The querying whether the cache static data corresponding to the data to be queried by the data query request is found in the APP local cache according to the cache key comprises the steps of firstly generating the cache key according to the query request, then querying corresponding cache static data according to the key, and returning the value corresponding to the cache key if the static data exists, namely all the static data; if the static data is not queried, null is returned.
For example, when the APP queries flight information of beijing-shanghai, the cache key is "beijing-shanghai", and the cache static data related to the flight information is queried in the cache according to the "beijing-shanghai" key, and if the cache static data is found, the corresponding static data exists; if not, the corresponding static data does not exist.
In this embodiment, the whole process of sending the data query request to the server by the APP interface is as follows: firstly, the APP generates a cache key according to a data query request, so as to be used for querying whether corresponding static data exists in an APP local cache; inquiring whether corresponding static data exist in the local cache of the APP according to the cache key; if the data does not exist, the md5 value of the cached static data cannot be given when the data query request is sent, a null value is attached to a corresponding field of the request, and then the request is sent out; if the static data exists, the md5 value of the cached static data needs to be given when the data query request is sent, the md5 value is added to the corresponding field of the request, and then the request is sent out.
The static data parameters comprise: the md5 value of the cached static data.
It should be noted that the md5 value of the static data locally cached by the APP is added to the field of the request, so as to improve the speed of comparing whether the static data in the request is equal to the static data in the response data returned by the service server. If the complete static data is compared, the comparison speed of the server is affected, and the speed of the corresponding returned data is slowed, so that whether the static data changes can be judged only by comparing the md5 value of the cached static data in the request with the static data in the response data returned by the service server, and the response speed is obviously improved. Therefore, the md5 value of the static data of the APP local cache is appended to the field of the request.
It should be noted that, when the APP interface sends the request information, the static data parameter includes not only the md5 value and the state value of the cached static data, but also a character string of the content requested by the APP interface, for example, when querying a 18-day flight list 8/18/2016, the included request data is as shown in table 1 below:
parameter name Description of the parameters
SearchDate Search dates, for example: 2016-08-18
StartCity OriginFor example: beijing
ArriveCity Destinations, for example: shanghai province
StaticMD5 MD5 for static data
StaticState The state values of static data, for example: 1
TABLE 1
The cache is a temporary storage between the CPU and the memory, and the capacity of the temporary storage is smaller than that of the memory but the exchange speed is high. The data in the cache is a small part of the memory, but the small part is to be accessed by the CPU in a short time, and when the CPU calls a large amount of data, the memory can be avoided from being directly called from the cache, so that the reading speed is accelerated.
Md5 is an abbreviation for message-digest algorithm 5, widely used in encryption and decryption technology, and it can be said to be a "digital fingerprint" of a document. Any file, whether an executable program, an image file, a temporary file, or any other type of file, regardless of its size, has and only has a unique md5 information value, and if the file is modified, its md5 value will change.
The static data is: mainly refers to data with less change in each interface request, such as: in the ticket flight search, the flight list information in the flight list page changes relatively little, so the flight list information belongs to static data.
Specifically, the static data in the flight list refers to data with less variation, such as an airline company, a planning model, a take-off airport, an arrival airport, a take-off time, and an arrival time.
The dynamic data is: mainly refers to data that is relatively easy to change in each interface request, such as: in the ticket flight search, the price and the stock information of each flight in the flight list page change frequently, so the price and the stock information of the flight belong to dynamic data.
The following illustrates a process of sending a data query request to a server by the APP interface. For example, when a user inquires flight information of Beijing-Shanghai, an APP terminal firstly inquires whether static data in a flight list exists locally or not, inquires whether the static data in the flight list exists in an APP local cache according to a cache key, and if the static data does not exist in the APP local cache, when a data request is sent, a null value is attached to a field corresponding to the request, and then the request is sent to a corresponding APP interface server terminal; and if the corresponding static data is inquired, calculating the md5 value of the static data in the cached flight list, adding the md5 value to the corresponding field of the request, and sending the request to the corresponding APP interface server.
And step S102, receiving the service data corresponding to the data query request returned by the server.
The purpose of this step is that the APP terminal receives the service data returned by the server terminal, after the server terminal receives the APP interface request, the server terminal transfers the request to the corresponding service server, the service server returns the corresponding service data, and after the server terminal performs corresponding processing on the service data again, the service data is returned to the APP terminal. And the APP terminal receives the service data returned by the server terminal, and is a basis and a data source for the APP terminal to perform subsequent data processing.
The server side refers to an APP interface server corresponding to the APP interface, and the server side is responsible for separation of static data and dynamic data.
The service data refers to response data returned by the service server corresponding to the APP interface query request.
The service data returned by the server end at least comprises dynamic data; and may further include: static data.
Specifically, after receiving the service data of the service server, the server side judges whether the interface is configured with dynamic and static data separation, and if the interface is not configured with dynamic and static data separation, the server side directly returns the service data to the APP side; if so, acquiring the configured split script, splitting the response data by using the script, and finally analyzing the response data into corresponding static data and dynamic data; calculating the md5 value of the analyzed static data, and if the md5 value is equal to the md5 value carried in the request, determining that the static data has no change, and only sending the dynamic data to the APP terminal; if the value of md5 carried in the request is not equal, the static data is considered to be changed, and the static data and the dynamic data need to be sent to the APP terminal together. The server side can send dynamic data and static data in the form of character strings.
For example, when a user queries flight information of beijing-shanghai, if the md5 value of static data in the service data is equal to the md5 value carried in the request, the data received by the APP end only contains dynamic data, which is a character string corresponding to information such as prices and inventory information of all flights of beijing-shanghai; if the md5 value of the static data in the business data is not equal to the md5 value carried in the request, the data received by the APP end includes static data and dynamic data, which are character strings containing both the airline company, the planning model, the departure airport, the arrival airport, the departure time and the arrival time, and price and inventory information. Therefore, if the server only returns the dynamic data, the transmission speed of the data is obviously improved, because the proportion of the dynamic data to the whole data is small.
And step S103, merging the current static data and the dynamic data returned by the server side to form complete data.
The purpose of this step is that the APP terminal merges the current static data and the dynamic data returned by the server terminal, and obtains the complete data to be displayed through data merging.
The current static data comprises: if the service data returned by the server only contains dynamic data, the current static data is the static data of the APP local cache; and if the service data returned by the server side contains dynamic data and static data, the current static data is the static data returned by the server side.
Before the step of combining the current static data with the dynamic data in the service data returned by the server end to form complete data, if the data returned by the server end contains the dynamic data and the static data, the static data returned by the server end is adopted to update the cached static data.
In this embodiment, if the data returned by the server only contains dynamic data, the static data retrieved from the APP cache and the dynamic data returned by the server are merged, and a configured merged script is merged and used; if the data returned by the server side contains dynamic data and static data, it indicates that the static data has changed, the APP side needs to store the static data into a cache of the APP, the cache key is the cache key in S101, update the static data returned by the server side into cache static data for use in next merging, and then merge the returned dynamic data and static data through a configured merging script.
For example, when a user queries flight information of beijing-shanghai, if the server only returns dynamic data containing flight price and inventory information, it indicates that the static data does not change, the APP needs to fetch the static data of the flight list from the local cache, and then merge the fetched static data with the dynamic data returned by the server; if the service data returned by the server side contains both the dynamic data and the static data of the flight list, it indicates that the static data has changed, the APP side needs to find a corresponding cache according to the cache key, store the returned static data in the corresponding cache of the APP, and then combine the returned dynamic data and the returned static data through the configured combination script.
In this embodiment, the current static data and the dynamic data returned by the server are merged, and the specific method includes: and taking out the cached static data from the APP-side cache, taking out a first record of the static data, taking out corresponding dynamic data in the dynamic data, merging and placing the dynamic data into a new data structure, then sequentially taking a second record and a third record until the last record, and carrying out the same operation on each record.
For example, the APP locally caches 100 records of "beijing-shanghai" flight static data, static data { "airline", "planning model", "takeoff airport", "arrival airport", "takeoff time", and "arrival time" }, dynamic data { "flight price", and "inventory information" }, and when merging, the static data of the first record and the corresponding dynamic data are merged and then sequentially circulated and merged until the 100 th record, merging of the static data and the dynamic data is completed, and the circulation may use a for statement or a while statement.
The second embodiment of the application provides a method for optimizing APP interface data at a server side. The embodiment of the method for optimizing the APP interface data at the server side is as follows:
referring to fig. 2, a flowchart of a method for server-side optimization of APP interface data is shown according to an embodiment of the present application.
The method for optimizing the APP interface data at the server side comprises the following steps:
step S201, a data query request of the APP interface is received.
The purpose of the step is that the server receives the data query request of the APP interface, and the server can only make corresponding service according to the data carried in the data query request after receiving the data query request of the APP interface, and returns corresponding data, which is a precondition for the server to perform service.
The receiving of the data query request of the APP interface refers to the receiving of the data query request of the APP interface by the server side.
The server receives the data query request of the APP interface, and the server receives the data query request of the APP interface through the interface.
The data query request comprises static data parameters.
The static data parameters comprise some parameters which are carried in the data query request and are related to caching static data.
The values of the static data parameters include: and the state value of the cached static data in the data query request.
It should be noted that the server side may perform corresponding processing according to the value of the received static data parameter. Specifically, if the state value of the cached static data in the data query request received by the server is 1, it is determined that the cached static data of the data to be queried by the data query request exists, and the server may directly compare the static data in the service data with the cached static data; if the state value of the cached static data in the data query request received by the server is 0, determining that the cached static data of the data to be queried by the data query request does not exist, and directly returning the static data and the dynamic data of the service data without comparing the static data in the service data with the cached static data by the server.
The static data parameters comprise: the md5 value of the cached static data in the data query request.
It should be noted that, if the amount of the local cached static data of the APP is small, the server may determine whether to compare the static data in the service data with the cached static data in the data query request according to the state value of the cached static data in the data query request; however, when the amount of the cached static data in the data query request is large, not only a certain time is required for sending the complete data of the cached static data in the data query request to the server, but also a certain time is required for comparing the static data in the service data with the cached static data in the data query request, so that when the amount of the cached static data in the data query request is large, the comparison speed can be significantly increased by comparing the md5 value of the cached static data in the data query request with the md5 value of the static data of the service data.
Step S202, identifying the service identification information contained in the data query request, and obtaining the data of the corresponding service according to the service identification information.
The purpose of this step is that the server end finds the corresponding service server according to the service identification information contained in the data query request, then the corresponding service server queries the data of the corresponding service, and returns the data to the server end, and the server end obtains the data of the corresponding service is a precondition of S203.
The service identification information is information for identifying a service corresponding to the data query request.
For example, when inquiring the beijing-shanghai flight information, the service identification information refers to information about flight service in the request field of the data inquiry request, for example, the service identification information is "Q01", and then in the data inquiry request, the service identification information "Q01" is added to indicate flight service.
Step S203, separating static data from dynamic data in the service data.
The purpose of this step is to separate static data from dynamic data in the service data, and separate the static data from the dynamic data through a separation script or a code, so as to obtain the separated static data and dynamic data, so as to be used for comparing the static data in the service data with the cached static data of the data to be queried by the data query request in the following.
The service data refers to response data returned by the service server corresponding to the APP interface query request. When receiving the inquiry request of the corresponding interface, the server end forwards the request to the corresponding service server, and after finishing the processing of the service server, the server end returns response data.
For example, when a beijing-shanghai flight is queried, the corresponding service server refers to a server for processing flight services, the service server needs to perform corresponding data query according to the content of request information of the APP interface forwarded by the server, when flight list information needing to be queried is found, the flight list information is returned to the server, and the returned flight list information is service data.
The step of separating the static data from the dynamic data in the service data refers to that the server separates the static data from the dynamic data in response data returned by the service server. When the server separates the static data from the dynamic data, the server must configure scripts or codes for separating the static data from the dynamic data.
The scripts or code that separates the static data from the dynamic data may be code written in any language that is capable of performing a function, such as java, etc.
For example, when a beijing-shanghai flight is queried, the corresponding service server returns static data containing information such as an airline company, a planning machine type, a takeoff airport, an arrival airport, takeoff time, arrival time and the like and dynamic data containing flight price and inventory information to the server side, and after the server side receives the information, the received service data is separated into the static data and the dynamic data by using a script or a code for separating the static data from the dynamic data.
In this embodiment, the specific method for separating static data from dynamic data of the service data includes: and taking out a first record in the business data, taking out the static data, putting the static data into a data structure for storing the static data, taking out the dynamic data, putting the dynamic data into the data structure for storing the dynamic data, and then sequentially taking a second record and a third record until the last record, wherein each record is subjected to the same operation.
For example, the business data comprises 100 records of Beijing-Shanghai flight data,
flight data { "airline", "planning model", "departure airport", "arrival airport", "departure time", "arrival time", "flight price", "inventory information" },
corresponding static data { "airline company", "planning model", "takeoff airport", "arrival airport", "takeoff time", and "arrival time" }, dynamic data { "flight price", "inventory information" };
during separation, the static data of the first record is taken out, the dynamic data of the first record is taken out and respectively put into the first record corresponding to the corresponding data structure, and then the second record and the third record are taken out until the 100 th record, so that the separation of the static data and the dynamic data is completed, and a for statement or a while statement can be used circularly.
Step S204, at least sending the dynamic data to the APP terminal according to a preset condition.
The purpose of this step is that the server side sends the dynamic data to the APP side or sends the static data and the dynamic data to the APP side together according to the predetermined condition, and the server side returns the processed data to the APP side for the APP side to use.
The predetermined conditions include: the static data and/or the dynamic data are transmitted at certain time intervals.
And sending the static data and/or the dynamic data at a certain time interval, including that the APP end sends a request to the server end at a certain time interval, the server end returns the static data and/or the dynamic data, and when the server end returns the static data, the APP end updates the cache.
For example, in an APP interface of a flight service, the APP end sets a time interval to be 20 minutes, sends a request to the server end at regular time, and the server end returns static data and dynamic data.
The at least sending the dynamic data to the APP terminal includes: judging whether the static data is the same as the cached static data of the data to be inquired by the data inquiry request; if so, the server side sends the dynamic data to the APP side; and if not, the server side sends the dynamic data and the static data to the APP side.
The purpose of the step is that the server side returns different data according to whether the static data changes, and quick response to the APP interface request is achieved. Because the static data change is not frequent, the probability that the server side only returns the dynamic data to the APP side is high, and the response speed is improved.
The determining whether the static data is the same as the cached static data of the data to be queried by the data query request includes: judging whether the md5 value of the cached static data of the data to be inquired by the data inquiry request is the same as the md5 value of the static data; if so, judging that the static data is the same as the cached static data of the data to be inquired by the data inquiry request; if not, the static data is judged to be different from the cache static data of the data to be inquired by the data inquiry request.
For example, when a flight in beijing-shanghai is queried, if a flight list on a service server is not changed, the md5 value of static data returned by the service server is equal to the md5 value of cached static data of data to be queried by the data query request, it is determined that the static data in response data returned by the service server is the same as the cached static data of the data to be queried by the data query request, and the server end returns only dynamic data of the service data to the APP end; if the static data of the service data changes due to the change of the model of a certain flight, the static data of the service data changes, an md5 value of the static data of the service data is calculated, the md5 value (md 5 value of the local cache static data of the APP) carried in the data query request is compared, and the two md5 values are not equal, the static data of the service data is judged to be different from the cache static data of the data to be queried by the data query request, and the server side returns the dynamic data and the static data of the service data to the APP side; or, because the APP interface makes a data request for the first time, static data of a flight list is not obtained from the server in a cache region corresponding to the APP locally, the md5 value of the cached static data is null, and is not equal to the md5 value of the static data in response data returned by the service server, it is determined that the static data in the service data is different from the cached static data of data to be queried by the data query request, and at this time, the server side also returns dynamic data and static data of the service data to the APP side.
Corresponding to the method for optimizing the APP interface data of the APP end, the application also provides a device for optimizing the APP interface data of the APP end. Since the embodiments of the apparatus are substantially similar to the embodiments of the method, they are described in a relatively simple manner, and reference may be made to the description of the embodiments of the method for relevant points. The device embodiments described below are merely illustrative. The embodiment of the device for optimizing the APP interface data at the APP terminal is as follows:
please refer to fig. 3, which illustrates a schematic diagram of an apparatus for optimizing APP interface data at an APP end according to an embodiment of the present application.
APP end optimizes APP interface data's device includes: a requesting unit 301, a receiving unit 302, and a merging unit 303.
A request unit 301, configured to send a data query request to a server through the APP interface;
a receiving unit 302, configured to receive service data corresponding to the data query request returned by the server;
a merging unit 303, configured to merge, according to the service data returned by the receiving unit, the current static data and the dynamic data returned by the server side by the APP side to form complete data.
Optionally, the data query request in the request unit includes a static data parameter.
Optionally, the apparatus further comprises:
a presence state value unit is set and used for inquiring whether cache static data corresponding to the data to be inquired by the data inquiry request exists at the APP end before the request unit works; and if so, setting the value of the static data parameter in the data query request as a state value indicating that the cache static data exists at the APP terminal.
Optionally, the static data parameters include: the md5 value of the cached static data.
Optionally, the apparatus includes:
the query static data unit is used for generating a cache key according to the data query request before the request unit works; and inquiring whether cache static data corresponding to the data to be inquired by the data inquiry request exists in the APP local cache according to the cache key.
Optionally, the apparatus further comprises:
and the state value nonexistence unit is used for inquiring whether the cache static data corresponding to the data to be inquired by the data inquiry request exists at the APP end before the request unit works, and if the result is negative, setting the value of the static data parameter as a state value indicating that the cache static data does not exist at the APP end.
Optionally, the service data in the receiving unit at least includes
Dynamic data; and, may include: static data.
Optionally, the current static data in the merging unit includes:
if the service data returned by the server only contains dynamic data, the current static data is the cache static data of the APP local cache;
and if the service data returned by the server side contains dynamic data and static data, the current static data is the static data returned by the server side.
Optionally, the apparatus further comprises:
and the cache unit is used for updating the cached static data by adopting the static data returned by the server end if the data returned by the server end contains dynamic data and static data before the merging unit works.
Corresponding to the method for optimizing the APP interface data by the server side, the application also provides a device for optimizing the APP interface data by the server side. Since the embodiments of the apparatus are substantially similar to the embodiments of the method, they are described in a relatively simple manner, and reference may be made to the description of the embodiments of the method for relevant points. The device embodiments described below are merely illustrative. The embodiment of the device for optimizing the APP interface data at the server side is as follows:
please refer to fig. 4, which illustrates a schematic diagram of an apparatus for server-side optimizing APP interface data according to an embodiment of the present application.
Device of APP interface data is optimized to server side includes: receiving section 401, obtaining section 402, separating section 403, and transmitting section 404.
A receiving unit 401, configured to receive a data query request of an APP interface;
an obtaining unit 402, configured to identify service identification information included in the data query request in the receiving unit, and obtain data of a corresponding service according to the service identification information;
a separating unit 403, configured to separate static data from dynamic data in the service data in the obtaining unit;
a sending unit 404, configured to send at least the dynamic data to the APP end according to a predetermined condition.
Optionally, the request data in the data query request of the receiving unit includes: static data parameters.
Optionally, the values of the static data parameters include:
and the state value of the cached static data in the data query request.
Optionally, the static data parameters include:
the md5 value of the cached static data in the data query request.
Optionally, the sending unit includes:
a sending subunit, configured to send the static data and/or the dynamic data at certain time intervals.
Optionally, the sending unit includes:
a judging subunit, configured to judge whether the static data is the same as cached static data of the data to be queried by the data query request; if so, the server side sends the dynamic data to the APP side; and if not, the server side sends the dynamic data and the static data to the APP side.
Optionally, the judging subunit includes:
a subunit that determines whether md5 values are the same, configured to determine whether the md5 value of the cached static data of the data to be queried by the data query request is the same as the md5 value of the static data;
if so, judging that the static data is the same as the cached static data of the data to be inquired by the data inquiry request;
if not, the static data is judged to be different from the cache static data of the data to be inquired by the data inquiry request.
In addition, the present application further provides a system for optimizing an APP interface data packet, as shown in fig. 5, the system includes the apparatus 501 for optimizing an APP interface data packet at the APP end and the apparatus 502 for optimizing an APP interface data packet at the server end, which are described in the foregoing embodiments. The device for optimizing the APP interface data packet at the APP end can be deployed in various APP end devices such as a personal computer or a mobile terminal device (for example, a smart phone); the device for optimizing the APP interface data packet at the server side can be deployed in the server.
For example, the device for optimizing the APP interface data packet at the APP end is deployed in a smart phone, and the device for optimizing the APP interface data packet at the server end is deployed in a server. The processing flow of the system for optimizing the APP interface data packet is as follows: firstly, the smart phone sends a data query request to a server; then, the server receives a data query request sent by the smart phone, forwards the data query to a corresponding service server, the service server returns service data to the server, the server separates the service data into static data and dynamic data, at least the dynamic data is sent to the smart phone, and the smart phone merges the current static data and the current dynamic data to form complete data for display.
Although the present invention has been described with reference to the preferred embodiments, it is not intended to be limited thereto, and variations and modifications may be made by those skilled in the art without departing from the spirit and scope of the present invention.

Claims (16)

1. A method for optimizing APP interface data at an APP terminal is characterized by comprising the following steps:
the APP interface sends a data query request to the server side;
receiving service data corresponding to the data query request returned by the server; merging the current static data and the dynamic data in the service data returned by the server end to form complete data;
wherein the service data includes: if the server judges that the static data in the service data is the same as the cached static data of the data to be inquired by the data inquiry request, the service data is the dynamic data sent by the server; if the server judges that the static data in the service data is different from the cached static data of the data to be inquired by the data inquiry request, the service data is the dynamic data and the static data sent by the server;
the current static data comprises:
if the service data returned by the server only contains dynamic data, the current static data is cached static data of the APP local cache;
and if the service data returned by the server side contains dynamic data and static data, the current static data is the static data returned by the server side.
2. The method for optimizing APP interface data at the APP terminal according to claim 1, wherein the data query request includes static data parameters; before the step of sending the data query request to the server side by the APP interface, the method further includes:
inquiring whether the APP end has cache static data corresponding to the data to be inquired by the data inquiry request; and if so, setting the value of the static data parameter in the data query request as a state value indicating that the cache static data exists at the APP terminal.
3. The method for optimizing APP interface data according to claim 2, wherein the querying whether cache static data corresponding to the data to be queried by the data query request exists at the APP comprises:
generating a cache key according to the data query request; and inquiring whether cache static data corresponding to the data to be inquired by the data inquiry request exists in the APP local cache according to the cache key.
4. The method for optimizing APP interface data at the APP terminal of claim 2, wherein the static data parameters comprise:
the md5 value of the cached static data.
5. The method for optimizing APP interface data at the APP side according to claim 2, comprising:
and if the result that whether the cache static data corresponding to the data to be inquired by the data inquiry request exists at the APP terminal is negative, setting the value of the static data parameter as a state value indicating that the cache static data does not exist at the APP terminal.
6. The method for optimizing APP interface data at the APP terminal of claim 1, wherein the service data returned by the server terminal comprises: dynamic data, or, includes: dynamic data and static data.
7. The method for optimizing APP interface data at the APP terminal according to claim 1, wherein before the step of combining the current static data with the dynamic data in the service data returned by the server terminal to form complete data, the method further comprises:
and if the service data returned by the server side contains dynamic data and static data, updating the cached static data by adopting the static data returned by the server side.
8. A method for optimizing APP interface data at a server side is characterized by comprising the following steps:
receiving a data query request of an APP interface;
identifying service identification information contained in the data query request, and acquiring data of a corresponding service according to the service identification information;
separating static data from dynamic data in the service data;
at least sending the dynamic data to the APP terminal according to a preset condition;
the at least sending the dynamic data to the APP terminal includes:
judging whether the static data is the same as the cached static data of the data to be inquired by the data inquiry request; if so, the server side sends the dynamic data to the APP side; and if not, the server side sends the dynamic data and the static data to the APP side.
9. The method for optimizing APP interface data at the server side according to claim 8 is characterized by comprising:
the data query request comprises static data parameters.
10. The method for optimizing APP interface data at the server side according to claim 9, wherein the values of the static data parameters comprise:
and the state value of the cached static data in the data query request.
11. The method for optimizing APP interface data at the server side according to claim 9, wherein the static data parameters include:
the md5 value of the cached static data in the data query request.
12. The method for optimizing APP interface data at the server side according to claim 8, wherein the predetermined conditions include:
the static data and/or the dynamic data are transmitted at certain time intervals.
13. The method for optimizing APP interface data at a server side according to claim 8, wherein the determining whether the static data is the same as the cached static data of the data to be queried by the data query request includes:
judging whether the md5 value of the cached static data of the data to be inquired by the data inquiry request is the same as the md5 value of the static data;
if so, judging that the static data is the same as the cached static data of the data to be inquired by the data inquiry request;
if not, the static data is judged to be different from the cache static data of the data to be inquired by the data inquiry request.
14. The utility model provides a device of APP end optimization APP interface data which characterized in that includes:
the request unit is used for sending a data query request to the server side by the APP interface;
the receiving unit is used for receiving the service data which is returned by the server and corresponds to the data query request;
the merging unit is used for merging the current static data and the dynamic data returned by the server side by the APP side according to the service data returned by the receiving unit to form complete data;
wherein the service data includes: if the server judges that the static data in the service data is the same as the cached static data of the data to be inquired by the data inquiry request, the service data is the dynamic data sent by the server; if the server judges that the static data in the service data is different from the cached static data of the data to be inquired by the data inquiry request, the service data is the dynamic data and the static data sent by the server;
the current static data comprises:
if the service data returned by the server only contains dynamic data, the current static data is cached static data of the APP local cache;
and if the service data returned by the server side contains dynamic data and static data, the current static data is the static data returned by the server side.
15. The utility model provides a device of APP interface data is optimized to server side which characterized in that includes:
the device comprises a receiving unit, a processing unit and a processing unit, wherein the receiving unit is used for receiving a data query request of an APP interface;
an obtaining unit, configured to identify service identification information included in the data query request in the receiving unit, and obtain data of a corresponding service according to the service identification information;
the separation unit is used for separating static data and dynamic data in the service data in the acquisition unit;
a sending unit, configured to send at least the dynamic data to the APP end according to a predetermined condition; the at least sending the dynamic data to the APP terminal includes:
judging whether the static data is the same as the cached static data of the data to be inquired by the data inquiry request; if so, the server side sends the dynamic data to the APP side; and if not, the server side sends the dynamic data and the static data to the APP side.
16. A system for optimizing APP interface data, comprising:
the apparatus for optimizing APP interface data at APP end according to claim 14 and the apparatus for optimizing APP interface data at server end according to claim 15.
CN201610824810.8A 2016-09-14 2016-09-14 Method, device and system for optimizing APP interface data Active CN107819806B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610824810.8A CN107819806B (en) 2016-09-14 2016-09-14 Method, device and system for optimizing APP interface data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610824810.8A CN107819806B (en) 2016-09-14 2016-09-14 Method, device and system for optimizing APP interface data

Publications (2)

Publication Number Publication Date
CN107819806A CN107819806A (en) 2018-03-20
CN107819806B true CN107819806B (en) 2021-07-13

Family

ID=61600703

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610824810.8A Active CN107819806B (en) 2016-09-14 2016-09-14 Method, device and system for optimizing APP interface data

Country Status (1)

Country Link
CN (1) CN107819806B (en)

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
"MARVIN: Efficient and Comprehensive Mobile App Classification through Static and Dynamic Analysis";Martina Lindorfer等;《2015 IEEE 39th Annual Computer Software and Applications Conference》;20150924;第1-12页 *
"一种基于HTTP协议的动态Web资源缓存机制及实现";吕浩勇等;《科学技术》;20150128(第6期);第65-66页 *

Also Published As

Publication number Publication date
CN107819806A (en) 2018-03-20

Similar Documents

Publication Publication Date Title
JP4456554B2 (en) Data compression method and compressed data transmission method
US10250526B2 (en) Method and apparatus for increasing subresource loading speed
US9792340B2 (en) Identifying data items
US10043220B2 (en) Method, device and storage medium for data processing
CN108984553B (en) Caching method and device
CN107329963B (en) Method and device for accelerating webpage access
US20130318208A1 (en) Dynamic package creation for predictive page load optimization
CN108256718B (en) Policy service task allocation method and device, computer equipment and storage equipment
JP2005346734A (en) Method of providing content
CN110222073B (en) Data query method and related device
CN110334297A (en) Loading method, terminal, server and the storage medium of terminal page
CN106681995B (en) Data caching method, data query method and device
CN104010035A (en) Method and system for application program distribution
CN101673217B (en) Method for realizing remote program call and system thereof
CN113900907B (en) Mapping construction method and system
CN102882988A (en) Method, device and equipment for acquiring address information of resource information
US20120303601A1 (en) Mobile search method and system thereof
US20170357697A1 (en) Using adaptors to manage data indexed by dissimilar identifiers
WO2012119339A1 (en) Retrieval method and apparatus
CN113886683A (en) Label cluster construction method and system, storage medium and electronic equipment
CN107819806B (en) Method, device and system for optimizing APP interface data
JP6682342B2 (en) Information providing device and terminal device
US10616291B2 (en) Response caching
CN105808628A (en) Webpage transcoding method, apparatus and system
CN110555070B (en) Method and apparatus for outputting information

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