CN111600920B - JS-based data request proxy method, device, equipment and readable storage medium - Google Patents

JS-based data request proxy method, device, equipment and readable storage medium Download PDF

Info

Publication number
CN111600920B
CN111600920B CN201910130547.6A CN201910130547A CN111600920B CN 111600920 B CN111600920 B CN 111600920B CN 201910130547 A CN201910130547 A CN 201910130547A CN 111600920 B CN111600920 B CN 111600920B
Authority
CN
China
Prior art keywords
request
service
data
response
server
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910130547.6A
Other languages
Chinese (zh)
Other versions
CN111600920A (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 Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information 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 Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201910130547.6A priority Critical patent/CN111600920B/en
Publication of CN111600920A publication Critical patent/CN111600920A/en
Application granted granted Critical
Publication of CN111600920B publication Critical patent/CN111600920B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/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
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2212/00Encapsulation of packets

Landscapes

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

Abstract

The invention discloses a JS-based data request proxy method, a JS-based data request proxy device and a JS-based data request proxy device. The method comprises the following steps: receiving a JS data request sent by a client, wherein the JS data request is packaged according to a preset request rule, and the JS data request comprises: at least one service and at least one method corresponding to each service; analyzing the JS data request according to the request rule, and respectively analyzing each service and each corresponding method thereof; generating at least one service request according to the at least one service, wherein each service request corresponds to each service respectively, and each service request comprises each method corresponding to the corresponding service; and sending the at least one service request to the server in parallel. The method can improve the user experience and the system throughput of the server.

Description

JS-based data request proxy method, device, equipment and readable storage medium
Technical Field
The present invention relates to computer network technology, and in particular, to a JS-based data request proxy method, apparatus, device, and readable storage medium.
Background
Currently, the method of using the separation of synchronous data and asynchronous data loading combines JavaScript (an interpreted script language, hereinafter abbreviated as JS) and various frameworks of JS, and by means of AJAX (Asynchronous JavaScript and XML ) request and dynamic rendering functions, the white screen problem when waiting for web page refresh is improved to a certain extent. However, as the JS is based on a single-threaded design, this has become a core feature of this language and will not change in the future. To take advantage of the computing power of the multi-core CPU, HTML5 proposes a Web workbench (Worker thread) standard that allows JS scripts to create multiple threads, but the child threads are fully controlled by the main thread and must not operate the DOM (Document Object Model ). Therefore, this new standard does not change the nature of the JS single thread, whether the JS asynchronous request cannot be concurrent or pipelined. With more and more complex services and more frequent front-end interaction, the single-threaded pipelined requests of JS are always a bottleneck for the enhancement of the user experience of asynchronous dynamic data acquisition and presentation.
The above information disclosed in the background section is only for enhancement of understanding of the background of the invention and therefore it may contain information that does not form the prior art that is already known to a person of ordinary skill in the art.
Disclosure of Invention
In view of this, the present invention provides a JS-based data request proxy method, apparatus, device and readable storage medium, which can improve user experience and system throughput of a server.
Other features and advantages of the invention will be apparent from the following detailed description, or may be learned by the practice of the invention.
According to an aspect of the present invention, there is provided a JS-based data request proxy method, including: receiving a JS data request sent by a client, wherein the JS data request is packaged according to a preset request rule, and the JS data request comprises: at least one service and at least one method corresponding to each service; analyzing the JS data request according to the request rule, and respectively analyzing each service and each corresponding method thereof; generating at least one service request according to the at least one service, wherein each service request corresponds to each service respectively, and each service request comprises each method corresponding to the corresponding service; and sending the at least one service request to the server in parallel.
According to an embodiment of the present invention, the method further includes: receiving a data request response returned by the server; analyzing the data request response according to the JS data request, and sequentially analyzing response data corresponding to each method of each service; according to a preset response rule, packaging each parsed response data into JS data response; and transmitting the JS data response to the client.
According to an embodiment of the present invention, the parallel sending of the at least one service request to the server comprises: executing the concurrent request by using ngx.location.capture.multi (urls) in openness, and sending the at least one service request to the server in parallel; wherein urls sequentially correspond to the at least one service request in a sequence, and the sequence is an arrangement sequence of the at least one service corresponding to the at least one service request in the JS data request.
According to another aspect of the present invention, there is provided a JS-based data request proxy apparatus including: the request receiving module is configured to receive a JS data request sent by a client, where the JS data request is encapsulated according to a predetermined request rule, and includes: at least one service and at least one method corresponding to each service; the request analysis module is used for analyzing the JS data request according to the request rule and analyzing each service and each corresponding method thereof respectively; the request generation module is used for generating at least one service request according to the at least one service, wherein each service request corresponds to each service respectively, and each service request comprises each method corresponding to the corresponding service; and a request sending module, configured to send the at least one service request to the server in parallel.
According to still another aspect of the present invention, there is provided a JS-based data request processing system including: client, proxy device and server; wherein: the client is configured to send a JS data request, where the JS data request is encapsulated according to a predetermined request rule, and includes: at least one service and at least one method corresponding to each service; the proxy device is used for receiving the JS data request sent by the client; analyzing the JS data request according to the request rule, and respectively analyzing each service and each corresponding method thereof; generating at least one service request according to the at least one service, wherein each service request corresponds to each service respectively, and each service request comprises each method corresponding to the corresponding service; and sending the at least one service request to the server in parallel; the server is used for receiving the at least one service request sent in parallel; processing the at least one service request in parallel to obtain response data corresponding to each method of each service; and generating a data request response according to each response data.
According to an embodiment of the present invention, the server is further configured to send the data request response; the proxy device is also used for receiving the data request response sent by the server; analyzing the data request response according to the JS data request, and sequentially analyzing each response data; according to a preset response rule, packaging each parsed response data into JS data response; transmitting the JS data response; the client is further configured to receive the JS data response sent by the proxy device; and analyzing the JS data response according to the response rule, and sequentially acquiring each response data.
According to still another aspect of the present invention, there is provided a JS-based data request processing system including: a client and a server; the client is configured to send a JS data request, where the JS data request is encapsulated according to a predetermined request rule, and includes: at least one method corresponding to a service; the server is used for receiving the JS data request; analyzing the JS data request according to the request rule, and respectively analyzing each method of the service; understanding each separated method at the parallel position to obtain response data corresponding to each method respectively; and packaging the response data into JS data response according to a preset response rule.
The server is further configured to send the JS data response, in accordance with an embodiment of the present invention; the client is also used for receiving the JS data response sent by the server; and analyzing the JS data response according to the response rule, and sequentially acquiring each response data.
According to still another aspect of the present invention, there is provided a proxy server including: the system comprises a memory, a processor and executable instructions stored in the memory and executable in the processor, wherein the processor implements any one of the methods when executing the executable instructions.
According to yet another aspect of the present invention, there is provided a computer readable storage medium having stored thereon computer executable instructions which when executed by a processor implement a method as any one of the above.
According to the JS-based data request proxy method provided by the invention, the front-end JS requests are logically combined, logically split and assembled in the proxy device, and a plurality of JS requests are sent to the background service server in parallel for logically processing response and processing. Therefore, the number of front-end requests and the request response time are reduced, user experience can be improved on one hand, and system throughput of a server can be improved on the other hand.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention as claimed.
Drawings
The above and other objects, features and advantages of the present invention will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings.
FIG. 1 is a schematic diagram of a JS-based data request processing system, according to an illustrative embodiment.
FIG. 2 is a flow chart illustrating interactions between the client, proxy device, and server shown in FIG. 1, according to one example.
Fig. 3 is a flowchart illustrating a JS-based data request proxy method, in accordance with an exemplary embodiment.
Fig. 4 is a block diagram illustrating a JS-based data request proxy device, in accordance with an exemplary embodiment.
FIG. 5 is a schematic diagram of another JS-based data request processing system, according to an illustrative embodiment.
Fig. 6 is a flow chart illustrating interactions between the client and the server shown in fig. 5, according to one example.
Fig. 7 is a schematic diagram of a computer system according to an exemplary embodiment.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments may be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art. The drawings are merely schematic illustrations of the present invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus a repetitive description thereof will be omitted.
The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the invention. One skilled in the relevant art will recognize, however, that the invention may be practiced without one or more of the specific details, or with other methods, components, devices, steps, etc. In other instances, well-known structures, methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the invention.
In the present invention, unless specifically stated and limited otherwise, the term "coupled" and the like are to be construed broadly, and may be, for example, directly coupled or indirectly coupled through an intervening medium. The specific meaning of the above terms in the present invention can be understood by those of ordinary skill in the art according to the specific circumstances.
Furthermore, in the description of the present invention, the meaning of "plurality" means at least two, for example, two, three, etc., unless specifically defined otherwise.
FIG. 1 is a schematic diagram of a JS-based data request processing system, according to an illustrative embodiment.
As shown in fig. 1, the JS-based data request processing system 1 includes: client 11, proxy device 12, and server 13. The client 11 is communicatively connected to the proxy device 12, and the proxy device 12 is communicatively connected to the server 13. It should be noted that, the client 11 and the proxy device 12 may be directly connected, or may be indirectly connected through other intermediate devices (such as CDN, gateway, etc.).
FIG. 2 is a flow chart illustrating interactions between the client, proxy device, and server shown in FIG. 1, according to one example.
The client 11 is, for example, a browser. Referring to fig. 1 and 2 in combination, the client 11 is configured to send a JS data request to the proxy device 12, where the JS data request is encapsulated according to a predetermined request rule, and may include at least one service and at least one method corresponding to each service. The service corresponds to the URL in the JS request, and the Method corresponds to the Method in the JS request.
The JS data request may be, for example, a single-service multi-method request, or may be a multi-service single-method request, or may be a multi-service multi-method request. Several examples of JS data requests encapsulated according to a predetermined request rule are given below: .
Single service multi-method request:
jd.com/virtual_v3method=method1,method2,method3&method1_arg_m1=x&method2_arg_m2=y
multi-service unilateral method request:
jd.com/virtual_v3url1=u1&url2=u2&url1_arg_1=x&url2_arg_2=y
multi-service multi-method request:
jd.com/virtual_v3url1=u1&url2=u2&u1_method1=m1&u1_method2=m2&u2_method1=z&url1_method1_arg_1=x&url1_method1_arg_2=y
it should be noted that, in practical application, the request rule may be defined according to the actual service logic requirement, which is not limited by the present invention.
In addition, it should be noted that the dependency sub-request and the main request cannot be sent in parallel, and the request may be initiated again after JS asynchronous processing or proxy layer logic determination.
The proxy device 12 is, for example, a proxy server, in which proxy server software supporting concurrent request response logic processing is installed as a proxy service layer, and supports a corresponding script framework, and parses the JS data request sent by the client 11 and organizes the concurrent request data.
For example, openredundancy may be used as a proxy service layer, and the Lua script is used for logic processing accordingly.
openResity is a high-performance Web platform organically integrating Nginx and Lua, and a large number of fine Lua libraries, third-party modules and most of dependence items are integrated in the high-performance Web platform, so that the high-performance Web platform is used for conveniently building dynamic Web applications, web services and dynamic gateways which can process ultrahigh concurrency and have extremely high expansibility. At present, openResty is often used as a high-performance proxy server or a web server, and the functions of Nginx are expanded, and complicated logic and admission functions are controlled through scripts by utilizing a plug-in high-performance Lua script.
In addition, native Nginx can be used as a proxy service layer, and shell scripts can be used as logic processing scripts; apache may also be used as a proxy service layer, php script or the like as its logical processing script. The invention is not limited thereto.
Referring to fig. 2, the proxy device 12 is configured to receive the JS data request sent by the client 11; and analyzing the JS data request according to the predefined request rule. For example, the JS data request may be parsed by a regular expression, string segmentation matching, or the like, so that each service (URL) and each Method (Method) corresponding to each service included in the JS data request are parsed and identified. And combining the requests of the methods of the same service according to at least one service to generate at least one service request, wherein each service request corresponds to each service in the JS data request, and each service request comprises each method of the corresponding service.
Thereafter, the at least one service request described above is transmitted in parallel to the server 13. Taking the use of openness as a proxy service layer as an example, the concurrent request may be executed using the concurrent request statement ngx.location.capture_multi (urls) provided in openness, and at least one service request may be sent in parallel to the server 13. Specifically, the url in the sentence may be 1 or a plurality of urls, which respectively correspond to at least one service request in sequence. When there are multiple service requests, urls (i.e., urls) in the sentence sequentially correspond to the multiple service requests in a sequence, where the sequence is an arrangement sequence of multiple services corresponding to the multiple service requests in the JS data request.
It should be noted that, when the servers 13 are deployed as a distributed server cluster, different services may be deployed on different servers, and the proxy device 12 needs to further distinguish between the different services and send each service to its corresponding server.
The server 13 is, for example, a background service server, which may be a single server or a server cluster. After receiving at least one service request sent in parallel by the proxy device 12, the server 13 may process the at least one service request in parallel by using its multi-core CPU, for example, to obtain response data corresponding to each method of each service. And generating a data request response according to each response data. Taking the openness as the proxy service layer as an example, the arrangement data of the response data in the generated data request response is consistent with the order of urls, so that the proxy device 12 can correspondingly analyze the response data corresponding to each service after receiving the data request response.
Further, the server 13 returns the generated data request response to the proxy device 12. After receiving the data request response sent by the server 13, the proxy device 12 analyzes the data request response according to the JS data request, and sequentially analyzes each response data. Specifically, the proxy device 12 sequentially analyzes each response data corresponding to each method of each service based on the order of each service in the JS data request and the order of each method in each service. After analyzing each response data, the proxy device 12 encapsulates each analyzed response data into a JS data response according to a predetermined response rule, and returns the JS data response to the client 11. The JS data response corresponds to a JS data request. After receiving the JS data response sent by the proxy device 12, the client 11 analyzes the JS data response according to the response rule, and sequentially obtains each response data. Further, each response data may also be filled into the data logic for processing.
Fig. 3 is a flowchart illustrating a JS-based data request proxy method, in accordance with an exemplary embodiment. The JS-based data request proxy method 10 shown in fig. 3 can be applied to the proxy device 12 shown in fig. 1 described above, for example.
Referring to fig. 3, the JS-based data request proxy method 10 includes:
in step S102, a JS data request sent by the client is received.
The JS data request is encapsulated according to a predetermined request rule, including: at least one service and at least one method corresponding to each service. The service corresponds to the URL in the JS request, and the Method corresponds to the Method in the JS request.
The JS data request may be, for example, a single-service multi-method request, or may be a multi-service single-method request, or may be a multi-service multi-method request.
Various examples of the JS data request are as previously described and are not repeated here.
In step S104, the JS data request is parsed according to the request rule, and each service and each method corresponding thereto are parsed.
For example, the proxy device 12 can analyze the JS data request by means of a regular expression, string segmentation matching, or the like, and analyze and identify each service (URL) and each Method (Method) corresponding to each service included in the JS data request.
In step S106, at least one service request is generated from at least one service.
For example, the proxy device 12 merges requests of methods of the same service according to at least one service, generates at least one service request, each service request corresponds to each service in the JS data request, and each service request includes methods of its corresponding service.
In step S108, at least one service request is sent in parallel to the server.
In some embodiments, for example, taking the use of openness as a proxy service layer as an example, the concurrent request may be performed using a concurrent request statement ngx.location.capture_multi (urls) provided in openness, and at least one service request is sent in parallel to the server 13. Specifically, the url in the sentence may be 1 or a plurality of urls, which respectively correspond to at least one service request in sequence. When there are multiple service requests, urls (i.e., urls) in the sentence sequentially correspond to the multiple service requests in a sequence, where the sequence is an arrangement sequence of multiple services corresponding to the multiple service requests in the JS data request.
In some embodiments, the JS-based data request proxy method 10 can further include:
in step S110, a data request response returned by the server is received.
In step S112, the response to the data request is parsed according to the JS data request, and response data corresponding to each method of each service is parsed in turn.
For example, the proxy device 12 sequentially analyzes the response data corresponding to each method of each service based on the order of each service in the JS data request and the order of each method in each service.
In step S114, each of the parsed response data is packaged as a JS data response according to a predetermined response rule.
In step S116, the JS data response is sent to the client.
According to the JS-based data request proxy method provided by the embodiment of the invention, the front-end JS requests are logically combined, logically split and assembled in the proxy device, and a plurality of JS requests are sent to the background service server in parallel for logically processing response and processing. Therefore, the number of front-end requests and the request response time are reduced, user experience can be improved on one hand, and system throughput of a server can be improved on the other hand.
It should be clearly understood that the present invention describes how to make and use specific examples, but the principles of the present invention are not limited to any details of these examples. Rather, these principles can be applied to many other embodiments based on the teachings of the present disclosure.
Those skilled in the art will appreciate that all or part of the steps implementing the above embodiments are implemented as a computer program executed by a CPU. When executed by a CPU, performs the functions defined by the above-described method provided by the present invention. The program may be stored in a computer readable storage medium, which may be a read-only memory, a magnetic disk or an optical disk, etc.
Furthermore, it should be noted that the above-described figures are merely illustrative of the processes involved in the method according to the exemplary embodiment of the present invention, and are not intended to be limiting. It will be readily appreciated that the processes shown in the above figures do not indicate or limit the temporal order of these processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, for example, among a plurality of modules.
Fig. 4 is a block diagram illustrating a JS-based data request proxy device, in accordance with an exemplary embodiment. The JS-based data request proxy device 20 of FIG. 4 can be used to perform the method embodiment of FIG. 3, as described above for details not disclosed in this device embodiment.
Referring to fig. 4, the JS-based data request proxy device 20 includes: a request receiving module 202, a request parsing module 204, a request generating module 206, and a request transmitting module 208.
The request receiving module 202 is configured to receive a JS data request sent by a client, where the JS data request is encapsulated according to a predetermined request rule, and includes: at least one service and at least one method corresponding to each service.
The request parsing module 204 is configured to parse the JS data request according to the request rule, and parse each service and each method corresponding to each service.
The request generation module 206 is configured to generate at least one service request according to at least one service, where each service request corresponds to each service, and each service request includes each method corresponding to its corresponding service.
The request sending module 208 is configured to send at least one service request to the server in parallel.
In some embodiments, the JS-based data request proxy device 20 can further include: the system comprises a response receiving module, a response analyzing module, a response packaging module and a response sending module. The response receiving module is used for receiving the data request response returned by the server. And the response analysis module is used for analyzing the response of the data request according to the JS data request, and sequentially analyzing response data corresponding to each method of each service. And the response packaging module is used for packaging each analyzed response data into JS data response according to a preset response rule. The response sending module is used for sending the JS data response to the client.
In some embodiments, the request-sending module 208 includes: a request sending unit, configured to execute a concurrent request by using an ngx.location.capture.multi (urls) in openness, and send at least one service request to a server in parallel; wherein urls sequentially correspond to the at least one service request in order of arrangement order of at least one service corresponding to the at least one service request in the JS data request.
It should be noted that the block diagrams shown in the above figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software or in one or more hardware modules or integrated circuits or in different networks and/or processor devices and/or microcontroller devices.
FIG. 5 is a schematic diagram of another JS-based data request processing system, according to an illustrative embodiment.
As shown in fig. 5, the JS-based data request processing system 2 includes: a client 21 and a server 22.
Fig. 6 is a flow chart illustrating interactions between the client and the server shown in fig. 5, according to one example.
The client 21 is, for example, a browser. Referring to fig. 5 and 6 in combination, the client 21 is configured to send a JS data request to the server 22, where the JS data request is encapsulated according to a predetermined request rule, and may include: at least one method corresponding to a service. The service corresponds to the URL in the JS request, and the Method corresponds to the Method in the JS request.
The JS data request may be, for example, a single service multi-party request. An example of a JS data request encapsulated according to a predetermined request rule is given below:
jd.com/virtual_v3method=method1,method2,method3&method1_arg_m1=x&method2_arg_m2=y
it should be noted that, in practical application, the request rule may be defined according to the actual service logic requirement, which is not limited by the present invention.
The server 22 is, for example, a background service server, which may be a single server or a server cluster. After receiving the JS data request sent by the client 21, the server 22 analyzes the JS data request according to the above request rule, and analyzes each method of the service in the request. And then, understanding the separated methods in parallel to obtain response data corresponding to the methods. When the service (URL) of the JS data request corresponds to a plurality of methods, for example, the multi-core CPU may process each of the methods in parallel to obtain response data corresponding to each of the methods. Each response data is packaged into a JS data response according to a predetermined response rule, and returned to the client 21.
The server 22 may rely on concurrency capabilities provided by a particular system language, such as the futures concurrency multi-threading mode of the JAVA language, for each method in the JS data request sent by the client 21. Thereby achieving the effect of parallel transmission and parallel processing of JS requests.
In the case of a plurality of Services (URLs), the JS request needs to be serially transmitted to the server 22.
The client 21 is further configured to receive the JS data response sent by the server 22, and parse the JS data response according to the above response rule, so as to sequentially obtain each response data.
Fig. 7 is a schematic diagram of a computer system according to an exemplary embodiment. It should be noted that the computer system shown in fig. 7 is only an example, and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.
As shown in fig. 7, the computer system 800 includes a Central Processing Unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the system 800 are also stored. The CPU 801, ROM 802, and RAM 803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to the bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, mouse, etc.; an output portion 807 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and a speaker; a storage section 808 including a hard disk or the like; and a communication section 809 including a network interface card such as a LAN card, a modem, or the like. The communication section 809 performs communication processing via a network such as the internet. The drive 810 is also connected to the I/O interface 805 as needed. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as needed so that a computer program read out therefrom is mounted into the storage section 808 as needed.
In particular, according to embodiments of the present invention, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network via the communication section 809, and/or installed from the removable media 811. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 801.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present invention may be implemented in software or in hardware. The described units may also be provided in a processor, for example, described as: a processor includes a transmitting unit, an acquiring unit, a determining unit, and a first processing unit. The names of these units do not constitute a limitation on the unit itself in some cases, and for example, the transmitting unit may also be described as "a unit that transmits a picture acquisition request to a connected server".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to include:
receiving a JS data request sent by a client, wherein the JS data request is packaged according to a preset request rule, and the JS data request comprises: at least one service and at least one method corresponding to each service;
analyzing the JS data request according to the request rule, and respectively analyzing each service and each corresponding method thereof;
generating at least one service request according to the at least one service, wherein each service request corresponds to each service respectively, and each service request comprises each method corresponding to the corresponding service; and
and sending the at least one service request to the server in parallel.
The exemplary embodiments of the present invention have been particularly shown and described above. It is to be understood that this invention is not limited to the precise arrangements, instrumentalities and instrumentalities described herein; on the contrary, the invention is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.

Claims (9)

1. A JS-based data request proxy method, comprising:
receiving a JS data request sent by a client, wherein the JS data request comprises: the client encapsulates the single-service multi-method request, the multi-service single-method request and the multi-service multi-method request according to different preset request rules;
analyzing the JS data request according to the request rule, and respectively analyzing each service and each corresponding method thereof;
combining requests of methods of the same service according to at least one service to generate at least one service request, wherein each service request corresponds to each service respectively, and each service request comprises each method corresponding to the corresponding service; and
the parallel sending of the at least one service request to the server comprises:
executing the concurrent request by using ngx.location.capture.multi (urls) in openness, and sending the at least one service request to the server in parallel;
wherein urls sequentially correspond to the at least one service request in a sequence, and the sequence is an arrangement sequence of the at least one service corresponding to the at least one service request in the JS data request.
2. The method as recited in claim 1, further comprising:
receiving a data request response returned by the server;
analyzing the data request response according to the JS data request, and sequentially analyzing response data corresponding to each method of each service;
according to a preset response rule, packaging each parsed response data into JS data response; and
and sending the JS data response to the client.
3. A JS-based data request proxy device, comprising:
the request receiving module is configured to receive a JS data request sent by a client, where the JS data request includes: the client encapsulates the single-service multi-method request, the multi-service single-method request and the multi-service multi-method request according to different preset request rules;
the request analysis module is used for analyzing the JS data request according to the request rule and analyzing each service and each corresponding method thereof respectively;
the request generation module is used for combining requests of methods of the same service according to at least one service to generate at least one service request, wherein each service request corresponds to each service respectively, and each service request comprises each method corresponding to the corresponding service; and
the request sending module is configured to send the at least one service request to the server in parallel, where the sending module includes:
executing the concurrent request by using ngx.location.capture.multi (urls) in openness, and sending the at least one service request to the server in parallel;
wherein urls sequentially correspond to the at least one service request in a sequence, and the sequence is an arrangement sequence of the at least one service corresponding to the at least one service request in the JS data request.
4. A JS-based data request processing system, comprising: client, proxy device and server; wherein:
the client is configured to send a JS data request, where the JS data request is encapsulated according to a predetermined request rule, and includes: single service multi-method request, multi-service single-method request, and multi-service multi-method request; packaging single-service multi-method requests, multi-service single-method requests and multi-service multi-method requests according to different preset request rules;
the proxy device is used for receiving the JS data request sent by the client; analyzing the JS data request according to the request rule, and respectively analyzing each service and each corresponding method thereof; combining requests of methods of the same service according to at least one service to generate at least one service request, wherein each service request corresponds to each service respectively, and each service request comprises each method corresponding to the corresponding service; and sending the at least one service request to the server in parallel;
the server is used for receiving the at least one service request sent in parallel; processing the at least one service request in parallel to obtain response data corresponding to each method of each service; and generating a data request response according to each response data.
5. The system of claim 4, wherein the server is further configured to send the data request response;
the proxy device is also used for receiving the data request response sent by the server; analyzing the data request response according to the JS data request, and sequentially analyzing each response data; according to a preset response rule, packaging each parsed response data into JS data response; transmitting the JS data response;
the client is further configured to receive the JS data response sent by the proxy device; and analyzing the JS data response according to the response rule, and sequentially acquiring each response data.
6. A JS-based data request processing system, comprising: a client and a server; wherein,
the client is configured to send a JS data request, where the JS data request is encapsulated according to a predetermined request rule, and includes: single service multi-method request, multi-service single-method request, and multi-service multi-method request; packaging single-service multi-method requests, multi-service single-method requests and multi-service multi-method requests according to different preset request rules;
the server is used for receiving the JS data request; analyzing the JS data request according to the request rule, and respectively analyzing each method of the service; understanding each separated method at the parallel position to obtain response data corresponding to each method respectively; and packaging the response data into JS data response according to a preset response rule.
7. The system of claim 6, wherein the server is further configured to send the JS data response; the client is also used for receiving the JS data response sent by the server; and analyzing the JS data response according to the response rule, and sequentially acquiring each response data.
8. A proxy server, comprising: memory, a processor and executable instructions stored in the memory and executable in the processor, wherein the processor implements the method of any of claims 1-2 when executing the executable instructions.
9. A computer readable storage medium having stored thereon computer executable instructions which when executed by a processor implement the method of any of claims 1-2.
CN201910130547.6A 2019-02-21 2019-02-21 JS-based data request proxy method, device, equipment and readable storage medium Active CN111600920B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910130547.6A CN111600920B (en) 2019-02-21 2019-02-21 JS-based data request proxy method, device, equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910130547.6A CN111600920B (en) 2019-02-21 2019-02-21 JS-based data request proxy method, device, equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN111600920A CN111600920A (en) 2020-08-28
CN111600920B true CN111600920B (en) 2024-03-05

Family

ID=72190543

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910130547.6A Active CN111600920B (en) 2019-02-21 2019-02-21 JS-based data request proxy method, device, equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN111600920B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114157661B (en) * 2020-09-07 2024-01-16 北京奇艺世纪科技有限公司 Data request method, data processing method, related device, equipment and system
CN112235363B (en) * 2020-09-28 2022-02-01 华云数据控股集团有限公司 Data processing method, device, electronic equipment, storage medium and system
CN113259408B (en) * 2021-03-30 2023-06-20 中海油信息科技有限公司 Data transmission method and system

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1271883A2 (en) * 2001-06-29 2003-01-02 Microsoft Corporation Remote event handling in a packet network
CN1959679A (en) * 2006-09-25 2007-05-09 北京爱笛星科技有限公司 Method for picking-up, and aggregating micro content of web page, and automatic updating system
WO2008061042A2 (en) * 2006-11-10 2008-05-22 Pelago, Inc. Managing aggregation and sending of communications
CN101557572A (en) * 2008-04-11 2009-10-14 北京闻言科技有限公司 Method for sending multiple requests by using one alternation
CN102387206A (en) * 2011-10-20 2012-03-21 镇江睿泰信息科技有限公司 Synthesis method and system of concurrent request of Web service
CN102457565A (en) * 2010-11-03 2012-05-16 中国电信股份有限公司 Method for accessing network by mobile terminal, and agency server
CN105190621A (en) * 2013-05-09 2015-12-23 诺基亚技术有限公司 Method and apparatus for asynchronous distribution of content
CN106293794A (en) * 2015-06-05 2017-01-04 阿里巴巴集团控股有限公司 Load the methods, devices and systems of the page
CN106657193A (en) * 2015-11-02 2017-05-10 腾讯科技(深圳)有限公司 Request processing method, request processing device, terminal device and server
CN107517254A (en) * 2017-08-22 2017-12-26 北京梅泰诺通信技术股份有限公司 A kind of dynamic data demand processing system and method
CN108243233A (en) * 2016-12-26 2018-07-03 深圳远征技术有限公司 A kind of method and client for improving Web application performances
CN109218339A (en) * 2017-06-29 2019-01-15 北京京东尚科信息技术有限公司 request processing method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100250651A1 (en) * 2009-03-31 2010-09-30 Inventec Corporation Data access method for making asynchronous request to block device

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1271883A2 (en) * 2001-06-29 2003-01-02 Microsoft Corporation Remote event handling in a packet network
CN1959679A (en) * 2006-09-25 2007-05-09 北京爱笛星科技有限公司 Method for picking-up, and aggregating micro content of web page, and automatic updating system
WO2008061042A2 (en) * 2006-11-10 2008-05-22 Pelago, Inc. Managing aggregation and sending of communications
CN101557572A (en) * 2008-04-11 2009-10-14 北京闻言科技有限公司 Method for sending multiple requests by using one alternation
CN102457565A (en) * 2010-11-03 2012-05-16 中国电信股份有限公司 Method for accessing network by mobile terminal, and agency server
CN102387206A (en) * 2011-10-20 2012-03-21 镇江睿泰信息科技有限公司 Synthesis method and system of concurrent request of Web service
CN105190621A (en) * 2013-05-09 2015-12-23 诺基亚技术有限公司 Method and apparatus for asynchronous distribution of content
CN106293794A (en) * 2015-06-05 2017-01-04 阿里巴巴集团控股有限公司 Load the methods, devices and systems of the page
CN106657193A (en) * 2015-11-02 2017-05-10 腾讯科技(深圳)有限公司 Request processing method, request processing device, terminal device and server
CN108243233A (en) * 2016-12-26 2018-07-03 深圳远征技术有限公司 A kind of method and client for improving Web application performances
CN109218339A (en) * 2017-06-29 2019-01-15 北京京东尚科信息技术有限公司 request processing method and device
CN107517254A (en) * 2017-08-22 2017-12-26 北京梅泰诺通信技术股份有限公司 A kind of dynamic data demand processing system and method

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
"Ajax深度信息获取及聚类关键技术的研究";尤丹妹;《中国优秀硕士学位论文全文数据库 信息科技辑》;全文 *
"Improving the performance of loading web pages in the environment with high latency connections";Lukas Cegan;《IEEE》;全文 *
"面向请求预处理的实时按需数据广播调度方法";胡文斌;《万方》;全文 *
潘夕琪 ; 何新英 ; .集成Servlet和Ajax构建敏捷的Java Web应用.广州航海高等专科学校学报.2006,(第01期),全文. *
集成Servlet和Ajax构建敏捷的Java Web应用;潘夕琪;何新英;;广州航海高等专科学校学报(第01期);全文 *

Also Published As

Publication number Publication date
CN111600920A (en) 2020-08-28

Similar Documents

Publication Publication Date Title
US11144711B2 (en) Webpage rendering method, device, electronic apparatus and storage medium
US10831858B2 (en) Mobile enablement of existing web sites
CN108984714B (en) Page rendering method and device, electronic equipment and computer readable medium
US10776567B2 (en) Method for compiling page data, method, device and storage medium for page rendering
CN110457143B (en) Micro-service calling method and device
CN110457144B (en) Method, device, medium and equipment for realizing front-end application
CN111600920B (en) JS-based data request proxy method, device, equipment and readable storage medium
CN109815107B (en) Method and device for automatic testing
CN110489323B (en) Visual RPC API debugging method, device, medium and equipment
CN112100550A (en) Page construction method and device
CN113382083B (en) Webpage screenshot method and device
CN109062560B (en) Method and apparatus for generating information
CN110780874B (en) Method and device for generating information
CN110990746A (en) Page loading method, device, system, storage medium and electronic equipment
CN107729001B (en) Expression processing method and device
CN113076294A (en) Information sharing method and device
CN112395027B (en) Widget interface generation method and device, storage medium and electronic equipment
CN108694120B (en) Method and device for testing service component
CN113761428A (en) Page rendering method, device and system, storage medium and electronic equipment
JP5039946B2 (en) Technology for relaying communication between client devices and server devices
US20200110584A1 (en) Automated code generation for functional testing of software applications
CN113761871A (en) Rich text rendering method and device, electronic equipment and storage medium
CN116860286A (en) Page dynamic update method, device, electronic equipment and computer readable medium
CN110489326B (en) IDS-based HTTPAPI debugging method device, medium and equipment
CN110830427A (en) Method and device for message encoding and message decoding in netty environment

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