CN109871498B - Rear-end interface response method and device, electronic equipment and storage medium - Google Patents

Rear-end interface response method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN109871498B
CN109871498B CN201811537748.XA CN201811537748A CN109871498B CN 109871498 B CN109871498 B CN 109871498B CN 201811537748 A CN201811537748 A CN 201811537748A CN 109871498 B CN109871498 B CN 109871498B
Authority
CN
China
Prior art keywords
client
server
data
interface
access request
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
CN201811537748.XA
Other languages
Chinese (zh)
Other versions
CN109871498A (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.)
Ping An Life Insurance Company of China Ltd
Original Assignee
Ping An Life Insurance Company of China 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 Ping An Life Insurance Company of China Ltd filed Critical Ping An Life Insurance Company of China Ltd
Priority to CN201811537748.XA priority Critical patent/CN109871498B/en
Publication of CN109871498A publication Critical patent/CN109871498A/en
Application granted granted Critical
Publication of CN109871498B publication Critical patent/CN109871498B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention relates to a back-end interface response method, a back-end interface response device, electronic equipment and a storage medium. The method comprises the following steps: the client sends an access request to the server to acquire loading data, wherein the access request comprises forwarded interface address parameters; the server receives an access request sent by the client and determines a matched interface according to interface address parameters in the access request; the server searches data matched with the interface from a database of the server through the determined interface; and the server transmits the loading data searched from the database to the client so as to enable the client to load the loading data. The invention can reduce the pressure of the back end interface of the server and improve the speed of front end resources required by the client for non-first loading.

Description

Rear-end interface response method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for responding to a back-end interface, an electronic device, and a storage medium.
Background
At present, the problems of interruption, no response, response timeout, overlong response time and the like of a server are easy to occur due to the fact that the data volume requested by the APP to the back end is overlarge, so that the client cannot acquire the data for a long time.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a back-end interface response method, device, computer device and computer readable storage medium, so as to reduce the pressure of the back-end interface of the server and increase the speed of loading front-end resources for the front-end.
A first aspect of the present application provides a back-end interface response method, applied to a client and a server communicatively connected to the client, where the method includes:
the client sends an access request to the server to acquire loading data, wherein the access request comprises forwarded interface address parameters;
the server receives an access request sent by the client and determines a matched interface according to interface address parameters in the access request;
the server searches data matched with the interface from a database of the server through the determined interface; and
And the server transmits the loading data searched from the database to the client so as to enable the client to load the loading data.
Preferably, the client sending an access request to the server to obtain the loading data includes:
The client judges whether front-end data are stored locally or not according to the description information of the front-end data of the client;
when front-end data is stored in the local of the client, the client reads the front-end data from the local of the client as loading data; and
And when the local part of the client does not store the front-end data, the client sends the access request to the server to acquire the loading data.
Preferably, the client sending an access request to the server to obtain the loading data includes:
if the front-end data is initialization data or data with changed webpage document states, the client sends the access request to the server to acquire the initialization data or the data with changed webpage document states; and
If the front-end data is the initialization data which is not loaded for the first time or the data with unchanged webpage document state, the client reads the initialization data which is not loaded for the first time or the data with unchanged webpage document state from the local of the client.
Preferably, the server receiving the access request sent by the client, and determining a matched interface according to the access request includes:
Accessing the interface when the server determines a matched interface according to the interface address parameter in the access request; and
And when the server does not determine the interface matched with the interface address parameter according to the interface address parameter in the access request, a prompt message is returned to the client to remind of access errors.
Preferably, the server receiving the access request sent by the client includes:
the server receives an access request sent by the client through an http proxy server, wherein the http proxy server determines the front end identification of the server sending the access request according to the access request, queries a route table preset in the http proxy server for a route of the server corresponding to the front end identification, and forwards the access request to the server according to the route.
Preferably, the method further comprises the step of:
the client monitors the response state of the server to the request of the loading data; and
And when the response for requesting the loading data is overtime or fails, re-requesting to load the loading data.
Preferably, the client monitoring the response state of the server to the request of the loading data further comprises:
The client side sends out a data loading request and then carries out timing;
and when the timing time exceeds a preset time, sending out a reminding message for requesting overtime so as to remind the server of excessively long response time.
A second aspect of the present application provides a backend interface response apparatus, applied in a client and a server communicatively connected to the client, the apparatus comprising:
the request module is used for controlling the client to send an access request to the server to acquire loading data, wherein the access request comprises forwarded interface address parameters;
the interface determining module is used for controlling the server to receive the access request sent by the client and determining a matched interface according to the interface address parameter in the access request;
the data searching module is used for controlling the server to search data matched with the interface from a database of the server through the determined interface; and
And the sending module is used for controlling the server to transmit the loading data searched from the database to the client so as to enable the client to load the loading data.
A third aspect of the present application provides an electronic device comprising a processor for implementing the back-end interface response method when executing a computer program stored in a memory.
A fourth aspect of the present application provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the back-end interface response method.
The method comprises the steps that whether loading data are stored locally or not is judged through description information of front-end data of a client, and if the loading data exist, the client directly reads the loading data from the local; if the loading data does not exist, the client requests the server to acquire the loading data, so that the pressure of a rear end interface of the server can be reduced, the speed of front end resources required by the client for non-initial loading can be improved, and the traffic occupation can be reduced.
Drawings
Fig. 1 is a schematic view of an application environment of a back-end interface response method according to an embodiment of the present invention.
Fig. 2 is a flowchart of a back-end interface response method according to an embodiment of the present invention.
Fig. 3 is a block diagram of a back-end interface response device according to an embodiment of the present invention.
Fig. 4 is a schematic diagram of an electronic device according to a preferred embodiment of the invention.
Detailed Description
In order that the above-recited objects, features and advantages of the present invention will be more clearly understood, a more particular description of the invention will be rendered by reference to specific embodiments thereof which are illustrated in the appended drawings. It should be noted that, in the case of no conflict, the embodiments of the present application and the features in the embodiments may be combined with each other.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, and the described embodiments are merely some, rather than all, embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention.
Preferably, the back-end interface response method of the present invention is applied in one or more electronic devices. The electronic device is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and its hardware includes, but is not limited to, a microprocessor, an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a programmable gate array (Field-Programmable Gate Array, FPGA), a digital processor (Digital Signal Processor, DSP), an embedded device, and the like.
The electronic device may be a computing device such as a desktop computer, a notebook computer, a tablet computer, a cloud server, and the like. The device can perform man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch pad or voice control equipment and the like.
Example 1
Fig. 1 is a schematic view of an application environment of a back-end interface response method of the present invention.
Referring to fig. 1, the back-end interface response method is applied to a server 1 and at least one client 3, where the server 1 is connected to the at least one client 3 through a network 2. The network 2 may be a wired network or a wireless network, such as radio, wireless fidelity (Wireless Fidelity, WIFI), cellular, satellite, broadcast, etc. In one embodiment, the server 1 is a server. The server 1 may be a single server or a server group. The client 3 comprises a front end. For example, the front end may be a web page or web document running on the client 3. In an embodiment, the client 3 may be a notebook computer, a desktop computer, a tablet computer, a mobile phone, or the like.
Fig. 2 is a flow chart of a preferred embodiment of the back-end interface response method of the present invention. The order of the steps in the flow diagrams may be changed, and some steps may be omitted, according to different needs.
Referring to fig. 2, the back-end interface response method specifically includes the following steps:
in step S201, the client 3 sends an access request to the server 1 to obtain the loading data.
In this embodiment, the access request includes a forwarding parameter, where the forwarding parameter is used for the backend to find data. In this embodiment, the forwarding parameters include, but are not limited to: method, shortUrl, requestParam, retKey, splitPath, cacheTime. Wherein the method represents the forwarded interface request mode, and the default value is GET. shortUrl represents the forwarded interface address. requestmaram represents the interface request parameters forwarded. The retKey represents a key value stored in the processed interface data, and the default value represents the retKey. split PATH represents the PATH that needs to intercept data returned to a node in a message. The cacheTime represents a cache time control identification.
In this embodiment, when there is a need to load front-end data at the front end of the client 3, the client 3 sends a request to the server 1. Wherein, the client 3 sending an access request to the server 1 to obtain the loading data includes:
(S2011) the client 3 determines whether the front-end data is stored locally to the client 3, based on the description information of the front-end data. If yes, step S2011 is executed, otherwise step S2013 is executed.
In this embodiment, the description information of the front-end data includes a javaScript source file and a CSS source file. The description information is used for describing the identification, the property and the characteristics of the front-end data.
(S2012) the client 3 reads the front-end data from the local as the loading data.
In this embodiment, the front end of the client 3 may be a web document. The client 3 reads the front-end data from the local as the loading data of the web document. In one embodiment, the client 3 may load the entire block frame of the web document and run the loading component according to the front-end data.
(S2013) the client 3 transmits the access request to the server 1 to acquire the loading data.
In this embodiment, whether the loaded data is stored locally is determined according to the description information of the front-end data of the client 3, and if the loaded data is stored, the client 3 directly reads the loaded data from the local; if the loading data does not exist, the client 3 requests the server 1 to acquire the loading data, so that the pressure of a rear end interface of the server 1 can be reduced, the speed of front end resources required by the client 3 for non-first loading can be improved, and the traffic occupation can be reduced.
In one embodiment, the sending, by the client 3, an access request to the server 1 to obtain the loading data further includes: if the front-end data is initialization data or data with changed webpage document states, the client 3 sends an access request to the server 1 to acquire the initialization data or the data with changed webpage document states; if the front-end data is the initialization data which is not loaded for the first time or the data with no change in the state of the webpage document, the client 3 reads the initialization data which is not loaded for the first time or the data with no change in the state of the webpage document from the local.
In step S202, the server 1 receives the access request sent by the client 3, and determines a matched interface according to the access request.
In this embodiment, when the server 1 receives an access request sent by the client 3, a matching interface is determined according to an interface address parameter (shortUrl) in the access request. In this embodiment, the server 1 receives an access request sent by the client 3, and determines a matched interface according to the request, which includes:
(S2021) accessing the interface when the server 1 determines a matching interface based on the interface address parameter in the access request.
(S2022) when the server 1 does not determine the interface matching the interface address parameter according to the interface address parameter in the access request, a prompt message is returned to the client 3 to alert of the access error.
In this embodiment, the server 1 checks all the back interfaces included in the server 1 one by one according to the interface address parameter in the access request, enters the entry when determining the interface matching the access request, and returns a reminder to the client 3 when not finding the interface matching the access request to remind the user of the access error, thereby avoiding the situation that the interface is not responded, and avoiding the situation that the user accesses the interface by using the nested sql query parameter with excessively complex operation, so that the interface is not responded.
In an embodiment, the server 1 receives the request sent by the client 3 based on the non-aware directed proxy method of the http proxy server. The server 1 is a server cluster, and the server cluster includes a plurality of servers. Specifically, the step of "the back end receives the access request sent by the client 3 and determines a matched interface according to the request" includes:
(S2021') the http proxy server receives the access request transmitted by the client 3.
In this embodiment, the http proxy server may be a nmginx, a Squid, or an Apache Traffic server.
(S2022') the http proxy server determines, from the access request, a front-end identification of the server that issued the access request.
The front-end identifier described in this embodiment may be a unique identifier such as a code or a name of the server 1, and is mainly used to identify different servers 1.
In this embodiment, after receiving the access request, the http proxy server may determine the front end identifier of the corresponding server 1 according to the access request, and specifically, there may be multiple possible embodiments according to the content of the access request. In this embodiment, the server 1 determines whether the user of the client 3 is a newly registered user according to the access request. Wherein, whether the user is a new registered user can be judged by adopting a mode of judging whether the access request contains registration information, whether the user information exists in a user database, and the like. If the user is newly registered, the server 1 does not have the privateization data before the user, a server is selected from the server clusters according to the load condition of each server in the current server clusters and is allocated to the user, a routing table is preset on the http proxy server, and if the front end identifier corresponding to the server is recorded in the routing table, the front end identifier corresponding to the selected server can be determined according to the preset routing table; in order to facilitate the user to access more conveniently later, the front-end identifier corresponding to the selected server may also be written into cookies, and then the cookies are sent to the client 3. If the front end identifier corresponding to the server is not recorded in the routing table, the front end identifier of the server which the user logs in last time should be carried in the access request, and then the front end identifier of the server which the user requests to access is directly obtained through analysis from the access request.
(S2023') querying a route table preset in the http proxy server for a path of the server 1 corresponding to the front-end identifier.
In this embodiment, a routing table is provided in advance on the http proxy server, and the routing table is recorded with a correspondence between paths of servers in the server cluster and front-end identifiers.
(S2024') forwards the access request to the server 1 according to the path.
The scheme uses the routing table to establish the association between the front end identifier and the server 1, so that the client 3 can access the corresponding server according to the front end identifier, when the server is newly added in the server 1, only the routing table is needed to be modified, no new secondary domain name is needed, and no additional server configuration is needed, so that the unification of external URLs can be maintained, the server 1 can be increased under the condition that the front end user cannot perceive the URL, the domain name can be effectively saved, and in addition, the mode of changing the routing table is simpler and more flexible than the mode of increasing the secondary domain name and the server configuration, and the later expansion is facilitated.
In step S203, the server 1 searches the database of the server 1 for data matching the determined interface through the determined interface.
In this embodiment, the server 1 searches the database of the server 1 for data matching the interface request parameter (requestParam) in the access request through the determined interface.
In step S204, the server 1 transmits the loading data found from the database to the client 3 to cause the client 3 to load the loading data.
In this embodiment, the method further includes, after step S201: the client 3 monitors the response state of the server 1 to the request of the loading data; and when the response for requesting the loading data is overtime or fails, re-requesting to load the loading data. Therefore, when the resource loading fails, the loading request is automatically retried, and the loading failure rate is reduced.
In this embodiment, the response status to the request for the load data may be obtained using a status word. In the implementation process, the client 3 and the server 1 may agree on rules of response status, such as status codes, data formats, and error information prompts fed back to the client 3 by the client 1.
In this embodiment, the front end of the client 3 may be a web document, the tail of the web document (i.e., the front end) includes a code corresponding to the manner of loading the loading data, and the code corresponding to the manner of loading the loading data is placed at the tail of the web document of the client 3, so that the browser APP of the client 3 may not be interrupted as much as possible when analyzing the web document, thereby accelerating the response time of the web page layout.
In this embodiment, when executing the code placed at the tail of the web document, if the number of downloaded data to be loaded is a plurality of, the browser APP of the client 3 adds the downloaded plurality of loaded data to the web document according to the requested sequence. In this embodiment, if the number of downloaded load data is multiple, the requests for downloading the load data by the browser APP of the client 3 may be multiple in parallel, so as to increase the downloading speed, but after downloading the load data, the downloaded load data are loaded into the web document according to the sequence of the requests, so as to ensure the dependency between different load data having the dependency relationship. For example: assuming that the web document contains three pieces of loading data A, B, C, the correct loading of B depends on the correct loading of a, the correct loading of C depends on the correct loading of B, and the browser APP requests to download the three pieces of loading data from each server simultaneously according to the sequence of A, B, C, although the sequence of completing the downloading is B, A, C due to the difference of the data size of each piece of loading data and the network transmission speed between each server, the browser APP still adds the 3 pieces of loading data to the web document according to the sequence of A, B, C, so that B, C cannot cause unnecessary loading failure due to advanced loading, thereby ensuring that all pieces of loading data can be loaded smoothly and improving loading efficiency.
In this embodiment, the monitoring, by the client 3, the response state of the server 1 to the request for loading data further includes:
the client 3 sends out a request for loading data and then carries out timing;
when the timing time exceeds a preset time, a prompt message requesting overtime is sent out to prompt the server 1 to respond too long. Thus, the meaningless waiting of the user for a long time is avoided, and the user experience is improved.
In this embodiment, the client 3 communicates with the server 1 via the HTTP2.0 protocol, which is advantageous in reducing the mesh delay and reducing the link pressure of the server 1.
Example 2
Fig. 3 is a block diagram of a back-end interface response device 40 according to an embodiment of the present invention.
In some embodiments, the backend interface response device 40 operates in an electronic device. The back-end interface response means 40 may comprise a plurality of functional modules consisting of program code segments. Program code for each program segment in the back-end interface response means 40 may be stored in the memory and executed by the at least one processor to perform the function of the back-end interface response.
In this embodiment, the rear-end interface response device 40 of the electronic device may be divided into a plurality of functional modules according to the functions performed by the device. Referring to fig. 3, the back-end interface response device 40 may include a request module 401, an interface determination module 402, a data search module 403, a sending module 404, and a listening module 405. The module referred to in the present invention refers to a series of computer program segments capable of being executed by at least one processor and of performing a fixed function, stored in a memory. The request module 401, the listening module 405 run in the client 3, and the interface determination module 402, the data lookup module 403, the sending module 404 run in the server 1. In some embodiments, the function of each module will be described in detail in the following embodiments.
The request module 401 is configured to control the client 3 to send an access request to the server 1 to obtain the loading data.
In this embodiment, the access request includes a forwarding parameter, where the forwarding parameter is used for the backend to find data. In this embodiment, the forwarding parameters include, but are not limited to: method, shortUrl, requestParam, retKey, splitPath, cacheTime. Wherein the method represents the forwarded interface request mode, and the default value is GET. shortUrl represents the forwarded interface address. requestmaram represents the interface request parameters forwarded. The retKey represents a key value stored in the processed interface data, and the default value represents the retKey. split PATH represents the PATH that needs to intercept data returned to a node in a message. The cacheTime represents a cache time control identification.
In this embodiment, when there is a need to load front-end data at the front end of the client 3, the request module 401 controls the client 3 to send a request to the server 1. In a specific embodiment, the request module 401 determines, according to the description information of the front-end data of the client 3, whether the front-end data is stored locally in the client 3; when the front-end data is stored locally in the client 3, the request module 401 controls the client 3 to read the front-end data from the local as loading data; when the client 3 locally stores front-end data, the request module 401 controls the client 3 to send the access request to the server 1 to obtain the loading data.
In this embodiment, the description information of the front-end data includes a javaScript source file and a CSS source file. The description information is used for describing the identification, the property and the characteristics of the front-end data. In this embodiment, the front end of the client 3 may be a web document. The request module 401 controls the front end of the client 3 to load the whole block frame of the web page document according to the front end data and run the loading component.
In this embodiment, whether the loaded data is stored locally is determined according to the description information of the front-end data of the front end, and if the loaded data is stored, the client 3 directly reads the loaded data from the local; if the loading data does not exist, the client 3 requests the server 1 to acquire the loading data, so that the pressure of a rear end interface of the server 1 can be reduced, the speed of front end resources required by the client 3 for non-first loading can be improved, and the traffic occupation can be reduced.
In an embodiment, if the front-end data is initialization data or data with a change in the state of the web document, the request module 401 controls the client 3 to send an access request to the server 1 to obtain the initialization data or the data with a change in the state of the web document. If the front-end data is the initialization data which is not loaded for the first time or the data of which the state of the web document is not changed, the request module 401 controls the client 3 to read the initialization data which is not loaded for the first time or the data of which the state of the web document is not changed from the local.
The interface determining module 402 is configured to control the server 1 to receive an access request sent by the client 3, and determine a matched interface according to the access request.
In this embodiment, when the server 1 receives the access request sent by the client 3, the interface determining module 402 determines a matched interface according to an interface address parameter (shortUrl) in the access request. In a specific embodiment, the interface determining module 402 is further configured to access the interface when the server 1 determines a matched interface according to the interface address parameter in the access request, and return a prompt message to the client 3 to alert that the access is wrong when the server 1 does not determine the interface matching the interface address parameter according to the interface address parameter in the access request.
In this embodiment, the interface determining module 402 controls the server 1 to check all the back interfaces included in the server 1 one by one according to the interface address parameter in the access request, and when the interface matching the access request is determined, the interface enters the inlet and when the interface matching the access request is not found, a reminding message is returned to the client 3 to remind the user of the access error, so as to avoid the condition that the interface is not responded, and thus avoid the condition that the user accesses the interface by using the sql query parameter which is excessively complex and nested in operation, so that the interface is not responded.
In an embodiment, the interface determining module 402 controls the server 1 to receive the request sent by the client 3 based on the non-aware directional proxy method of the http proxy server. The server 1 is a server cluster, and the server cluster includes a plurality of servers. Specifically, the http proxy server receives an access request sent by the client 3, determines a front end identifier of a server sending the access request according to the access request, queries a path of the server 1 corresponding to the front end identifier in a routing table preset in the http proxy server, and forwards the access request to the server 1 according to the path. In this embodiment, the http proxy server may be a nmginx, a Squid, or an Apache Traffic server. The front-end identifier described in this embodiment may be a unique identifier such as a code or a name of the server 1, and is mainly used to identify different servers 1.
In this embodiment, after receiving the access request, the http proxy server may determine the front end identifier of the corresponding server 1 according to the access request, and specifically, there may be multiple possible embodiments according to the content of the access request. In this embodiment, the server 1 determines whether the user of the client 3 is a newly registered user according to the access request. Wherein, whether the user is a new registered user can be judged by adopting a mode of judging whether the access request contains registration information, whether the user information exists in a user database, and the like. If the user is newly registered, the server 1 does not have the privateization data before the user, a server is selected from the server clusters according to the load condition of each server in the current server clusters and is allocated to the user, a routing table is preset on the http proxy server, and if the front end identifier corresponding to the server is recorded in the routing table, the front end identifier corresponding to the selected server can be determined according to the preset routing table; in order to facilitate the user to access more conveniently later, the front-end identifier corresponding to the selected server may also be written into cookies, and then the cookies are sent to the client 3. If the front end identifier corresponding to the server is not recorded in the routing table, the front end identifier of the server which the user logs in last time should be carried in the access request, and then the front end identifier of the server which the user requests to access is directly obtained through analysis from the access request.
In this embodiment, a routing table is provided in advance on the http proxy server, and the routing table is recorded with a correspondence between paths of servers in the server cluster and front-end identifiers. The scheme uses the routing table to establish the association between the front end identifier and the server 1, so that the client 3 can access the corresponding server according to the front end identifier, when the server is newly added in the server 1, only the routing table is needed to be modified, no new secondary domain name is needed, and no additional server configuration is needed, so that the unification of external URLs can be maintained, the server 1 can be increased under the condition that the front end user cannot perceive the URL, the domain name can be effectively saved, and in addition, the mode of changing the routing table is simpler and more flexible than the mode of increasing the secondary domain name and the server configuration, and the later expansion is facilitated.
The data searching module 403 is configured to control the server 1 to search, through a determined interface, data matching the determined interface from a database of the server 1.
In this embodiment, the data searching module 403 controls the server 1 to search the database of the server 1 for data matching the interface request parameter (requestParam) in the access request through the determined interface.
The sending module 404 is configured to send the loading data found from the database to the client 3, so that the client 3 loads the loading data.
The monitoring module 405 monitors the response state of the client 3 to the request of the loading data by the server 1, and when the response of the request of the loading data is overtime or fails, the loading of the loading data is re-requested. Therefore, when the resource loading fails, the loading request is automatically retried, and the loading failure rate is reduced.
In this embodiment, the response status to the request for the load data may be obtained using a status word. In the implementation process, the client 3 and the server 1 may agree on rules of response status, such as status codes, data formats, and error information prompts fed back to the client 3 by the client 1.
In this embodiment, the front end of the client 3 may be a web document, and the tail of the web document (i.e., the front end) includes a code corresponding to the manner of loading the loading data, that is, the code corresponding to the manner of loading the loading data is placed at the tail of the web document of the client 3, so that the browser APP of the client 3 may not be interrupted as much as possible when analyzing the web document, thereby accelerating the response time of the web page layout.
In this embodiment, when executing the code placed at the tail of the web document, if the number of downloaded data to be loaded is a plurality of, the browser APP of the client 3 adds the downloaded plurality of loaded data to the web document according to the requested sequence. In this embodiment, if the number of downloaded load data is multiple, the requests for downloading the load data by the browser APP of the client 3 may be multiple in parallel, so as to increase the downloading speed, but after downloading the load data, the downloaded load data are loaded into the web document according to the sequence of the requests, so as to ensure the dependency between different load data having the dependency relationship. For example: assuming that the web document contains three pieces of loading data A, B, C, the correct loading of B depends on the correct loading of a, the correct loading of C depends on the correct loading of B, and the browser APP requests to download the three pieces of loading data from each server simultaneously according to the sequence of A, B, C, although the sequence of completing the downloading is B, A, C due to the difference of the data size of each piece of loading data and the network transmission speed between each server, the browser APP still adds the 3 pieces of loading data to the web document according to the sequence of A, B, C, so that B, C cannot cause unnecessary loading failure due to advanced loading, thereby ensuring that all pieces of loading data can be loaded smoothly and improving loading efficiency.
In this embodiment, the monitoring module 405 is further configured to perform timing after the client 3 sends a request for loading data, and send a reminder for requesting timeout when the timing time exceeds a preset time to remind the server 1 of excessively long response time. Thus, the meaningless waiting of the user for a long time is avoided, and the user experience is improved.
In this embodiment, the client 3 communicates with the server 1 via the HTTP2.0 protocol, which is advantageous in reducing the mesh delay and reducing the link pressure of the server 1.
Example III
Fig. 4 is a schematic diagram of a preferred embodiment of the electronic device 7 according to the present invention.
The electronic device 7 comprises a memory 71, a processor 72 and a computer program 73 stored in the memory 71 and executable on the processor 72. The processor 72, when executing the computer program 73, implements the steps of the embodiments of the back-end interface response method described above, such as steps 201-204 shown in fig. 2. Alternatively, the processor 42, when executing the computer program 43, performs the functions of the modules/units of the embodiment of the back-end interface response device described above, e.g., modules 401-405 in fig. 3.
Illustratively, the computer program 73 may be partitioned into one or more modules/units that are stored in the memory 71 and executed by the processor 72 to complete the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing the specified functions, which instruction segments are used for describing the execution of the computer program 73 in the electronic device 7. For example, the computer program 73 may be divided into a request module 401, an interface determination module 402, a data search module 403, a sending module 404, and a listening module 405 in fig. 3, where each module has a specific function, see embodiment two.
The electronic device 7 may be a computing device such as a desktop computer, a notebook computer, a palm computer, a cloud server, etc. It will be appreciated by those skilled in the art that the schematic diagram is merely an example of the electronic device 7 and does not constitute a limitation of the electronic device 7, and may include more or less components than illustrated, or may combine certain components, or different components, e.g. the electronic device 7 may also include input-output devices, network access devices, buses, etc.
The processor 72 may be a central processing module (Central Processing Unit, CPU), but may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor 72 may be any conventional processor or the like, the processor 72 being a control center of the electronic device 7, with various interfaces and lines connecting the various parts of the entire electronic device 7.
The memory 71 may be used to store the computer program 73 and/or modules/units, and the processor 72 may implement the various functions of the meter electronics 7 by executing or executing the computer program and/or modules/units stored in the memory 71 and invoking data stored in the memory 71. The memory 71 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, application programs (such as a sound playing function, an image playing function, etc.) required for at least one function, and the like; the storage data area may store data created according to the use of the electronic device 7 (such as audio data, phonebooks, etc.), and the like. In addition, the memory 71 may include a high-speed random access memory, and may further include a nonvolatile memory such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash Card (Flash Card), at least one disk storage device, a Flash memory device, or other volatile solid-state storage device.
The integrated modules/units of the electronic device 7 may be stored in a computer readable storage medium if implemented in the form of software functional modules and sold or used as a stand alone product. Based on such understanding, the present invention may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, where the computer program, when executed by a processor, may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the computer readable medium contains content that can be appropriately scaled according to the requirements of jurisdictions in which such content is subject to legislation and patent practice, such as in certain jurisdictions in which such content is subject to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.
In the several embodiments provided in the present invention, it should be understood that the disclosed electronic device and method may be implemented in other manners. For example, the above-described embodiments of the electronic device are merely illustrative, and the modules may be divided into only one type of logic functions, and there may be additional ways of dividing the modules when actually implemented.
In addition, each functional module in the embodiments of the present invention may be integrated in the same processing module, or each module may exist alone physically, or two or more modules may be integrated in the same module. The integrated modules may be implemented in hardware or in hardware plus software functional modules.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof. The present embodiments are, therefore, to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned. Furthermore, it is evident that the word "comprising" does not exclude other modules or steps, and that the singular does not exclude a plurality. A plurality of modules or electronic devices recited in the electronic device claims may also be implemented by means of software or hardware by means of one and the same module or electronic device. The terms first, second, etc. are used to denote a name, but not any particular order.
Finally, it should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made to the technical solution of the present invention without departing from the spirit and scope of the technical solution of the present invention.

Claims (9)

1. The back-end interface response method is applied to a client and a server in communication connection with the client, and is characterized by comprising the following steps:
the client sends an access request to the server to acquire loading data, including: if the front-end data of the client is the data with the changed state of the webpage document, the client sends the access request to the server to acquire the data with the changed state of the webpage document; if the front-end data is the data with unchanged state of the webpage document, the client reads the data with unchanged state of the webpage document from the local of the client, wherein the access request comprises forwarded interface address parameters;
the server receives an access request sent by the client and determines a matched interface according to interface address parameters in the access request;
The server searches data matched with the matched interface from a database of the server through the matched interface; and
And the server transmits the loading data searched from the database to the client so as to enable the client to load the loading data.
2. The back-end interface response method of claim 1, wherein the client sending an access request to the server to obtain loading data comprises:
the client judges whether front-end data are stored locally or not according to the description information of the front-end data of the client;
when front-end data is stored in the local of the client, the client reads the front-end data from the local of the client as loading data; and
And when the local part of the client does not store the front-end data, the client sends the access request to the server to acquire the loading data.
3. The back-end interface response method of claim 1, wherein the server receiving the access request sent by the client and determining a matched interface according to the interface address parameter in the access request comprises:
When the server determines a matched interface according to the interface address parameter in the access request, accessing the matched interface; and
And when the server does not determine the interface matched with the interface address parameter according to the interface address parameter in the access request, a prompt message is returned to the client to remind of access errors.
4. The back-end interface response method of claim 1, wherein the server receiving the access request sent by the client comprises:
and receiving an access request sent by the client through an http proxy server, wherein the http proxy server determines the front end identification of a target server according to the access request, queries a route table preset in the http proxy server for a route of the target server corresponding to the front end identification, and forwards the access request according to the route.
5. The back-end interface response method of claim 1, wherein the method further comprises the steps of:
the client monitors the response state of the server to the access request; and
And resending the access request to acquire the loading data when the response of the access request is overtime or fails.
6. The back-end interface response method of claim 5, wherein the client listening for the server's response status to requesting the load data further comprises:
the client side sends out a data loading request and then carries out timing;
and when the timing time exceeds a preset time, sending out a reminding message for requesting overtime so as to remind the server of excessively long response time.
7. A back-end interface response device for use in a client and a server communicatively connected to the client, the device comprising a module for implementing the back-end interface response method according to any one of claims 1-6, the device comprising:
the request module is used for controlling the client to send an access request to the server to acquire loading data, wherein the access request comprises forwarded interface address parameters;
the interface determining module is used for controlling the server to receive the access request sent by the client and determining a matched interface according to the interface address parameter in the access request;
the data searching module is used for controlling the server to search data matched with the interface from a database of the server through the determined interface; and
And the sending module is used for controlling the server to transmit the loading data searched from the database to the client so as to enable the client to load the loading data.
8. An electronic device, characterized in that: the electronic device comprising a processor for implementing the back-end interface response method according to any of claims 1-6 when executing a computer program stored in a memory.
9. A computer-readable storage medium having stored thereon a computer program, characterized by: the computer program, when executed by a processor, implements the back-end interface response method of any of claims 1-6.
CN201811537748.XA 2018-12-15 2018-12-15 Rear-end interface response method and device, electronic equipment and storage medium Active CN109871498B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811537748.XA CN109871498B (en) 2018-12-15 2018-12-15 Rear-end interface response method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811537748.XA CN109871498B (en) 2018-12-15 2018-12-15 Rear-end interface response method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109871498A CN109871498A (en) 2019-06-11
CN109871498B true CN109871498B (en) 2024-04-02

Family

ID=66917090

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811537748.XA Active CN109871498B (en) 2018-12-15 2018-12-15 Rear-end interface response method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109871498B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110427324B (en) * 2019-07-30 2023-09-08 中国工商银行股份有限公司 Joint debugging system, joint debugging method, computer equipment and storage medium
CN113127414B (en) * 2019-12-31 2023-05-23 贵州白山云科技股份有限公司 Request processing method and system and edge node
CN112115103B (en) * 2020-09-02 2023-08-01 北京奇艺世纪科技有限公司 File address display method and device, electronic equipment and readable storage medium
CN113590100A (en) * 2021-09-28 2021-11-02 深圳市信润富联数字科技有限公司 Front-end interface processing method, system, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103593466A (en) * 2013-11-26 2014-02-19 优视科技有限公司 Webpage loading method, client side and server
CN105930538A (en) * 2016-06-27 2016-09-07 北京奇虎科技有限公司 Webpage accessing request processing method and server
CN106921699A (en) * 2015-12-25 2017-07-04 北京奇虎科技有限公司 A kind of Network Access Method, device and system
CN106951573A (en) * 2017-04-27 2017-07-14 努比亚技术有限公司 A kind of living broadcast interactive data load method, server and computer-readable medium
CN106961469A (en) * 2017-02-28 2017-07-18 北京致远互联软件股份有限公司 Unaware orientation Proxy Method and system based on http proxy servers
CN108093086A (en) * 2018-01-22 2018-05-29 微梦创科网络科技(中国)有限公司 The data transmission method and system of a kind of gateway

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7881304B2 (en) * 2008-05-29 2011-02-01 Red Hat, Inc. Using distributed aspects to reorder online application workflows
US8914466B2 (en) * 2011-07-07 2014-12-16 International Business Machines Corporation Multi-level adaptive caching within asset-based web systems

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103593466A (en) * 2013-11-26 2014-02-19 优视科技有限公司 Webpage loading method, client side and server
CN106921699A (en) * 2015-12-25 2017-07-04 北京奇虎科技有限公司 A kind of Network Access Method, device and system
CN105930538A (en) * 2016-06-27 2016-09-07 北京奇虎科技有限公司 Webpage accessing request processing method and server
CN106961469A (en) * 2017-02-28 2017-07-18 北京致远互联软件股份有限公司 Unaware orientation Proxy Method and system based on http proxy servers
CN106951573A (en) * 2017-04-27 2017-07-14 努比亚技术有限公司 A kind of living broadcast interactive data load method, server and computer-readable medium
CN108093086A (en) * 2018-01-22 2018-05-29 微梦创科网络科技(中国)有限公司 The data transmission method and system of a kind of gateway

Also Published As

Publication number Publication date
CN109871498A (en) 2019-06-11

Similar Documents

Publication Publication Date Title
CN109871498B (en) Rear-end interface response method and device, electronic equipment and storage medium
US20190356596A1 (en) Service link selection control method and device
WO2021184824A1 (en) Application program interface gateway based method for separating front and back ends and related device
CN107786621B (en) User information management method, access processing method, device and system
CN107809383B (en) MVC-based path mapping method and device
CN111399756B (en) Data storage method, data downloading method and device
CN112422702A (en) CDN back-to-source method, system and computer equipment
CN110297944B (en) Distributed XML data processing method and system
CN109151025B (en) Load balancing method and device based on URL, computer storage medium and equipment
US20200204688A1 (en) Picture book sharing method and apparatus and system using the same
US20230214438A1 (en) Technologies for cross-device shared web resource cache
CN113645287B (en) Automobile message storage method and device and automobile message storage system
CN111444278A (en) Data synchronization method and device and transfer server
CN114116898A (en) Method, apparatus, and storage medium for content acquisition at edge clouds
CN112182378A (en) Message pushing method, device, terminal and medium
CN114116656B (en) Data processing method and related device
US11323537B1 (en) Generating early hints informational responses at an intermediary server
CN117056033A (en) Data processing method, device, MEC server and storage medium
CN112131263B (en) Software package acquisition method, system, device, electronic equipment and storage medium
CN112764897B (en) Task request processing method, device and system and computer readable storage medium
CN114338809A (en) Access control method, device, electronic equipment and storage medium
CN113542022A (en) Networking management method and device of networking system, terminal equipment and storage medium
CN105471593B (en) Group conversation method, device and system
CN113761400A (en) Access request forwarding method, device and equipment
CN111008220A (en) Dynamic identification method and device of data source, storage medium and electronic device

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