CN107517254B - Dynamic data request processing system and method - Google Patents

Dynamic data request processing system and method Download PDF

Info

Publication number
CN107517254B
CN107517254B CN201710725102.3A CN201710725102A CN107517254B CN 107517254 B CN107517254 B CN 107517254B CN 201710725102 A CN201710725102 A CN 201710725102A CN 107517254 B CN107517254 B CN 107517254B
Authority
CN
China
Prior art keywords
request
http
data
http data
data 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.)
Expired - Fee Related
Application number
CN201710725102.3A
Other languages
Chinese (zh)
Other versions
CN107517254A (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.)
BEIJING MITENO COMMUNICATION TECHNOLOGY CO LTD
Original Assignee
BEIJING MITENO COMMUNICATION TECHNOLOGY CO LTD
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by BEIJING MITENO COMMUNICATION TECHNOLOGY CO LTD filed Critical BEIJING MITENO COMMUNICATION TECHNOLOGY CO LTD
Priority to CN201710725102.3A priority Critical patent/CN107517254B/en
Publication of CN107517254A publication Critical patent/CN107517254A/en
Application granted granted Critical
Publication of CN107517254B publication Critical patent/CN107517254B/en
Expired - Fee Related 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/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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention provides a dynamic data request processing system and a dynamic data request processing method, and relates to the technical field of internet. The method comprises the following steps: the request control module initiates an HTTP request to generate a request list, wherein the HTTP request is formed by integrating a plurality of HTTP data requests; calculating abstract characteristic values of a plurality of HTTP data requests, adding the abstract characteristic values into a request list, and sending the abstract characteristic values to a multi-request proxy interface; the multi-request proxy interface receives the request list, distributes each HTTP data request to an endpoint corresponding to a back end in an asynchronous calling mode for processing, assembles and processes target service data corresponding to each data request after the target service responds, and returns the target service data to a cache to serve as result data required to respond by each request; in this way, the request control module may invoke the requested service data in the cache according to the digest feature value of each HTTP data request.

Description

Dynamic data request processing system and method
Technical Field
The invention relates to the technical field of internet, in particular to a dynamic data request processing system and a dynamic data request processing method.
Background
With the widespread application of the web page development technology AJAX (Asynchronous JavaScript and XML) for creating interactive web page applications, single-page systems are becoming popular, view templates and control logic (such as Script scripts) are cached as static resources at a client side besides dynamic data, and only necessary dynamic data can be sent to and retrieved from a server through a request control module, so that data exchanged between the server and a client browser is greatly reduced, a large amount of data processing work is finished by handing over to the client browser, and the processing time of the server is reduced. Therefore, the AJAX technology is used for communicating and maintaining data with a server on the premise of not refreshing the whole page. The client browser can respond to the user interaction more quickly, unchanged information is prevented from being sent on the network, the waiting time of the user is reduced, and excellent user experience is brought. Meanwhile, for the server side, the AJAX technology can transfer some work which needs the burden of the server to the client browser, and the work is processed by utilizing the idle capacity of the client browser, so that the burden of the server is reduced, the burden of redundant requests and responses to the server is reduced, and the site performance of the server is improved. The single-page system enables a client browser to acquire effective data as required, but is different from the traditional web application that all data are acquired by requesting once, when the single-page system enters a new page, the page is initialized, and the client browser simultaneously and concurrently sends a large amount of AJAX request calls, so that great pressure is caused on a server network; meanwhile, the large number of requests of the client browser can cause the response of the front-end page to become slow, so that the customer experience is influenced, and the original intention of reducing data exchange of the front end and the back end is violated.
Disclosure of Invention
The embodiment of the invention provides a dynamic data request processing system and a dynamic data request processing method, which aim to solve the problem that when a single-page system enters a new page, a browser of a client side for initializing the page simultaneously sends a large number of AJAX request calls.
In order to achieve the purpose, the invention adopts the following technical scheme:
a dynamic data request processing system, comprising: the system comprises a page initialization process module, a request control module and an initialization cache module which are executed on a front-end browser, and a multi-request proxy interface which is executed on a back-end server;
the page initialization process module initializes the page;
the request control module initiates an HTTP request to generate a request list, wherein the HTTP request is formed by integrating a plurality of HTTP data requests; calculating abstract characteristic values of the HTTP data requests, adding the abstract characteristic values into the request list, and sending the abstract characteristic values to the multi-request proxy interface; the initialization of the page component is set to be delayed until the multi-request proxy interface returns data;
the multi-request proxy interface receives the request list, distributes each HTTP data request to an endpoint corresponding to a back end in an asynchronous calling mode for processing, and assembles service data corresponding to each HTTP data request according to the obtained target service corresponding to each HTTP data request;
the multi-request proxy interface acquires service data corresponding to each assembled HTTP data request, and stores the service data corresponding to each assembled HTTP data request into a cache created by the initialization cache module according to the key value of the abstract characteristic value corresponding to each HTTP data request as result data required to respond to each request.
Further, in the process of initializing the components, when the abstract characteristic values corresponding to the HTTP data requests exist in the cache, the page component acquires result data corresponding to the abstract characteristic values corresponding to the HTTP data requests, determines the result data corresponding to the abstract characteristic values corresponding to the HTTP data requests in the cache as expired data, and then clears the result data; and carrying out component initialization operation according to the result data.
In addition, the request control module is specifically configured to integrate a plurality of HTTP data requests into one HTTP request, and generate a request list; calculating an abstract characteristic value corresponding to each HTTP data request according to the access parameters of each HTTP data request, and adding the abstract characteristic value into the request list; the access parameters of each HTTP data request comprise a path address of a resource file acquired by the HTTP data request, a request method of the HTTP data request, a request protocol header of the HTTP data request, query parameters of the HTTP data request and submission data of the HTTP data request.
In addition, in the process of carrying out component initialization operation, when the abstract characteristic value corresponding to the HTTP data request does not exist in the cache, the request control module sends the HTTP data request to the multi-request proxy interface.
In addition, the multi-request proxy interface is specifically configured to:
receiving the request list, and traversing HTTP data requests in the request list;
performing simulated encapsulation of Request and Response objects on each HTTP data Request in the Request list, and dropping the HTTP data Request into a thread pool to execute service calling;
asynchronously executing a scheduling task according to the thread pool, and distributing each HTTP data request to a target service endpoint corresponding to a back end for processing to obtain a target service corresponding to each HTTP data request;
blocking the task group of the waiting list, and waiting for response until the execution of all the tasks of the list is finished;
and after the execution of the list task group is finished, splicing the service data corresponding to each HTTP data request according to the abstract characteristic value corresponding to each HTTP data request.
A dynamic data request processing method is applied to the dynamic data request processing system; the method comprises the following steps:
the page initialization process module initializes the page;
the request control module initiates an HTTP request to generate a request list, wherein the HTTP request is formed by integrating a plurality of HTTP data requests; calculating abstract characteristic values corresponding to the HTTP data requests, adding the abstract characteristic values into the request list, and sending the abstract characteristic values to a multi-request proxy interface; the initialization of the page component is set to be delayed until the multi-request proxy interface returns data;
the multi-request proxy interface receives the request list, distributes each HTTP data request to an endpoint corresponding to a back end in an asynchronous calling mode for processing, and assembles service data corresponding to each HTTP data request according to the obtained target service corresponding to each HTTP data request;
the multi-request proxy interface acquires service data corresponding to each assembled HTTP data request, and stores the service data corresponding to each assembled HTTP data request into a cache created by the initialization cache module according to the key value of the abstract characteristic value corresponding to each HTTP data request as result data required to respond to each request.
Further, the dynamic data request processing method further includes:
in the process of carrying out component initialization operation, when the abstract characteristic values corresponding to the HTTP data requests exist in the cache, the page component acquires result data corresponding to the abstract characteristic values corresponding to the HTTP data requests, determines the result data corresponding to the abstract characteristic values corresponding to the HTTP data requests in the cache as expired data and then clears the result data;
and the page component performs component initialization operation according to the result data.
Specifically, the request control module initiates an HTTP request to generate a request list, including:
the request control module integrates a plurality of HTTP data requests into an HTTP request to generate a request list;
the request control module calculates the summary characteristic values corresponding to the plurality of HTTP data requests, adds the summary characteristic values into the request list, and comprises the following steps:
the request control module calculates the abstract characteristic value corresponding to each HTTP data request according to the access parameter of each HTTP data request and adds the abstract characteristic value into the request list; the access parameters of each HTTP data request comprise a path address of a resource file acquired by the HTTP data request, a request method of the HTTP data request, a request protocol header of the HTTP data request, query parameters of the HTTP data request and submission data of the HTTP data request.
Further, the dynamic data request processing method further includes:
in the process of carrying out component initialization operation, when the abstract characteristic value corresponding to the HTTP data request does not exist in the cache, the request control module sends the HTTP data request to the multi-request proxy interface.
Specifically, the receiving, by the multi-request proxy interface, the request list, and distributing each HTTP data request to an endpoint corresponding to a back end in an asynchronous call manner for processing, and assembling service data corresponding to each HTTP data request according to a target service corresponding to each obtained HTTP data request includes:
the multi-request proxy interface receives the request list and traverses HTTP data requests in the request list;
performing simulated encapsulation of Request and Response objects on each HTTP data Request in the Request list, and dropping the HTTP data Request into a thread pool to execute service calling;
asynchronously executing a scheduling task according to the thread pool, and distributing each HTTP data request to a target service endpoint corresponding to a back end for processing to obtain a target service corresponding to each HTTP data request;
blocking the task group of the waiting list, and waiting for response until the execution of all the tasks of the list is finished;
and after the execution of the list task group is finished, splicing the service data corresponding to each HTTP data request according to the abstract characteristic value corresponding to each HTTP data request.
The embodiment of the invention provides a dynamic data request processing system and a method, wherein a page initialization process module carries out page initialization; the request control module initiates an HTTP request to generate a request list, wherein the HTTP request is formed by integrating a plurality of HTTP data requests; calculating abstract characteristic values of a plurality of HTTP data requests, adding the abstract characteristic values into the request list, and sending the abstract characteristic values to the multi-request proxy interface; the initialization of the page component is set to be delayed until the multi-request proxy interface returns data; the multi-request proxy interface receives the request list, distributes each HTTP data request to an endpoint corresponding to a back end in an asynchronous calling mode for processing, and assembles service data corresponding to each HTTP data request according to the obtained target service corresponding to each HTTP data request; the multi-request proxy interface acquires service data corresponding to each assembled HTTP data request, stores the service data corresponding to each assembled HTTP data request into a cache created by the initialization cache module according to the key value of the abstract characteristic value corresponding to each HTTP data request, and uses the service data as result data required to respond to each request, so that the risk of multi-request storm caused by the request control module can be reduced. The embodiment of the invention aims to reduce network overhead, reduce the pressure of a back-end server, improve customer experience and simultaneously keep the additional cost and the invasiveness as low as possible.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a timing diagram of a prior art data request;
FIG. 2 is a schematic diagram of an operating environment of a dynamic data request processing system according to an embodiment of the present invention;
fig. 3 is a first flowchart of a dynamic data request processing method according to an embodiment of the present invention;
fig. 4 is a flowchart of a dynamic data request processing method according to an embodiment of the present invention;
fig. 5A is a part a of a timing chart of an embodiment of a dynamic data request processing method according to the present invention;
fig. 5B is a part B of a timing diagram of a specific application example of the dynamic data request processing method according to the embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the process of implementing the present invention, the inventor finds that in a single-page system application in the prior art, a page initialization process initiates an HTTP request, a request control module (which may be an AJAX module using an AJAX technology) merges the page requests to be optimized, and a back-end server customizes to provide an independent interface aggregation request and processes a target service call. As shown in fig. 1, the working principle is as follows:
when a front-end page P is initialized, an HTTP request is initiated according to initial requirements and sent to a back-end server; in the initialization process, the back end customizes an interface service X1 according to the business requirements of the page. Assuming that request tasks R1-Rn exist in the initialization process, the interface X1 aggregates the request tasks, traverses the request tasks after responding to the verification of the filter, sequentially executes and calls target services S1-Sn corresponding to the R1-Rn requests, returns an assembly result to the front end for storage after the service call is finished, and finishes the page initialization. For each page Pn to be optimized, the back-end server needs to provide a customized interface Xn to provide services for the page. The components initiate requests for initialization and subsequent operations, and each component explicitly defines, by hard coding, the manner in which data is obtained by the initialization process. For data which is uniformly obtained in the page initialization process, each component is directly used when the data is needed for the first time; for data that is not obtained during page initialization or that is not needed for the first time, an HTTP request will be initiated to obtain the data additionally.
With the prior art shown in fig. 1, there are the following problems:
high invasiveness: when a single-page system enters a new page, the initialization process of the components corresponding to the aggregated requests needs to be hard-coded to determine whether to use existing data or initiate an HTTP request by itself during initialization. This approach is highly intrusive to the front-end components, and also increases development costs;
maintenance cost is high: as the system runs, the initial aggregation request to adjust the pages needs to be considered for optimization purposes. Whether a new request is added or a part of requests are removed, the component code corresponding to the front end and the aggregation interface corresponding to the rear end need to be adjusted, and the maintenance cost is increased accordingly;
the processing process has low efficiency and poor user experience: the back-end server and the interface X1 adopt a serial calling mode when the R1-Rn are called in an aggregation mode, according to the scheme, the response time of the result returned by the interface X1 is the sum of the service response time of the requests R1-Rn, if the request response time of R1, R2, R3 and R4 is 1, 2, 3 and 4 seconds respectively, the response time of the interface X is the sum of the response time of each request, namely the request response time of R1-R4 consumes 10 seconds in total when the page is initialized, so that the page initialization waiting time is prolonged, and the user experience is influenced.
And fourthly, the additional cost is high, each page needing to be optimized needs to customize an independent back-end interface, which also leads to the increase of the development amount of the back end, so that a back-end developer needs to pay attention to the optimization content of the front end, and the additional cost is increased.
In order to overcome the above problems in the prior art, an embodiment of the present invention is different from the prior art solution shown in fig. 1, and as shown in fig. 2, an embodiment of the present invention provides a dynamic data request processing system, which includes a page initialization process module, a request control module, and an initialization cache module executed in a front-end browser 21, and a multi-request proxy interface executed in a back-end server 22. Here, the request control module may be implemented by an AJAX module.
And the page initialization process module carries out page initialization.
The request control module initiates an HTTP request to generate a request list, wherein the HTTP request is formed by integrating a plurality of HTTP data requests; calculating abstract characteristic values of the HTTP data requests, adding the abstract characteristic values into the request list, and sending the abstract characteristic values to the multi-request proxy interface; the initialization of the page component is set to delay until after the multi-request broker interface returns data.
The multi-request proxy interface receives the request list, distributes each HTTP data request to an endpoint corresponding to a back end in an asynchronous calling mode for processing, and assembles service data corresponding to each HTTP data request according to the obtained target service corresponding to each HTTP data request.
The multi-request proxy interface acquires service data corresponding to each assembled HTTP data request, and stores the service data corresponding to each assembled HTTP data request into a cache created by the initialization cache module according to the key value of the abstract characteristic value corresponding to each HTTP data request as result data required to respond to each request.
Further, in the process of initializing the components, when the abstract characteristic values corresponding to the HTTP data requests exist in the cache, the page component acquires result data corresponding to the abstract characteristic values corresponding to the HTTP data requests, determines the result data corresponding to the abstract characteristic values corresponding to the HTTP data requests in the cache as expired data, and then clears the result data; and the page component performs component initialization operation according to the result data.
In addition, the request control module is specifically configured to integrate the multiple HTTP data requests into one HTTP request, and generate a request list; calculating an abstract characteristic value corresponding to each HTTP data request according to the access parameters of each HTTP data request, and adding the abstract characteristic value into the request list; the access parameter of each HTTP data request includes a path address of an acquired resource file of the HTTP data request, a request method of the HTTP data request, a request protocol header of the HTTP data request, a query parameter of the HTTP data request, and submission data of the HTTP data request, but is not limited thereto.
In addition, in the process of carrying out component initialization operation, when the abstract characteristic value corresponding to the HTTP data request does not exist in the cache, the request control module sends the HTTP data request to the multi-request proxy interface.
In addition, the multi-request proxy interface is specifically configured to:
and receiving the request list, and traversing the HTTP data requests in the request list.
And performing simulation packaging on Request and Response objects for each HTTP data Request in the Request list, and dropping the HTTP data Request into a thread pool to execute service calling.
Asynchronously executing a scheduling task according to the thread pool, and distributing each HTTP data request to a target service endpoint corresponding to a back end for processing to obtain a target service corresponding to each HTTP data request;
blocking the task group of the waiting list, and waiting for response until the execution of all the tasks of the list is finished;
and after the execution of the list task group is finished, splicing the service data corresponding to each HTTP data request according to the abstract characteristic value corresponding to each HTTP data request.
For a specific implementation of the dynamic data request processing system provided in the embodiment of the present invention, reference may be made to a specific embodiment of a subsequent dynamic data request processing method, which is not described herein again.
In the dynamic data request processing system provided by the embodiment of the invention, the page initialization process module performs page initialization; the request control module initiates an HTTP request to generate a request list, wherein the HTTP request is formed by integrating a plurality of HTTP data requests; calculating abstract characteristic values of a plurality of HTTP data requests, adding the abstract characteristic values into the request list, and sending the abstract characteristic values to the multi-request proxy interface; the initialization of the page component is set to be delayed until the multi-request proxy interface returns data; the multi-request proxy interface receives the request list, distributes each HTTP data request to an endpoint corresponding to a back end in an asynchronous calling mode for processing, and assembles service data corresponding to each HTTP data request according to the obtained target service corresponding to each HTTP data request; the multi-request proxy interface acquires service data corresponding to each assembled HTTP data request, stores the service data corresponding to each assembled HTTP data request into a cache created by the initialization cache module according to the key value of the abstract characteristic value corresponding to each HTTP data request, and uses the service data as result data required to respond to each request, so that the risk of multi-request storm caused by the request control module can be reduced. The embodiment of the invention aims to reduce network overhead, reduce the pressure of a back-end server, improve customer experience and simultaneously keep the additional cost and the invasiveness as low as possible.
Corresponding to the dynamic data request processing system shown in fig. 2, as shown in fig. 3, an embodiment of the invention provides a dynamic data request processing method applied to the dynamic data request processing system; the method comprises the following steps:
step 301, the page initialization process module initializes the page.
Step 302, a request control module initiates an HTTP request to generate a request list, wherein the HTTP request is formed by integrating a plurality of HTTP data requests; calculating abstract characteristic values of the HTTP data requests, adding the abstract characteristic values into the request list, and sending the abstract characteristic values to the multi-request proxy interface; the initialization of the page component is set to delay until after the multi-request broker interface returns data.
And step 303, the multi-request proxy interface receives the request list, distributes each HTTP data request to an endpoint corresponding to the back end in an asynchronous calling mode for processing, and assembles service data corresponding to each HTTP data request according to the target service corresponding to each obtained HTTP data request.
And step 304, the multi-request proxy interface acquires service data corresponding to each assembled HTTP data request, and stores the service data corresponding to each assembled HTTP data request into a cache created by the initialization cache module according to the abstract characteristic value corresponding to each HTTP data request as a key value, wherein the service data is used as result data required by each request to respond.
To make those skilled in the art understand the present invention more clearly, a specific embodiment is listed below, and as shown in fig. 4, an embodiment of the present invention provides a dynamic data request processing method, including:
step 401, the page initialization process module initializes the page.
Step 402, the request control module integrates multiple HTTP data requests into one HTTP request to generate a request list.
Step 403, the request control module calculates the digest feature value corresponding to each HTTP data request according to the access parameter of each HTTP data request, adds the digest feature value to the request list, and sends the digest feature value to the multi-request proxy interface.
The access parameter of each HTTP data request includes a path address of the resource file acquired by the HTTP data request, a request method of the HTTP data request, a request protocol header of the HTTP data request, a query parameter of the HTTP data request, and submission data of the HTTP data request, but is not limited thereto.
The Multi-Request proxy interface, which may be abbreviated as an MRA interface, is a unified interface running in the backend server, and is configured to receive an HTTP data Request from the front end and feed back service data.
Step 404, the multi-request proxy interface receives the request list and traverses the HTTP data requests in the request list.
And step 405, performing simulated encapsulation of Request and Response objects on each HTTP data Request in the Request list, and dropping the HTTP data Request into a thread pool to execute service calling.
The Request indicates an object for packaging the Web Request information, and includes Request parameter information and the like. Response denotes an object encapsulating the Web Response information, including a Response output content format, a content length, and the like.
And step 406, according to the thread pool asynchronous execution scheduling task, distributing each HTTP data request to a target service endpoint corresponding to the back end for processing, and acquiring a target service corresponding to each HTTP data request.
And 407, blocking the waiting list task group, and waiting for response until the execution of all list tasks is finished.
And step 408, after the execution of the list task group is finished, assembling the service data corresponding to each HTTP data request according to the abstract characteristic value corresponding to each HTTP data request.
Step 409, the multi-request proxy interface acquires service data corresponding to each assembled HTTP data request, and stores the service data corresponding to each assembled HTTP data request into a cache created by the initialization cache module according to the abstract characteristic value corresponding to each HTTP data request as a key value, wherein the key value is used as result data required by each request to respond.
Step 410, in the process of initializing the components, when the digest feature values corresponding to the HTTP data requests exist in the cache, the page component obtains the result data corresponding to the digest feature values corresponding to the HTTP data requests, and clears the result data corresponding to the digest feature values corresponding to the HTTP data requests in the cache after determining the result data as the expired data.
The result data in the cache can generally only be retrieved once, thereby ensuring the freshness of the result data.
In addition, in the process of carrying out component initialization operation, when the abstract characteristic value corresponding to the HTTP data request does not exist in the cache, the request control module sends the HTTP data request to the multi-request proxy interface, so that data is acquired from the back end for the HTTP data request through the multi-request proxy interface.
And 411, the page component performs component initialization operation according to the result data and completes subsequent user operation events.
In the embodiment of the present invention, a component refers to a page element, such as a city selection box in a page, and the component initializes data required to obtain all selectable city lists from the backend; in an embodiment of the invention, all component initializations in a page will be set to be delayed until after the multi-request broker interface returns data.
In the method for processing the dynamic data request provided by the embodiment of the invention, a page initialization process module carries out page initialization; the request control module initiates an HTTP request to generate a request list, wherein the HTTP request is formed by integrating a plurality of HTTP data requests; calculating abstract characteristic values of a plurality of HTTP data requests, adding the abstract characteristic values into the request list, and sending the abstract characteristic values to the multi-request proxy interface; the initialization of the page component is set to be delayed until the multi-request proxy interface returns data; the multi-request proxy interface receives the request list, distributes each HTTP data request to an endpoint corresponding to a back end in an asynchronous calling mode for processing, and assembles service data corresponding to each HTTP data request according to the obtained target service corresponding to each HTTP data request; the multi-request proxy interface acquires service data corresponding to each assembled HTTP data request, stores the service data corresponding to each assembled HTTP data request into a cache created by the initialization cache module according to the key value of the abstract characteristic value corresponding to each HTTP data request, and uses the service data as result data required to respond to each request, so that the risk of multi-request storm caused by the request control module can be reduced. The embodiment of the invention aims to reduce network overhead, reduce the pressure of a back-end server, improve customer experience and simultaneously keep the additional cost and the invasiveness as low as possible.
A specific application example of the dynamic data request processing method according to an embodiment of the present invention is listed below, wherein a timing chart of the embodiment of the present invention is shown in fig. 5A and 5B (a lower end of fig. 5A is connected to an upper end of fig. 5B, and fig. 5A and 5B are the same timing chart):
the process can be described as follows:
when a front-end page P is initialized, an MRA request (the MRA is a multi-request agent interface, and is called as an MRA or an MRA interface for short) is initiated according to the initial requirements of development configuration, and the initialization process delays the initialization request of each component in the page until the MRA result is returned to the end. Assuming that the page initialization process has requests R1 to Rn, the abstract algorithm is used to calculate the abstract characteristic value of each request according to the information of the endpoint, the parameters and the like of each request, generate a request list, and merge and submit the request list to the server agent interface MRA. It should be noted that the digest feature value is calculated according to the DATA digest such as URI, HTTP METHOD, header, PARAMS, DATA, etc. requested to access, where URI refers to the path address of the access resource, HTTP METHOD refers to the request METHOD, header refers to the HTTP request protocol header, PARAMS refers to the query parameter, and DATA refers to the submitted DATA. The abstract feature value calculation here adopts a common data abstract algorithm, which is not described herein again.
The back-end server needs to establish a uniform agent interface MRA, receive a native HTTP request access list from the front-end, and asynchronously distribute the requests to the corresponding endpoints. Then, the back-end server executes the following steps:
(1) the MRA interface receives the request list and traverses R1-Rn tasks in the original request list (R1-Rn tasks refer to the request tasks corresponding to the requests R1-Rn in the page initialization process).
(2) And simulating and packaging Request and Response objects for the native requests, and dropping the thread pool to execute service calling.
(3) The thread pool executes the scheduling task asynchronously, and the internal commit forwards the native request with the parameters to the target service endpoint (this step does not bypass the server's filter).
(4) And blocking the waiting task group, and waiting for response until all tasks are executed.
(5) And finishing the execution of the list task group, using the characteristic value of the original request as a key value, integrating the result of each request and returning the data to the page initialization process.
After receiving the results returned by the MRA, the page initialization process of the front-end browser stores the results in the initialization cache by using the digest characteristic values of the HTTP requests as key values, so as to be used in the subsequent component initialization process.
In the component initialization process, each component initiates a large number of AJAX requests to acquire initialization data. When processing the requests, the request control module firstly calculates the summary characteristic values of the requests and uses the summary characteristic values to try to obtain the required data from the cache, the cache data is directly returned for the hit requests, and the HTTP requests are continuously initiated for the miss requests to obtain the data from the server. All the hit caches can be used only once, namely, the cache is immediately invalidated after hit, and a subsequent local request generated due to user interaction automatically initiates an HTTP request because the cache cannot be hit.
Therefore, in the scheme of the embodiment of the invention, whether each AJAX request needs to initiate an HTTP request is determined by the request control module and the initialization cache, and the whole scheme is completely transparent to the page components and the requests; the MRA interface of the server only provides the capability of distributing and integrating the result of the aggregation request, is irrelevant to specific services, does not need to carry out any adjustment according to the change of the front-end page logic, and can be widely applied to different scenes, so the scheme has low invasion to the front end and the back end.
Through the embodiment of the invention, the beneficial effects brought by the embodiment of the invention are as follows:
reducing the system load: the application of the front-end cache aggregates the service results of the original requests, avoids the AJAX request storm in the application of the single-page system, and reduces the burden of the server and the bandwidth.
Low invasiveness: the whole scheme is completely transparent to the original front-end components and back-end services, and most developers do not need to write specific codes related to the scheme except that the page initialization process needs to clearly list request information needing to be aggregated. When the original aggregation request list needs to be adjusted, only list data in the initialization process needs to be adjusted, and the maintenance cost is extremely low.
User experience is good: because the target service of the request is asynchronously called, the time consumed by the data response is determined by the request service with the longest response time from R1 to Rn, and if the request response time lengths of R1, R2, R3 and R4 are respectively 1, 2, 3 and 4 seconds in the prior art, the total time of the target services for returning the data result is only 4 seconds, compared with the total time of the interface X synchronous sequential call response in the prior art, the waiting time required by page initialization is shortened, and the user experience is improved.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The principle and the implementation mode of the invention are explained by applying specific embodiments in the invention, and the description of the embodiments is only used for helping to understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A dynamic data request processing system, comprising: the system comprises a page initialization process module, a request control module and an initialization cache module which are executed on a front-end browser, and a multi-request proxy interface which is executed on a back-end server;
the page initialization process module initializes the page;
the request control module initiates an HTTP request to generate a request list, wherein the HTTP request is formed by integrating a plurality of HTTP data requests; calculating abstract characteristic values of the HTTP data requests, adding the abstract characteristic values into the request list, and sending the abstract characteristic values to the multi-request proxy interface; the initialization of the page component is set to be delayed until the multi-request proxy interface returns data;
the multi-request proxy interface receives the request list, distributes each HTTP data request to an endpoint corresponding to a back end in an asynchronous calling mode for processing, and assembles service data corresponding to each HTTP data request according to the obtained target service corresponding to each HTTP data request;
the multi-request proxy interface acquires service data corresponding to each assembled HTTP data request, and stores the service data corresponding to each assembled HTTP data request into a cache created by the initialization cache module according to the key value of the abstract characteristic value corresponding to each HTTP data request as result data required to respond to each request.
2. The dynamic data request processing system according to claim 1, wherein in the process of performing component initialization operation, when a digest feature value corresponding to an HTTP data request exists in the cache, the page component acquires result data corresponding to the digest feature value corresponding to each HTTP data request, and clears the result data corresponding to the digest feature value corresponding to the HTTP data request in the cache after determining the result data as stale data; and carrying out component initialization operation according to the result data.
3. The dynamic data request processing system of claim 1, wherein the request control module is specifically configured to integrate a plurality of HTTP data requests into one HTTP request, and generate a request list; calculating an abstract characteristic value corresponding to each HTTP data request according to the access parameters of each HTTP data request, and adding the abstract characteristic value into the request list; the access parameters of each HTTP data request comprise a path address of a resource file acquired by the HTTP data request, a request method of the HTTP data request, a request protocol header of the HTTP data request, query parameters of the HTTP data request and submission data of the HTTP data request.
4. The dynamic data request processing system according to claim 2, wherein the request control module sends the HTTP data request to the multi-request proxy interface when the digest feature value corresponding to the HTTP data request does not exist in the cache during the component initialization operation.
5. The dynamic data request processing system of claim 1, wherein the multi-request broker interface is specifically configured to:
receiving the request list, and traversing HTTP data requests in the request list;
performing simulated encapsulation of Request and Response objects on each HTTP data Request in the Request list, and dropping the HTTP data Request into a thread pool to execute service calling;
asynchronously executing a scheduling task according to the thread pool, and distributing each HTTP data request to a target service endpoint corresponding to a back end for processing to obtain a target service corresponding to each HTTP data request;
blocking the task group of the waiting list, and waiting for response until the execution of all the tasks of the list is finished;
and after the execution of the list task group is finished, splicing the service data corresponding to each HTTP data request according to the abstract characteristic value corresponding to each HTTP data request.
6. A dynamic data request processing method, which is applied to the dynamic data request processing system according to any one of claims 1 to 5; the method comprises the following steps:
the page initialization process module initializes the page;
the request control module initiates an HTTP request to generate a request list, wherein the HTTP request is formed by integrating a plurality of HTTP data requests; calculating abstract characteristic values corresponding to the HTTP data requests, adding the abstract characteristic values into the request list, and sending the abstract characteristic values to a multi-request proxy interface; the initialization of the page component is set to be delayed until the multi-request proxy interface returns data;
the multi-request proxy interface receives the request list, distributes each HTTP data request to an endpoint corresponding to a back end in an asynchronous calling mode for processing, and assembles service data corresponding to each HTTP data request according to the obtained target service corresponding to each HTTP data request;
the multi-request proxy interface acquires service data corresponding to each assembled HTTP data request, and stores the service data corresponding to each assembled HTTP data request into a cache created by the initialization cache module according to the key value of the abstract characteristic value corresponding to each HTTP data request as result data required to respond to each request.
7. The dynamic data request processing method of claim 6, further comprising:
in the process of carrying out component initialization operation, when the abstract characteristic values corresponding to the HTTP data requests exist in the cache, the page component acquires result data corresponding to the abstract characteristic values corresponding to the HTTP data requests, determines the result data corresponding to the abstract characteristic values corresponding to the HTTP data requests in the cache as expired data and then clears the result data;
and the page initialization process module carries out component initialization operation according to the result data.
8. The dynamic data request processing method of claim 6, wherein the request control module initiates an HTTP request to generate a request list, comprising:
the request control module integrates a plurality of HTTP data requests into an HTTP request to generate a request list;
the request control module calculates the summary characteristic values corresponding to the plurality of HTTP data requests, adds the summary characteristic values into the request list, and comprises the following steps:
the request control module calculates the abstract characteristic value corresponding to each HTTP data request according to the access parameter of each HTTP data request and adds the abstract characteristic value into the request list; the access parameters of each HTTP data request comprise a path address of a resource file acquired by the HTTP data request, a request method of the HTTP data request, a request protocol header of the HTTP data request, query parameters of the HTTP data request and submission data of the HTTP data request.
9. The dynamic data request processing method of claim 7, further comprising:
in the process of carrying out component initialization operation, when the abstract characteristic value corresponding to the HTTP data request does not exist in the cache, the request control module sends the HTTP data request to the multi-request proxy interface.
10. The dynamic data request processing method according to claim 6, wherein the multi-request proxy interface receives the request list, distributes each HTTP data request to an endpoint corresponding to a back end in an asynchronous call mode for processing, and performs splicing processing on service data corresponding to each HTTP data request according to a target service corresponding to each HTTP data request, including:
the multi-request proxy interface receives the request list and traverses HTTP data requests in the request list;
performing simulated encapsulation of Request and Response objects on each HTTP data Request in the Request list, and dropping the HTTP data Request into a thread pool to execute service calling;
asynchronously executing a scheduling task according to the thread pool, and distributing each HTTP data request to a target service endpoint corresponding to a back end for processing to obtain a target service corresponding to each HTTP data request;
blocking the task group of the waiting list, and waiting for response until the execution of all the tasks of the list is finished;
and after the execution of the list task group is finished, splicing the service data corresponding to each HTTP data request according to the abstract characteristic value corresponding to each HTTP data request.
CN201710725102.3A 2017-08-22 2017-08-22 Dynamic data request processing system and method Expired - Fee Related CN107517254B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710725102.3A CN107517254B (en) 2017-08-22 2017-08-22 Dynamic data request processing system and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710725102.3A CN107517254B (en) 2017-08-22 2017-08-22 Dynamic data request processing system and method

Publications (2)

Publication Number Publication Date
CN107517254A CN107517254A (en) 2017-12-26
CN107517254B true CN107517254B (en) 2020-10-16

Family

ID=60723532

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710725102.3A Expired - Fee Related CN107517254B (en) 2017-08-22 2017-08-22 Dynamic data request processing system and method

Country Status (1)

Country Link
CN (1) CN107517254B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109688202B (en) * 2018-12-04 2021-07-02 北京腾云天下科技有限公司 Interface data processing method and device, computing equipment and storage medium
CN111600920B (en) * 2019-02-21 2024-03-05 北京京东尚科信息技术有限公司 JS-based data request proxy method, device, equipment and readable storage medium
CN110457143B (en) * 2019-07-25 2024-03-19 腾讯科技(深圳)有限公司 Micro-service calling method and device
CN110764930B (en) * 2019-10-21 2022-07-26 中国民航信息网络股份有限公司 Request or response processing method and device based on message mode
CN111064771B (en) * 2019-11-14 2022-07-05 福建天晴数码有限公司 Network request processing method and system
CN114157661B (en) * 2020-09-07 2024-01-16 北京奇艺世纪科技有限公司 Data request method, data processing method, related device, equipment and system
CN115865886B (en) * 2022-11-28 2023-07-18 灵犀科技有限公司 HTTP-based cross-network data interaction method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101126977A (en) * 2007-08-28 2008-02-20 激动集团股份有限公司 ISAPI based WEB static page generation method
CN104123143A (en) * 2013-04-24 2014-10-29 鸿富锦精密工业(深圳)有限公司 User control loading system and method
CN105550338A (en) * 2015-12-23 2016-05-04 北京大学 HTML5 application cache based mobile Web cache optimization method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8326873B2 (en) * 2008-01-09 2012-12-04 Credit Suisse Securities (Usa) Llc Enterprise architecture system and method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101126977A (en) * 2007-08-28 2008-02-20 激动集团股份有限公司 ISAPI based WEB static page generation method
CN104123143A (en) * 2013-04-24 2014-10-29 鸿富锦精密工业(深圳)有限公司 User control loading system and method
CN105550338A (en) * 2015-12-23 2016-05-04 北京大学 HTML5 application cache based mobile Web cache optimization method

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
《AJAX应用的典型设计模式》;周杨;《计算机系统应用》;20110131;第20卷(第1期);第128-132页 *
《Digest 与Web Cache Digest 协议》;谭劲 等;《计算机应用研究》;20021231(第12期);第139-140、146页 *
《面向移动终端的WEB页面重组技术综述》;史晶 等;《计算机应用研究》;20111231;第28卷(第12期);第4405-4408、4413页 *

Also Published As

Publication number Publication date
CN107517254A (en) 2017-12-26

Similar Documents

Publication Publication Date Title
CN107517254B (en) Dynamic data request processing system and method
US8200812B2 (en) Reducing workload on a backend system using client side request throttling
Jiang et al. Autonomous resource provisioning for multi-service web applications
US7747754B2 (en) Transparent migration of stateless sessions across servers
CN107257363B (en) Method and system for responding request of request terminal
US7698411B2 (en) Selectively delivering cached content or processed content to clients based upon a result completed percentage
US20090063618A1 (en) Method and Apparatus for Client-Side Aggregation of Asynchronous Fragmented Requests
CN104391868A (en) Staticizing device and method for dynamic page
CN203086514U (en) Mobile open interactive system
CN109471872A (en) Handle the method and device of high concurrent inquiry request
CN108038009A (en) Front and back end exchange method, device and computer equipment based on Web applications
CN111294377B (en) Dependency network request sending method, terminal device and storage medium
CN106034141A (en) Message processing method, resource obtaining method, server and terminal device
CN114189559A (en) Interface repeat request processing method and system based on Axios
Yuan et al. Towards efficient deployment of cloud applications through dynamic reverse proxy optimization
CA2533773C (en) Transparent session migration across servers
US20140359429A1 (en) Method, computer program, and system for rearranging a server response
CN104580392B (en) It is a kind of to be used to maintain the long method, apparatus and equipment connected
CN115858667A (en) Method, apparatus, device and storage medium for synchronizing data
CN103457980B (en) Terminal unit data acquisition methods
Wang et al. HTML5 web worker transparent offloading method for web applications
Sha et al. Performance modeling of openstack cloud computing platform using performance evaluation process algebra
CN105160006A (en) Page content transmission method
CN115062211A (en) Link tracking method and device based on BFF (bidirectional Forwarding Filter) framework
Kalogeraki et al. Dynamic migration algorithms for distributed object systems

Legal Events

Date Code Title Description
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
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20201016

Termination date: 20210822

CF01 Termination of patent right due to non-payment of annual fee