CN110968739A - Resource request method and device - Google Patents

Resource request method and device Download PDF

Info

Publication number
CN110968739A
CN110968739A CN201811138425.3A CN201811138425A CN110968739A CN 110968739 A CN110968739 A CN 110968739A CN 201811138425 A CN201811138425 A CN 201811138425A CN 110968739 A CN110968739 A CN 110968739A
Authority
CN
China
Prior art keywords
request
requests
sub
response result
description information
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.)
Pending
Application number
CN201811138425.3A
Other languages
Chinese (zh)
Inventor
田孝启
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba China Co Ltd
Original Assignee
Chuanxian Network Technology Shanghai 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 Chuanxian Network Technology Shanghai Co Ltd filed Critical Chuanxian Network Technology Shanghai Co Ltd
Priority to CN201811138425.3A priority Critical patent/CN110968739A/en
Publication of CN110968739A publication Critical patent/CN110968739A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The disclosure relates to a resource request method and device. The method comprises the following steps: acquiring a first request from a client; determining a dependency relationship between the first request and other requests according to the request description information of the first request; constructing a request relation tree according to the dependency relation between the first request and other requests; processing the request in the request relation tree from a leaf node of the request relation tree until a response result corresponding to the first request is obtained, wherein the leaf node represents a node without a child node; and returning a response result corresponding to the first request to the client. The technical scheme for defining the request description information by the client is provided, so that the definer of the request description information is consistent with the request user, the communication cost between the client and the server is reduced, the resource request time is shortened, the front end and the back end are separated, and development and maintenance are facilitated.

Description

Resource request method and device
Technical Field
The present disclosure relates to the field of information technologies, and in particular, to a resource request method and apparatus.
Background
The request time of resources such as web pages is an important index for websites. For example, the first screen time greatly affects the user experience and is the first threshold for determining user retention. The first screen time refers to the time from the initiation of the request to the completion of the rendering of the browser first screen content. How to shorten the resource request time is a problem to be solved urgently.
Disclosure of Invention
In view of this, the present disclosure provides a resource request method and apparatus.
According to a first aspect of the present disclosure, a resource request method is provided, where the method is applied in a server side, and the method includes:
acquiring a first request from a client;
determining a dependency relationship between the first request and other requests according to the request description information of the first request;
constructing a request relation tree according to the dependency relation between the first request and other requests, wherein if the first request is dependent on a second request, the second request is a child node of the first request in the request relation tree;
processing the request in the request relation tree from a leaf node of the request relation tree until a response result corresponding to the first request is obtained, wherein the leaf node represents a node without a child node;
and returning a response result corresponding to the first request to the client.
In one possible implementation, the request description information of the first request includes a unique identifier of the first request and a uniform resource locator of a resource requested by the first request.
In a possible implementation manner, the request description information of the first request further includes one or more of request parameters of the first request, information of sub-requests of the first request, and response result information corresponding to the first request, where the sub-requests of the first request represent requests on which the first request depends.
In one possible implementation, the method further includes:
obtaining the number of unprocessed sub-requests of the request in the request relation tree, wherein the number of unprocessed sub-requests of the request represents the number of unprocessed sub-requests of the request.
In a possible implementation manner, starting from a leaf node of the request relationship tree, processing a request in the request relationship tree until obtaining a response result corresponding to the first request includes:
processing the requests with the unprocessed sub-requests quantity of 0 in the request relation tree, and acquiring response results corresponding to the requests in the request relation tree;
updating the number of unprocessed sub-requests of the requests in the request relation tree according to the response result corresponding to the requests in the request relation tree;
and if the number of the unprocessed sub-requests of the first request is 0, processing the first request and acquiring a response result corresponding to the first request.
In one possible implementation, the method further includes:
different request relation trees are processed in parallel.
According to a second aspect of the present disclosure, there is provided a resource request method, which is applied in a client, and includes:
generating a first request according to request description information, wherein the request description information can be used for determining the dependency relationship between the first request and other requests;
sending the first request to a server;
and receiving a response result corresponding to the first request returned by the server.
In one possible implementation, the request description information of the first request includes a unique identifier of the first request and a uniform resource locator of a resource requested by the first request.
In a possible implementation manner, the request description information of the first request further includes one or more of request parameters of the first request, information of sub-requests of the first request, and response result information corresponding to the first request, where the sub-requests of the first request represent requests on which the first request depends.
According to a third aspect of the present disclosure, there is provided a resource request apparatus, the apparatus comprising:
the first acquisition module is used for acquiring a first request from a client;
the determining module is used for determining the dependency relationship between the first request and other requests according to the request description information of the first request;
a building module, configured to build a request relationship tree according to a dependency relationship between the first request and another request, where if the first request is dependent on a second request, the second request is a child node of the first request in the request relationship tree;
the processing module is used for processing the request in the request relation tree from a leaf node of the request relation tree until a response result corresponding to the first request is obtained, wherein the leaf node represents a node without a child node;
and the return module is used for returning a response result corresponding to the first request to the client.
In one possible implementation, the request description information of the first request includes a unique identifier of the first request and a uniform resource locator of a resource requested by the first request.
In a possible implementation manner, the request description information of the first request further includes one or more of request parameters of the first request, information of sub-requests of the first request, and response result information corresponding to the first request, where the sub-requests of the first request represent requests on which the first request depends.
In one possible implementation, the apparatus further includes:
a second obtaining module, configured to obtain an unprocessed sub-request number of the request in the request relationship tree, where the unprocessed sub-request number of the request represents an unprocessed number in the sub-request of the request.
In one possible implementation, the processing module includes:
the first processing submodule is used for processing the requests with the unprocessed sub-requests quantity of 0 in the request relation tree and acquiring the response result corresponding to the requests in the request relation tree;
the updating submodule is used for updating the number of unprocessed sub-requests of the requests in the request relation tree according to the response result corresponding to the requests in the request relation tree;
and the second processing submodule is used for processing the first request and acquiring a response result corresponding to the first request if the number of the unprocessed sub-requests of the first request is 0.
In one possible implementation, the apparatus further includes:
and the parallel processing module is used for processing different request relation trees in parallel.
According to a fourth aspect of the present disclosure, there is provided a resource request apparatus, the apparatus comprising:
the device comprises a generating module, a processing module and a processing module, wherein the generating module is used for generating a first request according to request description information, and the request description information can be used for determining the dependency relationship between the first request and other requests;
the sending module is used for sending the first request to a server side;
and the receiving module is used for receiving a response result corresponding to the first request returned by the server side.
In one possible implementation, the request description information of the first request includes a unique identifier of the first request and a uniform resource locator of a resource requested by the first request.
In a possible implementation manner, the request description information of the first request further includes one or more of request parameters of the first request, information of sub-requests of the first request, and response result information corresponding to the first request, where the sub-requests of the first request represent requests on which the first request depends.
According to another aspect of the present disclosure, there is provided a resource request apparatus including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to perform the method of the first aspect.
According to another aspect of the present disclosure, there is provided a resource request apparatus including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to perform the method of the second aspect described above.
According to another aspect of the present disclosure, there is provided a non-transitory computer readable storage medium having computer program instructions stored thereon, wherein the computer program instructions, when executed by a processor, implement the method of the first aspect described above.
According to another aspect of the present disclosure, there is provided a non-transitory computer readable storage medium having stored thereon computer program instructions, wherein the computer program instructions, when executed by a processor, implement the method of the second aspect described above.
In the embodiment of the disclosure, the server side acquires the first request from the client side, determines the dependency relationship between the first request and other requests according to the request description information of the first request, constructs the request relationship tree according to the dependency relationship between the first request and other requests, processes the requests in the request relationship tree from the leaf nodes of the request relationship tree until acquiring the response result corresponding to the first request, and returns the response result corresponding to the first request to the client side, thereby providing a technical scheme for defining the request description information by the client side, so that the definer of the request description information is consistent with the request user side, reducing the communication cost between the client side and the server side, shortening the resource request time, realizing the separation of the front end and the back end, and being beneficial to development and maintenance.
Other features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments, which proceeds with reference to the accompanying drawings.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.
Fig. 1 shows a flow diagram of a resource request method according to an embodiment of the present disclosure.
Fig. 2 is a schematic diagram illustrating a request relationship tree in a resource request method according to an embodiment of the disclosure.
Fig. 3 shows an exemplary flowchart of step S14 of the resource request method according to an embodiment of the present disclosure.
Fig. 4 shows a flow diagram of a resource request method according to an embodiment of the present disclosure.
Fig. 5 shows a block diagram of a resource requesting device according to an embodiment of the present disclosure.
Fig. 6 illustrates an exemplary block diagram of a resource requesting device according to an embodiment of the present disclosure.
Fig. 7 shows a block diagram of a resource requesting device according to an embodiment of the present disclosure.
Fig. 8 is a block diagram illustrating an apparatus 800 for resource request in accordance with an example embodiment.
Fig. 9 is a block diagram illustrating an apparatus 1900 for resource requests in accordance with an example embodiment.
Detailed Description
Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. In the drawings, like reference numbers can indicate functionally identical or similar elements. While the various aspects of the embodiments are presented in drawings, the drawings are not necessarily drawn to scale unless specifically indicated.
The word "exemplary" is used exclusively herein to mean "serving as an example, embodiment, or illustration. Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments.
Furthermore, in the following detailed description, numerous specific details are set forth in order to provide a better understanding of the present disclosure. It will be understood by those skilled in the art that the present disclosure may be practiced without some of these specific details. In some instances, methods, means, elements and circuits that are well known to those skilled in the art have not been described in detail so as not to obscure the present disclosure.
Fig. 1 shows a flow diagram of a resource request method according to an embodiment of the present disclosure. The execution subject of the resource request method may be a resource request device. The resource request method is applied to a server side. For example, the resource request method may be performed by a server or other processing device. In some possible implementations, the resource request method may be implemented by a processor calling computer readable instructions stored in a memory. As shown in fig. 1, the method includes steps S11 through S15.
In step S11, a first request from the client is acquired.
In an embodiment of the present disclosure, the first request is for requesting acquisition of a resource. The resource requested to be acquired may be any resource. For example, the resource requested to be acquired may be a web page; as another example, the resource requested to be acquired may be a home page of a website.
The request in the embodiment of the present disclosure may be an HTML (HyperText Markup Language) request, which is not limited herein.
In the embodiment of the present disclosure, a first request sent by a client to a server carries request description information, and the request description information is defined by the client.
In step S12, a dependency relationship between the first request and other requests is determined according to the request description information of the first request.
Wherein the other requests may represent requests from the client other than the first request.
In a possible implementation, if the request description information of the first request does not include information of sub-requests of the first request, it may indicate that the first request does not have sub-requests, i.e., the first request is not dependent on other requests.
In another possible implementation manner, if the request description information of the first request includes information of a sub-request of the first request, and the information of the sub-request of the first request is null, it may indicate that the first request does not have the sub-request, that is, the first request is independent of other requests.
In another possible implementation manner, if the request description information of the first request includes information of sub-requests of the first request, and the information of the sub-requests of the first request is not null, it may indicate that the first request has the sub-requests, that is, the first request depends on other requests. For example, if the information of the sub-request of the first request includes the second request and the third request, it may be represented that the sub-request of the first request includes the second request and the point request.
In a possible implementation manner, if the information of the sub-request of the fifth request in the request description information of the fifth request includes the first request, it may be indicated that the sub-request of the fifth request includes the first request.
In one possible implementation, the request description information of the first request includes a unique identifier of the first request and a Uniform Resource Locator (URL) of a Resource requested by the first request. Wherein the unique identifier may be represented by an "id".
In a possible implementation manner, the request description information of the first request further includes one or more of request parameters of the first request, information of sub-requests of the first request, and response result information corresponding to the first request, where the sub-requests of the first request represent requests on which the first request depends. Wherein the request parameter may be query information. For example, the request parameters may include query terms.
For example, the unique identifier of the first request is 1, the uniform resource locator of the resource requested by the first request is "http:// a. com/getData", and the request parameters of the first request are { "p 1": 1, the sub-requests of the first request include a second request and a third request, and the response result information corresponding to the first request is { }, that is, the response result corresponding to the first request is empty at present, in other words, the response of the first request is not obtained yet;
the unique identifier of the second request is 11, the uniform resource locator of the resource requested by the second request is http:// a.com/auth 1', the request parameter of the second request is { }, and the response result corresponding to the second request is { };
the unique identifier of the third request is 12, the uniform resource locator of the resource requested by the third request is http:// a.com/auth 2', the request parameter of the third request is { }, and the response result corresponding to the third request is { };
the unique identifier of the fourth request is 2, the uniform resource locator of the resource requested by the fourth request is http:// b.com/getData', and the request parameter of the fourth request is { };
the unique identifier of the fifth request is 3, the uniform resource locator of the resource requested by the fifth request is "http:// a. com/getData 2", the request parameter of the fifth request is { }, and the sub-requests of the fifth request comprise the first request.
In step S13, a request relationship tree is constructed according to the dependency relationship between the first request and other requests, wherein if the first request depends on the second request, the second request is a child node of the first request in the request relationship tree.
In the embodiment of the present disclosure, the server may construct a request relationship tree according to the obtained dependency relationship between the requests. For example, the server side obtains the first request, the second request, the third request, the fourth request and the fifth request from the client side, and then determines the dependency relationship among the requests according to the request description information of the requests, so as to construct a request relationship tree.
Fig. 2 is a schematic diagram illustrating a request relationship tree in a resource request method according to an embodiment of the disclosure. As shown in FIG. 2, two request relationship trees can be constructed according to the dependency relationship among the first request id1, the second request id11, the third request id12, the fourth request id2 and the fifth request id 3. In the first request relationship tree, the fifth request id3 is a parent node of the first request id1, and the first request id1 is a child node of the fifth request id 3; the first request id1 is the parent node of the second request id11, the second request id11 is the child node of the first request id 1; the first request id1 is the parent node of the third request id12, the third request id12 is the child node of the first request id 1; the second request id11 and the third request id12 are leaf nodes of the first request relationship tree. The second request relationship tree has only one node of the fourth request id2, and the leaf node of the second request relationship tree is the fourth request id 2. A plurality of request relationship trees may form a request relationship forest.
In step S14, the request in the request relation tree is processed starting from the leaf node of the request relation tree until the response result corresponding to the first request is obtained, where the leaf node represents a node without a child node.
In an embodiment of the present disclosure, processing the request may include: and sending the request to a server corresponding to the request, and acquiring a response result corresponding to the request from the server corresponding to the request.
In step S15, a response result corresponding to the first request is returned to the client.
In a possible implementation manner, after the response result corresponding to the first request is obtained, the response result corresponding to the first request may be put into the response result information of the request description information of the first request, and the request description information into which the response result information is put may be returned to the client.
In the embodiment of the disclosure, after the client acquires the response result corresponding to the first request, the client may analyze the response result, and acquire result data from the response result for rendering the page.
In the embodiment of the disclosure, a server side acquires a first request from a client side, determines a dependency relationship between the first request and other requests according to request description information of the first request, constructs a request relationship tree according to the dependency relationship between the first request and other requests, processes the request in the request relationship tree from a leaf node of the request relationship tree until acquiring a response result corresponding to the first request, and returns the response result corresponding to the first request to the client side, thereby providing a technical scheme for defining the request description information by the client side. Because the client defines the request description information and the request user is the client, the definer of the request description information is consistent with the request user and conforms to the principle of 'who uses and who defines'. Because the request description information is defined by the client, and the request description information is not defined by the server, the process of the resource request is reduced from two RTTs (Round-Trip Time) to one RTT, so that the communication cost between the client and the server can be reduced, and the resource request Time can be shortened. Where one RTT represents the round trip time of one request. In addition, the request description information is defined by the client, so that the separation of the front end and the back end is realized, the front end and the back end are prevented from being coupled together, the development and the maintenance are facilitated, and the realization difficulty can be reduced, wherein the front end refers to the client, and the back end refers to the server.
In one possible implementation, the method further includes: and acquiring the number of unprocessed sub-requests of the request in the request relation tree, wherein the number of unprocessed sub-requests of the request represents the number of unprocessed sub-requests of the request.
In a possible implementation manner, a request object corresponding to each request may be constructed according to the request description information of each request, and information of the number of unprocessed sub-requests of the request object is added for each request object.
Fig. 3 shows an exemplary flowchart of step S14 of the resource request method according to an embodiment of the present disclosure. As shown in fig. 3, step S14 may include steps S141 to S143.
In step S141, requests with the number of unprocessed sub-requests being 0 in the request relationship tree are processed, and response results corresponding to the requests in the request relationship tree are obtained.
For example, if the number of unprocessed sub-requests of the second request and the third request in the request relationship tree is 0, the second request and the third request are processed, a response result corresponding to the second request is obtained, and a response result corresponding to the third request is obtained.
In step S142, the number of unprocessed sub-requests of the request in the request relationship tree is updated according to the response result corresponding to the request in the request relationship tree.
For example, the sub-requests of the first request include the second request and the third request, and the number of unprocessed sub-requests of the first request is 2 before the second request and the third request are processed. If a response result corresponding to the second request is obtained, subtracting 1 from the number of unprocessed sub-requests of the first request; and if a response result corresponding to the third request is obtained, subtracting 1 from the number of the unprocessed sub-requests of the first request.
In step S143, if the number of unprocessed sub-requests of the first request is 0, the first request is processed, and a response result corresponding to the first request is obtained.
In one possible implementation, the method further includes: different request relation trees are processed in parallel. As shown in fig. 2, the first request relationship tree and the second request relationship tree may be processed in parallel, that is, the requests corresponding to id11, id12 and id2 may be processed in parallel. The implementation mode can shorten the request processing time by processing different request relation trees in parallel.
Fig. 4 shows a flow diagram of a resource request method according to an embodiment of the present disclosure. The execution subject of the resource request method may be a resource request device. The resource request method is applied to the client. For example, the resource request method may be performed by a terminal device or other processing device. The terminal device may be a User Equipment (UE), a mobile device, a User terminal, a cellular phone, a cordless phone, a Personal Digital Assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, or a wearable device. In some possible implementations, the resource request method may be implemented by a processor calling computer readable instructions stored in a memory. As shown in fig. 4, the method includes steps S41 through S43.
In step S41, a first request is generated according to request description information, wherein the request description information can be used to determine the dependency relationship between the first request and other requests.
In an embodiment of the present disclosure, the first request is for requesting acquisition of a resource. The resource requested to be acquired may be any resource. For example, the resource requested to be acquired may be a web page; as another example, the resource requested to be acquired may be a home page of a website.
The request in the embodiment of the present disclosure may be an HTML request, which is not limited herein.
In the embodiment of the present disclosure, the first request carries request description information, and the request description information is defined by the client.
In a possible implementation, if the request description information of the first request does not include information of sub-requests of the first request, it may indicate that the first request does not have sub-requests, i.e., the first request is not dependent on other requests.
In another possible implementation manner, if the request description information of the first request includes information of a sub-request of the first request, and the information of the sub-request of the first request is null, it may indicate that the first request does not have the sub-request, that is, the first request is independent of other requests.
In another possible implementation manner, if the request description information of the first request includes information of sub-requests of the first request, and the information of the sub-requests of the first request is not null, it may indicate that the first request has the sub-requests, that is, the first request depends on other requests. For example, if the information of the sub-request of the first request includes the second request and the third request, it may be represented that the sub-request of the first request includes the second request and the point request.
In a possible implementation manner, if the information of the sub-request of the fifth request in the request description information of the fifth request includes the first request, it may be indicated that the sub-request of the fifth request includes the first request.
In one possible implementation, the request description information of the first request includes a unique identifier of the first request and a uniform resource locator of a resource requested by the first request. Wherein the unique identifier may be represented by an "id".
In a possible implementation manner, the request description information of the first request further includes one or more of request parameters of the first request, information of sub-requests of the first request, and response result information corresponding to the first request, where the sub-requests of the first request represent requests on which the first request depends. Wherein the request parameter may be query information. For example, the request parameters may include query terms.
In step S42, a first request is sent to the server.
In step S43, a response result corresponding to the first request returned by the server is received.
In a possible implementation manner, after receiving the response result corresponding to the first request, the client may analyze the response result, and obtain result data from the response result for rendering the page.
In the embodiment of the disclosure, the client generates the first request according to the request description information, sends the first request to the server, and receives the response result corresponding to the first request returned by the server, thereby providing a technical scheme for defining the request description information by the client, so that the definer of the request description information is consistent with the request user, the communication cost between the client and the server is reduced, the resource request time is shortened, the front-end and back-end separation is realized, and the development and maintenance are facilitated.
Fig. 5 shows a block diagram of a resource requesting device according to an embodiment of the present disclosure. As shown in fig. 5, the apparatus includes: a first obtaining module 51, configured to obtain a first request from a client; a determining module 52, configured to determine, according to the request description information of the first request, a dependency relationship between the first request and other requests; a building module 53, configured to build a request relationship tree according to a dependency relationship between the first request and another request, where if the first request depends on a second request, the second request is a child node of the first request in the request relationship tree; a processing module 54, configured to process the request in the request relation tree starting from a leaf node of the request relation tree until obtaining a response result corresponding to the first request, where the leaf node indicates a node without a child node; and a returning module 55, configured to return a response result corresponding to the first request to the client.
In one possible implementation, the request description information of the first request includes a unique identifier of the first request and a uniform resource locator of a resource requested by the first request.
In a possible implementation manner, the request description information of the first request further includes one or more of request parameters of the first request, information of sub-requests of the first request, and response result information corresponding to the first request, where the sub-requests of the first request represent requests on which the first request depends.
Fig. 6 illustrates an exemplary block diagram of a resource requesting device according to an embodiment of the present disclosure. As shown in fig. 6:
in one possible implementation, the apparatus further includes: a second obtaining module 56, configured to obtain an unprocessed sub-request number of the request in the request relationship tree, where the unprocessed sub-request number of the request indicates an unprocessed number in the requested sub-request.
In one possible implementation, the processing module 54 includes: the first processing submodule 541 is configured to process requests with an unprocessed sub-request number of 0 in the request relationship tree, and obtain a response result corresponding to the request in the request relationship tree; the updating submodule 542 is configured to update the number of unprocessed sub-requests of the requests in the request relationship tree according to a response result corresponding to the request in the request relationship tree; the second processing sub-module 543 is configured to process the first request and obtain a response result corresponding to the first request if the number of unprocessed sub-requests of the first request is 0.
In one possible implementation, the apparatus further includes: and a parallel processing module 57, configured to process different request relation trees in parallel.
In the embodiment of the disclosure, the server side acquires the first request from the client side, determines the dependency relationship between the first request and other requests according to the request description information of the first request, constructs the request relationship tree according to the dependency relationship between the first request and other requests, processes the requests in the request relationship tree from the leaf nodes of the request relationship tree until acquiring the response result corresponding to the first request, and returns the response result corresponding to the first request to the client side, thereby providing a technical scheme for defining the request description information by the client side, so that the definer of the request description information is consistent with the request user side, reducing the communication cost between the client side and the server side, shortening the resource request time, realizing the separation of the front end and the back end, and being beneficial to development and maintenance.
Fig. 7 shows a block diagram of a resource requesting device according to an embodiment of the present disclosure. As shown in fig. 7, the apparatus includes: a generating module 71, configured to generate a first request according to request description information, where the request description information can be used to determine a dependency relationship between the first request and other requests; a sending module 72, configured to send a first request to a server; the receiving module 73 is configured to receive a response result corresponding to the first request returned by the server.
In one possible implementation, the request description information of the first request includes a unique identifier of the first request and a uniform resource locator of a resource requested by the first request.
In a possible implementation manner, the request description information of the first request further includes one or more of request parameters of the first request, information of sub-requests of the first request, and response result information corresponding to the first request, where the sub-requests of the first request represent requests on which the first request depends.
In the embodiment of the disclosure, the client generates the first request according to the request description information, sends the first request to the server, and receives the response result corresponding to the first request returned by the server, thereby providing a technical scheme for defining the request description information by the client, so that the definer of the request description information is consistent with the request user, the communication cost between the client and the server is reduced, the resource request time is shortened, the front-end and back-end separation is realized, and the development and maintenance are facilitated.
Fig. 8 is a block diagram illustrating an apparatus 800 for resource request in accordance with an example embodiment. For example, the apparatus 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 8, the apparatus 800 may include one or more of the following components: processing component 802, memory 804, power component 806, multimedia component 808, audio component 810, input/output (I/O) interface 812, sensor component 814, and communication component 816.
The processing component 802 generally controls overall operation of the device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 802 may include one or more processors 820 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interaction between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operations at the apparatus 800. Examples of such data include instructions for any application or method operating on device 800, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 804 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
Power components 806 provide power to the various components of device 800. The power components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the apparatus 800.
The multimedia component 808 includes a screen that provides an output interface between the device 800 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 800 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the apparatus 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 814 includes one or more sensors for providing various aspects of state assessment for the device 800. For example, the sensor assembly 814 may detect the open/closed status of the device 800, the relative positioning of components, such as a display and keypad of the device 800, the sensor assembly 814 may also detect a change in the position of the device 800 or a component of the device 800, the presence or absence of user contact with the device 800, the orientation or acceleration/deceleration of the device 800, and a change in the temperature of the device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate communications between the apparatus 800 and other devices in a wired or wireless manner. The device 800 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer-readable storage medium, such as the memory 804, is also provided that includes computer program instructions executable by the processor 820 of the device 800 to perform the above-described methods.
Fig. 9 is a block diagram illustrating an apparatus 1900 for resource requests in accordance with an example embodiment. For example, the apparatus 1900 may be provided as a server. Referring to fig. 9, the device 1900 includes a processing component 1922 further including one or more processors and memory resources, represented by memory 1932, for storing instructions, e.g., applications, executable by the processing component 1922. The application programs stored in memory 1932 may include one or more modules that each correspond to a set of instructions. Further, the processing component 1922 is configured to execute instructions to perform the above-described method.
The device 1900 may also include a power component 1926 configured to perform power management of the device 1900, a wired or wireless network interface 1950 configured to connect the device 1900 to a network, and an input/output (I/O) interface 1958. The device 1900 may operate based on an operating system stored in memory 1932, such as Windows Server, MacOS XTM, UnixTM, LinuxTM, FreeBSDTM, or the like.
In an exemplary embodiment, a non-transitory computer readable storage medium, such as the memory 1932, is also provided that includes computer program instructions executable by the processing component 1922 of the apparatus 1900 to perform the above-described methods.
The present disclosure may be systems, methods, and/or computer program products. The computer program product may include a computer-readable storage medium having computer-readable program instructions embodied thereon for causing a processor to implement various aspects of the present disclosure.
The computer readable storage medium may be a tangible device that can hold and store the instructions for use by the instruction execution device. The computer readable storage medium may be, for example, but not limited to, an electronic memory device, a magnetic memory device, an optical memory device, an electromagnetic memory device, a semiconductor memory device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: 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), a Static Random Access Memory (SRAM), a portable compact disc read-only memory (CD-ROM), a Digital Versatile Disc (DVD), a memory stick, a floppy disk, a mechanical coding device, such as punch cards or in-groove projection structures having instructions stored thereon, and any suitable combination of the foregoing. Computer-readable storage media as used herein is not to be construed as transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., optical pulses through a fiber optic cable), or electrical signals transmitted through electrical wires.
The computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or to an external computer or external storage device via a network, such as the internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. The network adapter card or network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in the respective computing/processing device.
The computer program instructions for carrying out operations of the present disclosure may be assembler instructions, Instruction Set Architecture (ISA) instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider). In some embodiments, the electronic circuitry that can execute the computer-readable program instructions implements aspects of the present disclosure by utilizing the state information of the computer-readable program instructions to personalize the electronic circuitry, such as a programmable logic circuit, a Field Programmable Gate Array (FPGA), or a Programmable Logic Array (PLA).
Various aspects of the present disclosure are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the disclosure. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer-readable program instructions.
These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, 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/acts specified in the flowchart and/or block diagram block or blocks. These computer-readable program instructions may also be stored in a computer-readable storage medium that can direct a computer, programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer-readable medium storing the instructions comprises an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer, other programmable apparatus or other devices implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart 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 disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). 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 and/or flowchart illustration, and combinations of blocks in the block diagrams and/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.
Having described embodiments of the present disclosure, the foregoing description is intended to be exemplary, not exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terms used herein were chosen in order to best explain the principles of the embodiments, the practical application, or technical improvements to the techniques in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.

Claims (22)

1. A resource request method is applied to a server side, and the method comprises the following steps:
acquiring a first request from a client;
determining a dependency relationship between the first request and other requests according to the request description information of the first request;
constructing a request relation tree according to the dependency relation between the first request and other requests, wherein if the first request is dependent on a second request, the second request is a child node of the first request in the request relation tree;
processing the request in the request relation tree from a leaf node of the request relation tree until a response result corresponding to the first request is obtained, wherein the leaf node represents a node without a child node;
and returning a response result corresponding to the first request to the client.
2. The method of claim 1, wherein the request description information of the first request comprises a unique identifier of the first request and a uniform resource locator of a resource requested by the first request.
3. The method of claim 2, wherein the request description information of the first request further includes one or more of request parameters of the first request, information of sub-requests of the first request, and response result information corresponding to the first request, wherein the sub-requests of the first request represent requests on which the first request depends.
4. The method of claim 1, further comprising:
obtaining the number of unprocessed sub-requests of the request in the request relation tree, wherein the number of unprocessed sub-requests of the request represents the number of unprocessed sub-requests of the request.
5. The method of claim 4, wherein processing the request in the request relationship tree starting from a leaf node of the request relationship tree until obtaining a response result corresponding to the first request comprises:
processing the requests with the unprocessed sub-requests quantity of 0 in the request relation tree, and acquiring response results corresponding to the requests in the request relation tree;
updating the number of unprocessed sub-requests of the requests in the request relation tree according to the response result corresponding to the requests in the request relation tree;
and if the number of the unprocessed sub-requests of the first request is 0, processing the first request and acquiring a response result corresponding to the first request.
6. The method of claim 1, further comprising:
different request relation trees are processed in parallel.
7. A resource request method is applied to a client, and the method comprises the following steps:
generating a first request according to request description information, wherein the request description information can be used for determining the dependency relationship between the first request and other requests;
sending the first request to a server;
and receiving a response result corresponding to the first request returned by the server.
8. The method of claim 7, wherein the request description information of the first request comprises a unique identifier of the first request and a uniform resource locator of a resource requested by the first request.
9. The method of claim 8, wherein the request description information of the first request further includes one or more of request parameters of the first request, information of sub-requests of the first request, and response result information corresponding to the first request, wherein the sub-requests of the first request represent requests on which the first request depends.
10. A resource request apparatus, characterized in that the apparatus comprises:
the first acquisition module is used for acquiring a first request from a client;
the determining module is used for determining the dependency relationship between the first request and other requests according to the request description information of the first request;
a building module, configured to build a request relationship tree according to a dependency relationship between the first request and another request, where if the first request is dependent on a second request, the second request is a child node of the first request in the request relationship tree;
the processing module is used for processing the request in the request relation tree from a leaf node of the request relation tree until a response result corresponding to the first request is obtained, wherein the leaf node represents a node without a child node;
and the return module is used for returning a response result corresponding to the first request to the client.
11. The apparatus of claim 10, wherein the request description information of the first request comprises a unique identifier of the first request and a uniform resource locator of a resource requested by the first request.
12. The apparatus of claim 11, wherein the request description information of the first request further comprises one or more of request parameters of the first request, information of sub-requests of the first request, and response result information corresponding to the first request, wherein the sub-requests of the first request represent requests on which the first request depends.
13. The apparatus of claim 10, further comprising:
a second obtaining module, configured to obtain an unprocessed sub-request number of the request in the request relationship tree, where the unprocessed sub-request number of the request represents an unprocessed number in the sub-request of the request.
14. The apparatus of claim 13, wherein the processing module comprises:
the first processing submodule is used for processing the requests with the unprocessed sub-requests quantity of 0 in the request relation tree and acquiring the response result corresponding to the requests in the request relation tree;
the updating submodule is used for updating the number of unprocessed sub-requests of the requests in the request relation tree according to the response result corresponding to the requests in the request relation tree;
and the second processing submodule is used for processing the first request and acquiring a response result corresponding to the first request if the number of the unprocessed sub-requests of the first request is 0.
15. The apparatus of claim 10, further comprising:
and the parallel processing module is used for processing different request relation trees in parallel.
16. A resource request apparatus, characterized in that the apparatus comprises:
the device comprises a generating module, a processing module and a processing module, wherein the generating module is used for generating a first request according to request description information, and the request description information can be used for determining the dependency relationship between the first request and other requests;
the sending module is used for sending the first request to a server side;
and the receiving module is used for receiving a response result corresponding to the first request returned by the server side.
17. The apparatus of claim 16, wherein the request description information of the first request comprises a unique identifier of the first request and a uniform resource locator of a resource requested by the first request.
18. The apparatus of claim 17, wherein the request description information of the first request further comprises one or more of request parameters of the first request, information of sub-requests of the first request, and response result information corresponding to the first request, wherein the sub-requests of the first request represent requests on which the first request depends.
19. A resource request apparatus, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the method of any one of claims 1 to 6.
20. A resource request apparatus, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the method of any one of claims 7 to 9.
21. A non-transitory computer readable storage medium having computer program instructions stored thereon, wherein the computer program instructions, when executed by a processor, implement the method of any of claims 1 to 6.
22. A non-transitory computer readable storage medium having stored thereon computer program instructions, wherein the computer program instructions, when executed by a processor, implement the method of any one of claims 7 to 9.
CN201811138425.3A 2018-09-28 2018-09-28 Resource request method and device Pending CN110968739A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811138425.3A CN110968739A (en) 2018-09-28 2018-09-28 Resource request method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811138425.3A CN110968739A (en) 2018-09-28 2018-09-28 Resource request method and device

Publications (1)

Publication Number Publication Date
CN110968739A true CN110968739A (en) 2020-04-07

Family

ID=70027104

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811138425.3A Pending CN110968739A (en) 2018-09-28 2018-09-28 Resource request method and device

Country Status (1)

Country Link
CN (1) CN110968739A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8190593B1 (en) * 2010-04-14 2012-05-29 A9.Com, Inc. Dynamic request throttling
CN103733568A (en) * 2011-08-18 2014-04-16 国际商业机器公司 Stream processing using a client-server architecture
CN105354292A (en) * 2015-10-30 2016-02-24 东莞酷派软件技术有限公司 Page output method and apparatus
CN105808633A (en) * 2016-01-08 2016-07-27 平安科技(深圳)有限公司 Data archiving method and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8190593B1 (en) * 2010-04-14 2012-05-29 A9.Com, Inc. Dynamic request throttling
CN103733568A (en) * 2011-08-18 2014-04-16 国际商业机器公司 Stream processing using a client-server architecture
CN105354292A (en) * 2015-10-30 2016-02-24 东莞酷派软件技术有限公司 Page output method and apparatus
CN105808633A (en) * 2016-01-08 2016-07-27 平安科技(深圳)有限公司 Data archiving method and system

Similar Documents

Publication Publication Date Title
CN106170004B (en) Method and device for processing verification code
CN104125067B (en) Account and token secret key binding method and device
CN106960014B (en) Associated user recommendation method and device
CN105930536B (en) Index establishing method, page jumping method and device
KR101852244B1 (en) Recommendation information acquisition method, terminal, server, program, and recording medium
CN110519655B (en) Video editing method, device and storage medium
CN107122430B (en) Search result display method and device
CN107508573B (en) Crystal oscillator oscillation frequency correction method and device
CN105049219B (en) Flow booking method and system, mobile terminal and server
CN106790018B (en) Resource sharing playing method and device
CN113807253A (en) Face recognition method and device, electronic equipment and storage medium
CN110633715B (en) Image processing method, network training method and device and electronic equipment
CN104050236B (en) Web site contents update reminding method, server and client side
CN109992754B (en) Document processing method and device
CN110955800A (en) Video retrieval method and device
CN106790683B (en) Network data display method and device based on mobile terminal
CN111694571B (en) Compiling method and device
CN110460873B (en) Method and device for generating video on demand
CN109189822B (en) Data processing method and device
CN106851418B (en) Video recommendation method and device
CN112732098B (en) Input method and related device
CN110968739A (en) Resource request method and device
CN110740360B (en) Multimedia resource playing method and device
CN108549570B (en) User interface updating method and device
CN111723321B (en) Page request method, device and storage medium

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20200507

Address after: 310052 room 508, floor 5, building 4, No. 699, Wangshang Road, Changhe street, Binjiang District, Hangzhou City, Zhejiang Province

Applicant after: Alibaba (China) Co.,Ltd.

Address before: 200241, room 2, floor 02, building 555, Dongchuan Road, Minhang District, Shanghai

Applicant before: CHUANXIAN NETWORK TECHNOLOGY (SHANGHAI) Co.,Ltd.

RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200407