WO2023193631A1 - Request scheduling method and apparatus, and computer device and storage medium - Google Patents
Request scheduling method and apparatus, and computer device and storage medium Download PDFInfo
- Publication number
- WO2023193631A1 WO2023193631A1 PCT/CN2023/084315 CN2023084315W WO2023193631A1 WO 2023193631 A1 WO2023193631 A1 WO 2023193631A1 CN 2023084315 W CN2023084315 W CN 2023084315W WO 2023193631 A1 WO2023193631 A1 WO 2023193631A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- request
- information
- target
- response
- response content
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 109
- 230000004044 response Effects 0.000 claims abstract description 214
- 238000012545 processing Methods 0.000 claims abstract description 149
- 230000008569 process Effects 0.000 claims description 34
- 238000004590 computer program Methods 0.000 claims description 13
- 230000008859 change Effects 0.000 claims description 9
- 230000002159 abnormal effect Effects 0.000 claims description 5
- 230000006870 function Effects 0.000 description 12
- 230000004048 modification Effects 0.000 description 5
- 238000012986 modification Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 238000011144 upstream manufacturing Methods 0.000 description 4
- 238000004891 communication Methods 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 238000011160 research Methods 0.000 description 3
- 238000006243 chemical reaction Methods 0.000 description 2
- 235000014510 cooky Nutrition 0.000 description 2
- 238000006467 substitution reaction Methods 0.000 description 2
- 238000012360 testing method Methods 0.000 description 2
- 239000003086 colorant Substances 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/60—Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/60—Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
- H04L67/63—Routing a service request depending on the request content or context
Definitions
- the present disclosure relates to the field of computer technology, and specifically, to a request scheduling method, device, computer equipment and storage medium.
- the application request After receiving the application request, the application request needs to be scheduled to the corresponding application server, and the application server is used to process the application request and return the processing result.
- the current traffic scheduling method only relies on a single feature information in the request when scheduling requests. The granularity of request scheduling is coarse and the scheduling effect is poor.
- Embodiments of the present disclosure provide at least a request scheduling method, device, computer device, and storage medium.
- embodiments of the present disclosure provide a request scheduling method, including:
- the request context information includes multiple pieces of request feature information
- the request feature information includes routing feature information
- Generate a second request according to the target context information send the second request to the target server, and after obtaining the first response content fed back by the target server in response to the second request, process the request based on the The information processes the first response content, and feeds the processed second response content back to the application client as a response result of the first request.
- the request context information is processed according to the request processing information to obtain processed target context information, including:
- the request header information and/or client address information in the request context information make modifications to obtain the target context information.
- the method before sending the second request to the target server, the method further includes:
- the target server can respond to the second request.
- the method further includes:
- the target server cannot respond to the second request, and the second request is sent to the first backup indicated by the request processing information. server.
- processing the first response content based on the request processing information includes:
- the content update information carried in the request processing information is used to change the response header information in the first response content to obtain the result. Describe the content of the second response.
- the method further includes:
- the second request, the first response content and the second response content Based on the first request, the second request, the first response content and the second response content, generate log information corresponding to the first request; and/or release the information used when processing the first request. computing resources.
- the obtained pre-configured routing configuration information and the The routing feature information in the request context information determines the target server and request processing information corresponding to the first request, including:
- the requested domain name in the routing feature information obtain each preset access path under the requested domain name from the routing configuration information;
- each candidate access path that matches the target access path in the routing feature information determines each candidate access path that matches the target access path in the routing feature information, and the path length corresponding to the candidate access path is less than or equal to the path length of the target access path;
- the method further includes the step of pre-configuring the routing configuration information:
- an embodiment of the present disclosure also provides a request scheduling device, including:
- An acquisition module configured to acquire the first request sent by the application client, and extract request context information from the first request; the request context information includes multiple pieces of request feature information, and the request feature information includes routing feature information;
- a determination module configured to determine the target server and request processing information corresponding to the first request based on the obtained preconfigured routing configuration information and the routing feature information in the request context information;
- a first processing module configured to process the request context information according to the request processing information to obtain processed target context information
- a sending module configured to generate a second request according to the target context information, send the second request to the target server, and after obtaining the first response content fed back by the target server in response to the second request, The first response content is processed based on the request processing information, and the processed second response content is fed back to the application client as a response result of the first request.
- the first processing module is configured to perform the request processing operation on the request context information in the first processing stage as indicated by the request processing information. Modify the request header information and/or client address information in the request context information to obtain the target context information.
- the sending module before sending the second request to the target server, is further configured to determine, based on the target context information, the request identifier corresponding to the first request and Request mode, and based on the request processing information, determine the target reception frequency of the target server for the request mode and the request identification;
- the target server can respond to the second request.
- the sending module is further configured to determine that the target server cannot respond to the second request, and determine that the current receiving frequency is not less than the target receiving frequency.
- the second request is sent to the first backup server indicated by the request processing information.
- the sending module when processing the first response content based on the request processing information, is configured to determine the status code indication carried in the first response content. If the response is abnormal, forward the second request to the second backup server, receive the third response content fed back by the second backup server, and use the third response content to update the first response content. , obtain the second response content; or
- the content update information carried in the request processing information is used to change the response header information in the first response content to obtain the result. Describe the content of the second response.
- the device further includes:
- the second processing module is configured to, after the processed second response content is fed back to the application client as the response result of the first request, based on the first request, the second request, and the The first response content and the second response content are used to generate log information corresponding to the first request; and/or, the computing resources used in processing the first request are released.
- the determination module determines the target server and request processing corresponding to the first request based on the obtained pre-configured routing configuration information and the routing feature information in the request context information. information, used to based on the requested domain name in the routing feature information, Obtain each preset access path under the requested domain name from the routing configuration information;
- each candidate access path that matches the target access path in the routing feature information determines each candidate access path that matches the target access path in the routing feature information, and the path length corresponding to the candidate access path is less than or equal to the path length of the target access path;
- the device further includes:
- a configuration module configured to pre-configure the routing configuration information according to the following steps: obtain the serialized routing configuration file sent by the configuration center; wherein the routing configuration file is obtained by the configuration center for the application client After routing configuration information of the corresponding application, serialize the resulting file;
- an optional implementation manner of the present disclosure also provides a computer device, a processor, and a memory.
- the memory stores machine-readable instructions executable by the processor, and the processor is configured to execute the instructions stored in the memory.
- Machine-readable instructions when the machine-readable instructions are executed by the processor, when the machine-readable instructions are executed by the processor, the above-mentioned first aspect, or any possible implementation of the first aspect, is executed. steps in the way.
- an optional implementation manner of the present disclosure also provides a computer-readable storage medium.
- the computer-readable storage medium stores a computer program. When the computer program is run, it executes the above-mentioned first aspect, or any of the first aspects. steps in a possible implementation.
- the request scheduling method, device, computer equipment and storage medium can obtain multiple pieces of request feature information that can be used for request scheduling by extracting the request context information in the first request, thereby relying on rich information.
- the request context information is used for request scheduling, which can realize fine-grained request scheduling and improve the accuracy of request scheduling.
- the request context information can be modified to the target context information that satisfies the configuration information, and fine-grained updates to the target context can be achieved. Then generate a second request based on the target context information, and send the second request to the target server.
- the second request corresponds to the first request
- the target server is used to process the second request, that is, the first request is scheduled and processed in a timely manner.
- the first response content fed back by the target server for the second request is modified, achieving fine-grained modification of the first response content to the second response content that satisfies the configuration information, that is, a more accurate And more consistent with the expected response results.
- Figure 1 shows a flow chart of a request scheduling method provided by an embodiment of the present disclosure
- Figure 2 shows a specific implementation flow chart of a request scheduling method provided by an embodiment of the present disclosure
- Figure 3 shows a schematic diagram of a request scheduling device provided by an embodiment of the present disclosure
- FIG. 4 shows a schematic structural diagram of a computer device provided by an embodiment of the present disclosure.
- the gateway After research, it was found that after obtaining the application request, the gateway only uses the routing feature information in the application request to schedule the request. Specifically, the gateway uses the routing feature information to determine the server that can receive the application request, and then schedules the application request to the server, thereby realizing the scheduling of the application request.
- routing feature information for request scheduling has the problem of coarser granularity of request scheduling and poor scheduling effect.
- the present disclosure provides a request scheduling solution.
- request scheduling By extracting the request context information in the first request, multiple pieces of request feature information that can be used for request scheduling can be obtained, and then rely on the request context information containing rich information.
- Request scheduling can achieve fine-grained request scheduling and improve the accuracy of request scheduling.
- the request context information can be modified to the target context information that satisfies the configuration information, and fine-grained updates to the target context can be achieved.
- the second request corresponds to the first request, and the target server is used to process the second request, that is, the second request is processed.
- a request is dispatched and processed in a timely manner. Finally, based on the request processing information, the first response content fed back by the target server for the second request is modified, achieving fine-grained modification of the first response content to the second response content that satisfies the configuration information, that is, a more accurate And more consistent with the expected response results.
- a request scheduling method disclosed in the embodiment of the present disclosure is first introduced in detail.
- the execution subject of the request scheduling method provided by the embodiment of the present disclosure is generally a computer device with certain computing capabilities.
- this request scheduling method can This is accomplished by invoking computer-readable instructions stored in memory by a processor.
- the following describes the request scheduling method provided by the embodiment of the present disclosure by taking the execution subject as a functional gateway as an example.
- a flow chart of a request scheduling method provided by an embodiment of the present disclosure may include the following steps:
- S101 Obtain the first request sent by the application client, and extract request context information from the first request; the request context information includes multiple pieces of request feature information.
- the application client can be a client running any application.
- any application for example, personal computers, browsers, terminal devices, etc.
- the above applications can be any application developed by developers. For example, video applications, learning applications, game applications, etc.
- the first request is a request for the application initiated by the application client. For example, a request to load the target screen, a request to use the target function, a request to display the target video, etc.
- the request context information includes a variety of request feature information, and different request feature information is used to characterize different features in the first request.
- the request characteristic information may include method characteristic information (method), routing characteristic information, request header information (header), body information (body), client address information, etc., wherein the routing characteristic information may include request domain name information (host ) and access path (path), the request header information can also include cookie information.
- the function gateway can perform feature extraction on the first request, and extract multiple requests such as method, header, body, host, path, cookie, client address, etc. Feature information, and then the extracted multiple request feature information can be stored as request context information corresponding to the first request.
- S102 Determine the target server and request processing information corresponding to the first request based on the obtained preconfigured routing configuration information and the routing feature information in the request context information.
- routing configuration information can be pre-configured in the functional gateway.
- the routing configuration information may include multiple routing configurations, each routing configuration corresponding to a request domain name (host), a preset access path (path) under the request domain name, and configuration information corresponding to the preset access path.
- the preset access paths under a requested domain name may include one or more, and different preset access paths may correspond to different configuration information.
- the configuration information may include server port information and IP address information corresponding to the preset access path, as well as request processing information (filter list configuration).
- the request processing information is used to process the request context information.
- the preset access path pair can be determined based on the server port information and IP address information.
- the corresponding server, server port information and IP address information are collectively called upstream.
- Each preset access path under a requested domain name is each path that may be accessed when accessing the domain name.
- the target server is the determined server that can process the first request.
- the request processing information corresponding to the first request is used to process the request context information corresponding to the first request.
- the function gateway can obtain the latest stored routing configuration information, and can filter out routing feature information from the request context information. Then, route matching can be performed based on the routing configuration information and the routing feature information to determine the configuration information corresponding to the routing feature information. Afterwards, the server corresponding to the upstream carried in the configuration information can be determined, the server is used as the target server, and the request processing information carried in the configuration information is used as the request processing information corresponding to the first request.
- S102 can be implemented according to the following steps:
- routing configurations included in the routing configuration information may be organized in a tree form, where the first level is host and the second level is path. For example, when the requested domain name is "example.com” and the paths are “/a” and “/b", the corresponding routing configuration expressed in json language is " ⁇ "example.com”: ⁇ "/a":data1, "/b”:data2 ⁇ ".
- the host in the routing feature information can be determined, and then based on the host, all preset access paths under the host are determined among multiple routing configurations included in the routing configuration information. For example, when the host is "example.com", all determined preset access paths may include "/a" and "/b".
- S102-2 From the preset access paths, determine each candidate access path that matches the target access path in the routing feature information.
- the path length corresponding to the candidate access path is less than or equal to the path length of the target access path.
- the target access path is the path carried in the routing feature information corresponding to the first request.
- each parent path corresponding to the target access path can be determined based on the target access path. For example, in the case where the target access path is "/a/b/c", the parent paths can be "/a/b/c", “/a/b”, “/a” and "/”.
- each parent path and target access path corresponding to the target access path can be matched with each preset access path under the requested domain name, and each candidate access path can be determined.
- the matched candidate access paths can be "/a/b", "/a" and "/”.
- S102-3 Determine the target configuration information corresponding to the candidate access path with the longest path length among each candidate access path, and determine the target server and request processing information from the target configuration information.
- the target configuration information is the configuration information corresponding to the candidate access path with the longest path length.
- the candidate access path "/a/b" with the longest path length can be configured accordingly.
- information as target configuration information.
- the upstream and request processing information (filter list configuration) corresponding to the first request can be extracted from the target configuration information, and the target server corresponding to the first request is determined based on the upstream.
- S103 Process the request context information according to the request processing information to obtain processed target context information.
- the partial request context information may be converted according to the conversion method for at least part of the request context information carried in the request processing information to obtain the target context information.
- the application client that initiated the first request belongs to the target user who can perform grayscale testing. If so, the request can be processed. method in the context information.
- S103 can be implemented according to the following steps: According to the request processing operation for the request context information in the first processing stage as indicated by the request processing information, process the request header information and/or client address in the request context information. The information is modified to obtain the target context information.
- the request processing information can indicate corresponding processing operations in multiple processing stages.
- the multiple processing stages may include a first processing stage for processing request context information (also called before_request stage), a second processing stage for checking request context information (also called before_proxy stage), and a processing stage for server feedback.
- the third processing stage for processing the response content also called the response_header stage
- the fourth processing stage for the first request after the response to the first request is completed also called the response_end stage.
- the before_request stage indicated by the filter list configuration can be executed, and the request header information and/or client in the request context information can be processed according to the request processing operations corresponding to the before_request stage indicated by the filter list configuration.
- the address information is modified to obtain the target context information. After obtaining the target context information, it is determined that the before_request phase is completed.
- the session ID carried in the request header information you can determine whether the Process the conversion method corresponding to the operation, convert the session ID into a user ID, and use the request header information carrying the user ID and other request feature information that has not been changed as the target context information.
- obtain the client address information parse the client address information according to the address resolution method corresponding to the request processing operation, and obtain the target address information. Afterwards, the target address information and other request characteristic information that have not been changed are used as the target context information.
- the filter list configuration can be set according to specific development needs.
- the set filter list configuration can be used to change any request feature information in the request context information, which is not limited by the embodiments of the present disclosure.
- the request context information when executing the before_request stage, the request context information may not be modified and the request context information may be directly used as the target context information.
- S104 Generate a second request based on the target context information, send the second request to the target server, and after obtaining the first response content fed back by the target server in response to the second request, process the first response content based on the request processing information, and The processed second response content is fed back to the application client as the response result of the first request.
- the second request is a request constructed by the functional gateway based on the target context information for proxying the first request.
- the response content for the second request fed back by the target server can be used as the response content corresponding to the first request.
- the processed second response content is the response content obtained after processing the first response content.
- the function gateway may construct the second request according to the target context information and send the second request to the target server. In another implementation, if the target context is unmodified request context information, the function gateway may also forward the first request directly to the target server as the second request.
- the target server can respond to the second request, obtain the first response content corresponding to the second request, and feed back the second response content to the functional gateway.
- the functional gateway may obtain the response header information carried in the first response content, and store the response header information as response context information.
- the first response content can also be directly used as the response context information.
- the function gateway can execute the response_header stage indicated by the filter list configuration, and process the first response content according to the processing operations corresponding to the response_header stage. For example, change the page color information carried in the response content, change the page size information carried in the response content Modify the information and so on. Further, the processed first response content may be used as the second response content, and the second response content may be fed back to the application client as the response result corresponding to the first request.
- the response_header stage may not be configured, that is, the first response content may not be processed, and the first response content may be directly used as the response result corresponding to the first request and fed back to the application client. .
- the response_header stage may not be executed, that is, the first response content may not be processed, and the first response content may be directly used as the response result corresponding to the first request. and feedback to the application client.
- the request context information can be modified to the target context information that satisfies the configuration information, and fine-grained updates to the target context can be achieved. Then generate a second request through the target context information, and send the second request to the target server for processing.
- the second request corresponds to the first request, and the target server is used to process the second request, that is, the second request is processed.
- a request is dispatched and processed in a timely manner. Finally, based on the request processing information, the first response content fed back by the target server for the second request is modified, achieving fine-grained modification of the first response content to the second response content that satisfies the configuration information, that is, a more accurate And more consistent with the expected response results.
- the request processing information may carry the target reception frequency corresponding to the target server when various methods are requested by application clients with different request identifiers.
- the target reception frequency may be, for example, 100 responses per minute for requests corresponding to method 1 and request identifier 1.
- the request ID can be a user ID, client ID, etc.
- the before_proxy stage can also be executed to implement a current limit check on the first request and determine whether the target server can respond to the first request corresponding to the second request.
- the request identifier and request method corresponding to the first request can be determined based on the target context information, that is, the method and method corresponding to the first request can be filtered out from the target context information. Furthermore, the request method corresponding to the first request and the target reception frequency of the request identifier by the target server may also be determined based on the request processing information.
- the current reception frequency may be the number of requests received within the time period indicated by the target reception frequency for requests that both match the request mode and request identifier corresponding to the first request.
- the request mode corresponding to the first request is method2
- the request identifier is identifier 2
- the target reception frequency is 10 times per minute
- the data corresponding to method2 and identifier has been received within one minute after the target reception frequency is determined. If the number of requests for 2 is 5, it can be determined that the current reception frequency is 5 times per minute.
- the current limit check operation for the first request in the before_proxy stage as indicated by the request processing information can be performed, that is, it is determined whether the current reception frequency is less than the target reception frequency. If yes, it is determined that the target server can respond to the second request corresponding to the first request. Then, a second request can be generated according to the target context information, and the second request can be sent to the target server.
- the target server cannot respond to the second request
- the first backup server indicated in the request processing information can be obtained.
- the first backup server is a back-up server.
- the second request can be sent to the first backup server, and the response content fed back by the first backup server after processing the response to the second request can be obtained.
- the response content can be processed based on the request processing information to obtain the processed content, and the processed content can be fed back to the application client.
- the response content fed back by the first backup server after processing the response to the second request can also be directly fed back to the application client.
- the step of processing the first response content based on the request processing information in S104 can also be implemented in any of two ways (way one and way two):
- Method 1 When it is determined that the status code carried in the first response content indicates that the response is abnormal, forward the second request to the second backup server, receive the third response content fed back by the second backup server, and use the third response content Update the first response content to obtain the second response content.
- the first response content may include response header information, status code, response date, file type (picture, page, video, etc.), target server identification and other information.
- Response header information is used to represent the purpose The feedback content of the second request provided by the server.
- the response header information can be page file information, function response information, etc.
- the status code is used to indicate whether the target server responded to the second request normally.
- the status code may be 404 indicating that the target server responded abnormally, 200 indicating that the target server responded successfully, 503 indicating that the target server is unavailable, etc.
- the second backup server may be the same as the first backup server, or may be different, which is not limited here.
- the operation of updating the first response content with the third response content to obtain the second response content may specifically be the operation of directly using the third response content as the second response content.
- the response_header stage can be executed, and the first response content can be parsed according to the response content checking operation corresponding to the response_header stage, and the status code and response header information in the first response content can be obtained. Afterwards, determine whether the status code indicates that the target server responded abnormally. If so, forward the second request to the second backup server, receive the third response content fed back by the second backup server, use the third response content as the second response content, and feed it back to the application client.
- the default second response content may be fed back to the application client.
- Method 2 When it is determined that the status code carried in the first response content indicates that the response is normal, the content update information carried in the request processing information can be used to change the response header information in the first response content, thereby obtaining the second Response content.
- the page content update information carried in the request processing information can be used to update the page content in the response context information (for example, graying out, changing colors, etc.) , thereby obtaining the updated response context information.
- the second response content can be generated, and the second response content can be fed back to the application client. In this way, flexible feedback to the first request can be achieved by usually changing the content of the first response and providing feedback.
- the first response content may be directly fed back to the application client without changing it.
- the response_end phase indicated by the filter list configuration may also be executed, based on the first request, the second request, the first response content and the second response content. At least one of, generates log information corresponding to the first request, and saves the log information.
- the response_end phase can also be executed to release the computing resources used when processing the first request. For example, release computing resources in the target server, release computing resources in the functional gateway source.
- the embodiment of the present disclosure also provides a method for pre-configuring routing configuration information. Specifically, it can be implemented according to the following steps:
- Step 1 Obtain the serialized routing configuration file sent by the configuration center; the routing configuration file is a file obtained by the configuration center after obtaining the routing configuration information for the application corresponding to the application client and serializing it.
- the configuration center is the control plane, and users can set routing configuration information for various applications in the configuration center.
- the configuration center can serialize the latest routing configuration information and serialize the latest routing configuration information. It is the routing configuration file that the functional gateway can store. The configuration center can then send the routing configuration file to the functional gateway.
- Step 2 Perform deserialization on the routing configuration file to obtain the restored routing configuration information, and use the routing configuration information to replace the historical routing configuration information.
- the functional gateway is also called the data plane.
- Historical routing configuration information can be routing configuration information stored in the functional gateway.
- the function gateway can perform a deserialization operation on the obtained routing configuration file to obtain restored routing configuration information.
- the routing configuration information can be stored in the functional gateway in the form of a structure to replace historical routing configuration information.
- the function gateway can obtain the target pointer address corresponding to the structure, and then use atomic operation instructions to replace the pointer address corresponding to the stored historical routing configuration information with the target pointer address, that is, utilizing the latest routing configuration information. Replace historical routing configuration information. . In this way, after receiving a new request subsequently, the latest routing configuration information indicated by the target pointer address can be used for routing matching.
- the pointer corresponding to the historical routing configuration information is Before the needle address is replaced with the target pointer address, a new request is received, and the new request will also use the latest routing configuration information corresponding to the target pointer address for routing matching.
- the functional gateway since the functional gateway does not need to be restarted, by storing the routing configuration information in the functional gateway, hot update of the routing configuration information corresponding to the application can be achieved. Compared with the existing technology, which requires restarting the application, the routing configuration information can be realized.
- the method of configuring routing configuration information provided by the embodiments of the present disclosure improves the timeliness and convenience of updating routing configuration information.
- a specific implementation flow chart of a request scheduling method provided by an embodiment of the present disclosure may include the following steps:
- S202 Determine the target server and request processing information based on the routing feature information in the routing configuration information and the request context information.
- S203 According to the request processing operation for the request context information in the first processing stage (before_request stage) indicated by the request processing information, modify the request context information to obtain the target context information.
- S204 Execute the current limit check operation for the first request in the second processing stage (before_proxy stage) indicated by the request processing information to determine whether the target server can respond to the second request.
- S205 Generate a second request according to the target context information, and send the second request to the first backup server.
- the response content fed back by the first backup server after processing the response to the second request can be obtained.
- the response content fed back by the first backup server After obtaining the response content fed back by the first backup server, it can be directly fed back to the application client, or S208 can be executed, and the response content obtained after executing S208 is fed back to the client.
- S206 Generate a second request according to the target context information, and send the second request to the target server.
- the content update information corresponding to the response_header stage is the content update information carried in the request processing information.
- the response header information in the response content fed back by the first backup server can be changed with the content update information, and the second response content is generated based on the changed response header information.
- S209 Feed back the second response content to the application client as the response result of the first request.
- S210 Execute the fourth processing stage (response_end stage) indicated by the request processing information, and generate log information corresponding to the first request based on the first request, the second request, the first response content and the second response content; and/or release The computing resources used to process the first request.
- the writing order of each step does not mean a strict execution order and does not constitute any limitation on the implementation process.
- the specific execution order of each step should be based on its function and possible The internal logic is determined.
- the embodiment of the present disclosure also provides a request scheduling device corresponding to the request scheduling method. Since the principle of solving the problem of the device in the embodiment of the present disclosure is similar to the above-mentioned request scheduling method in the embodiment of the present disclosure, the implementation of the device Please refer to the implementation of the method, and the repeated parts will not be repeated.
- a schematic diagram of a request scheduling device provided by an embodiment of the present disclosure includes:
- the acquisition module 301 is used to acquire the first request sent by the application client, and extract request context information from the first request; the request context information includes multiple pieces of request feature information;
- Determining module 302 configured to determine the target server and request processing information corresponding to the first request based on the obtained pre-configured routing configuration information and the routing feature information in the request context information;
- the first processing module 303 is configured to process the request context information according to the request processing information to obtain processed target context information;
- Sending module 304 configured to generate a second request according to the target context information, send the second request to the target server, and obtain the first response content fed back by the target server in response to the second request. , process the first response content based on the request processing information, and feed back the processed second response content to the application client as a response result of the first request.
- the first processing module 303 is configured to process the request according to the request. According to the request processing operation indicated by the processing information in the first processing stage for the request context information, the request header information and/or the client address information in the request context information are modified to obtain the target context information.
- the sending module 304 is further configured to determine the request identifier corresponding to the first request based on the target context information before sending the second request to the target server. and request mode, and based on the request processing information, determine the target reception frequency of the target server for the request mode and the request identification;
- the sending module 304 is further configured to determine that the target server cannot respond to the second request when it is determined that the current receiving frequency is not less than the target receiving frequency, and Send the second request to the first backup server indicated by the request processing information.
- the sending module 304 is configured to determine the status code carried in the first response content when processing the first response content based on the request processing information. If an abnormal response is indicated, forward the second request to the second backup server, receive the third response content fed back by the second backup server, and use the third response content to perform processing on the first response content. Update to obtain the second response content; or
- the content update information carried in the request processing information is used to change the response header information in the first response content to obtain the result. Describe the content of the second response.
- the device further includes:
- the second processing module 305 is configured to, after the processed second response content is fed back to the application client as the response result of the first request, based on the first request, the second request, The first response content and the second response content generate log information corresponding to the first request; and/or release computing resources used when processing the first request.
- the determination module 302 determines the target server corresponding to the first request and the request based on the obtained pre-configured routing configuration information and the routing feature information in the request context information. When processing information, it is used to determine the request domain in the routing feature information. Name, obtain each preset access path under the requested domain name from the routing configuration information;
- each candidate access path that matches the target access path in the routing feature information determines each candidate access path that matches the target access path in the routing feature information, and the path length corresponding to the candidate access path is less than or equal to the path length of the target access path;
- the device further includes:
- the configuration module 306 is configured to pre-configure the routing configuration information according to the following steps: obtain the serialized routing configuration file sent by the configuration center; wherein the routing configuration file is obtained by the configuration center for the application client. After obtaining the routing configuration information of the corresponding application on the end, serialize it to obtain the file;
- An embodiment of the present disclosure also provides a computer device. As shown in Figure 4, which is a schematic structural diagram of a computer device provided by an embodiment of the present disclosure, it includes:
- Processor 41 memory 42 and bus 43.
- the memory 42 stores machine-readable instructions executable by the processor 41
- the processor 41 is used to execute the machine-readable instructions stored in the memory 42 .
- the processor 41 executes The following steps: S101: Obtain the first request sent by the application client, and extract the request context information from the first request; the request context information includes multiple pieces of request feature information; S102: Based on the obtained pre-configured routing configuration information and request The routing feature information in the context information determines the target server and request processing information corresponding to the first request; S103: Process the request context information according to the request processing information to obtain the processed target context information; S104: Generate the third request based on the target context information.
- Second request send the second request to the target server, and after obtaining the first response content fed back by the target server in response to the second request, process the first response content based on the request processing information, and use the processed second response content as The response result of the first request is fed back to the application client.
- the above-mentioned memory 42 includes a memory 421 and an external memory 422; the memory 421 here is also called an internal memory, which is used to temporarily store the operation data in the processor 41, and is combined with an external memory 422 such as a hard disk.
- the processor 41 exchanges data with the external memory 422 through the memory 421.
- the processor 41 and the memory 42 communicate through the bus 43, so that the processor 41 performs the steps mentioned in the above method embodiment. and execution instructions.
- Embodiments of the present disclosure also provide a computer-readable storage medium.
- a computer program is stored on the computer-readable storage medium. When the computer program is run by a processor, the computer program executes the steps of the request scheduling method described in the above method embodiment.
- the storage medium may be a volatile or non-volatile computer-readable storage medium.
- the computer program product of the request scheduling method provided by the embodiment of the present disclosure includes a computer-readable storage medium storing program code.
- the instructions included in the program code can be used to execute the steps of the request scheduling method described in the above method embodiment. , please refer to the above method embodiments for details, and will not be described again here.
- the computer program product can be implemented specifically through hardware, software or a combination thereof.
- the computer program product is embodied as a computer storage medium.
- the computer program product is embodied as a software product, such as a Software Development Kit (SDK), etc. wait.
- SDK Software Development Kit
- the disclosed devices and methods can be implemented in other ways.
- the device embodiments described above are only illustrative.
- the division of the units is only a logical function division.
- multiple units or components may be combined.
- some features can be ignored, or not implemented.
- the coupling or direct coupling or communication connection between each other shown or discussed may be through some communication interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
- the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
- each functional unit in various embodiments of the present disclosure can be integrated into one processing unit, Each unit may exist physically alone, or two or more units may be integrated into one unit.
- the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor.
- the technical solution of the present disclosure is essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product.
- the computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present disclosure.
- the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program code. .
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Transfer Between Computers (AREA)
- Computer And Data Communications (AREA)
Abstract
Provided in the present disclosure are a request scheduling method and apparatus, and a computer device and a storage medium. The method comprises: acquiring a first request, which is sent by an application client, and extracting request context information from the first request, wherein the request context information comprises a plurality of pieces of request feature information, and the request feature information comprises routing feature information; on the basis of acquired pre-configured routing configuration information, and the routing feature information in the request context information, determining a target server and request processing information, which correspond to the first request; processing the request context information according to the request processing information, so as to obtain processed target context information; and generating a second request according to the target context information, sending the second request to the target server, acquiring first response content, which is fed back by the target server for the second request, then processing the first response content on the basis of the request processing information, and feeding processed second response content, as a response result of the first request, back to the application client.
Description
本申请要求于2022年4月6日提交中国国家知识产权局、申请号为202210356147.9、申请名称为“一种请求调度方法、装置、计算机设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application submitted to the State Intellectual Property Office of China on April 6, 2022, with application number 202210356147.9 and the application title "A request scheduling method, device, computer equipment and storage medium", all of which The contents are incorporated into this application by reference.
本公开涉及计算机技术领域,具体而言,涉及一种请求调度方法、装置、计算机设备和存储介质。The present disclosure relates to the field of computer technology, and specifically, to a request scheduling method, device, computer equipment and storage medium.
在接收到应用请求之后,需要将应用请求调度到对应的应用服务器中,利用应用服务器对应用请求进行处理并返回处理结果。而当前的流量调度方式在进行请求调度时,仅依赖于请求中单一的特征信息进行,请求调度的粒度较粗,调度效果较差。After receiving the application request, the application request needs to be scheduled to the corresponding application server, and the application server is used to process the application request and return the processing result. However, the current traffic scheduling method only relies on a single feature information in the request when scheduling requests. The granularity of request scheduling is coarse and the scheduling effect is poor.
发明内容Contents of the invention
本公开实施例至少提供一种请求调度方法、装置、计算机设备和存储介质。Embodiments of the present disclosure provide at least a request scheduling method, device, computer device, and storage medium.
第一方面,本公开实施例提供了一种请求调度方法,包括:In a first aspect, embodiments of the present disclosure provide a request scheduling method, including:
获取应用客户端发送的第一请求,并从所述第一请求中提取请求上下文信息;所述请求上下文信息包括多条请求特征信息,所述请求特征信息包括路由特征信息;Obtain the first request sent by the application client, and extract request context information from the first request; the request context information includes multiple pieces of request feature information, and the request feature information includes routing feature information;
基于获取的预先配置的路由配置信息和所述请求上下文信息中的路由特征信息,确定所述第一请求对应的目标服务器和请求处理信息;Determine the target server and request processing information corresponding to the first request based on the obtained preconfigured routing configuration information and the routing feature information in the request context information;
根据所述请求处理信息对所述请求上下文信息进行处理,得到处理后的目标上下文信息;Process the request context information according to the request processing information to obtain processed target context information;
根据所述目标上下文信息生成第二请求,将所述第二请求发送至所述目标服务器,并在获取所述目标服务器针对所述第二请求反馈的第一响应内容后,基于所述请求处理信息对所述第一响应内容进行处理,将处理后的第二响应内容作为所述第一请求的响应结果反馈给所述应用客户端。Generate a second request according to the target context information, send the second request to the target server, and after obtaining the first response content fed back by the target server in response to the second request, process the request based on the The information processes the first response content, and feeds the processed second response content back to the application client as a response result of the first request.
在一种可能的实施方式,所述根据所述请求处理信息对所述请求上下文信息进行处理,得到处理后的目标上下文信息,包括:In a possible implementation, the request context information is processed according to the request processing information to obtain processed target context information, including:
按照所述请求处理信息指示的、在第一处理阶段针对所述请求上下文信息的请求处理操作,对所述请求上下信息中的请求头信息和/或客户端地址信息
进行修改,得到所述目标上下文信息。According to the request processing operation for the request context information in the first processing stage as indicated by the request processing information, the request header information and/or client address information in the request context information Make modifications to obtain the target context information.
在一种可能的实施方式,在将所述第二请求发送至所述目标服务器之前,还包括:In a possible implementation, before sending the second request to the target server, the method further includes:
基于所述目标上下文信息,确定所述第一请求对应的请求标识和请求方式,并基于所述请求处理信息,确定所述目标服务器针对所述请求方式和所述请求标识的目标接收频率;Based on the target context information, determine the request identification and request method corresponding to the first request, and based on the request processing information, determine the target reception frequency of the target server for the request method and the request identification;
确定与所述请求方式和所述请求标识均匹配的请求的当前接收频率,并执行所述请求处理信息指示的、在第二处理阶段针对所述第一请求的限流检查操作,确定所述当前接收频率是否小于所述目标接收频率;Determine the current reception frequency of requests that match both the request mode and the request identification, and perform a current limit check operation for the first request in the second processing stage indicated by the request processing information, and determine the Whether the current receiving frequency is smaller than the target receiving frequency;
若所述当前接收频率小于所述目标接收频率,确定所述目标服务器能够响应所述第二请求。If the current reception frequency is less than the target reception frequency, it is determined that the target server can respond to the second request.
在一种可能的实施方式,所述方法还包括:In a possible implementation, the method further includes:
在确定所述当前接收频率不小于所述目标接收频率的情况下,确定所述目标服务器无法响应所述第二请求,并将所述第二请求发送至所述请求处理信息指示的第一备用服务器。When it is determined that the current reception frequency is not less than the target reception frequency, it is determined that the target server cannot respond to the second request, and the second request is sent to the first backup indicated by the request processing information. server.
在一种可能的实施方式,所述基于所述请求处理信息对所述第一响应内容进行处理,包括:In a possible implementation, processing the first response content based on the request processing information includes:
在确定所述第一响应内容中携带的状态码指示响应异常的情况下,将所述第二请求转发至第二备用服务器,并接收所述第二备用服务器反馈的第三响应内容,利用所述第三响应内容对所述第一响应内容进行更新,得到所述第二响应内容;或When it is determined that the status code carried in the first response content indicates that the response is abnormal, forward the second request to the second backup server, receive the third response content fed back by the second backup server, and use the The third response content updates the first response content to obtain the second response content; or
在确定所述第一响应内容中携带的状态码指示响应正常的情况下,利用所述请求处理信息中携带的内容更新信息,对所述第一响应内容中的响应头信息进行更改,得到所述第二响应内容。When it is determined that the status code carried in the first response content indicates that the response is normal, the content update information carried in the request processing information is used to change the response header information in the first response content to obtain the result. Describe the content of the second response.
在一种可能的实施方式,在所述将处理后的第二响应内容作为所述第一请求的响应结果反馈给所述应用客户端之后,还包括:In a possible implementation, after the processed second response content is fed back to the application client as a response result of the first request, the method further includes:
基于所述第一请求、所述第二请求、所述第一响应内容和所述第二响应内容,生成所述第一请求对应的日志信息;和/或,释放处理第一请求时所使用的计算资源。Based on the first request, the second request, the first response content and the second response content, generate log information corresponding to the first request; and/or release the information used when processing the first request. computing resources.
在一种可能的实施方式,所述基于获取的预先配置的路由配置信息和所述
请求上下文信息中的路由特征信息,确定所述第一请求对应的目标服务器和请求处理信息,包括:In a possible implementation, the obtained pre-configured routing configuration information and the The routing feature information in the request context information determines the target server and request processing information corresponding to the first request, including:
根据所述路由特征信息中的请求域名,从所述路由配置信息中获取在所述请求域名下的各个预设访问路径;According to the requested domain name in the routing feature information, obtain each preset access path under the requested domain name from the routing configuration information;
从所述预设访问路径中,确定与所述路由特征信息中的目标访问路径相匹配的各个候选访问路径,所述候选访问路径对应的路径长度小于或等于所述目标访问路径的路径长度;From the preset access paths, determine each candidate access path that matches the target access path in the routing feature information, and the path length corresponding to the candidate access path is less than or equal to the path length of the target access path;
确定各个所述候选访问路径中,路径长度最长的候选访问路径对应的目标配置信息,并从所述目标配置信息中确定所述目标服务器和所述请求处理信息。Determine the target configuration information corresponding to the candidate access path with the longest path length among each of the candidate access paths, and determine the target server and the request processing information from the target configuration information.
在一种可能的实施方式,所述方法还包括预先配置所述路由配置信息的步骤:In a possible implementation, the method further includes the step of pre-configuring the routing configuration information:
获取配置中心发送的序列化处理后的路由配置文件;其中,所述路由配置文件为所述配置中心在获取针对所述应用客户端对应的应用的路由配置信息后,对其序列化处理得到的文件;Obtain the serialized routing configuration file sent by the configuration center; wherein the routing configuration file is obtained by serialization processing after the configuration center obtains the routing configuration information for the application corresponding to the application client. document;
对所述路由配置文件执行反序列化处理操作,得到还原后的所述路由配置信息,并利用所述路由配置信息替换历史路由配置信息。Perform a deserialization operation on the routing configuration file to obtain the restored routing configuration information, and use the routing configuration information to replace historical routing configuration information.
第二方面,本公开实施例还提供一种请求调度装置,包括:In a second aspect, an embodiment of the present disclosure also provides a request scheduling device, including:
获取模块,用于获取应用客户端发送的第一请求,并从所述第一请求中提取请求上下文信息;所述请求上下文信息包括多条请求特征信息,所述请求特征信息包括路由特征信息;An acquisition module, configured to acquire the first request sent by the application client, and extract request context information from the first request; the request context information includes multiple pieces of request feature information, and the request feature information includes routing feature information;
确定模块,用于基于获取的预先配置的路由配置信息和所述请求上下文信息中的路由特征信息,确定所述第一请求对应的目标服务器和请求处理信息;A determination module configured to determine the target server and request processing information corresponding to the first request based on the obtained preconfigured routing configuration information and the routing feature information in the request context information;
第一处理模块,用于根据所述请求处理信息对所述请求上下文信息进行处理,得到处理后的目标上下文信息;A first processing module, configured to process the request context information according to the request processing information to obtain processed target context information;
发送模块,用于根据所述目标上下文信息生成第二请求,将所述第二请求发送至所述目标服务器,并在获取所述目标服务器针对所述第二请求反馈的第一响应内容后,基于所述请求处理信息对所述第一响应内容进行处理,将处理后的第二响应内容作为所述第一请求的响应结果反馈给所述应用客户端。A sending module, configured to generate a second request according to the target context information, send the second request to the target server, and after obtaining the first response content fed back by the target server in response to the second request, The first response content is processed based on the request processing information, and the processed second response content is fed back to the application client as a response result of the first request.
在一种可能的实施方式中,所述第一处理模块,用于按照所述请求处理信息指示的、在第一处理阶段针对所述请求上下文信息的请求处理操作,对所述
请求上下信息中的请求头信息和/或客户端地址信息进行修改,得到所述目标上下文信息。In a possible implementation, the first processing module is configured to perform the request processing operation on the request context information in the first processing stage as indicated by the request processing information. Modify the request header information and/or client address information in the request context information to obtain the target context information.
在一种可能的实施方式中,所述发送模块,在将所述第二请求发送至所述目标服务器之前,还用于基于所述目标上下文信息,确定所述第一请求对应的请求标识和请求方式,并基于所述请求处理信息,确定所述目标服务器针对所述请求方式和所述请求标识的目标接收频率;In a possible implementation, the sending module, before sending the second request to the target server, is further configured to determine, based on the target context information, the request identifier corresponding to the first request and Request mode, and based on the request processing information, determine the target reception frequency of the target server for the request mode and the request identification;
确定与所述请求方式和所述请求标识均匹配的请求的当前接收频率,并执行所述请求处理信息指示的、在第二处理阶段针对所述第一请求的限流检查操作,确定所述当前接收频率是否小于所述目标接收频率;Determine the current reception frequency of requests that match both the request mode and the request identification, and perform a current limit check operation for the first request in the second processing stage indicated by the request processing information, and determine the Whether the current receiving frequency is smaller than the target receiving frequency;
若所述当前接收频率小于所述目标接收频率,确定所述目标服务器能够响应所述第二请求。If the current reception frequency is less than the target reception frequency, it is determined that the target server can respond to the second request.
在一种可能的实施方式中,所述发送模块,还用于在确定所述当前接收频率不小于所述目标接收频率的情况下,确定所述目标服务器无法响应所述第二请求,并将所述第二请求发送至所述请求处理信息指示的第一备用服务器。In a possible implementation, the sending module is further configured to determine that the target server cannot respond to the second request, and determine that the current receiving frequency is not less than the target receiving frequency. The second request is sent to the first backup server indicated by the request processing information.
在一种可能的实施方式中,所述发送模块,在所述基于所述请求处理信息对所述第一响应内容进行处理时,用于在确定所述第一响应内容中携带的状态码指示响应异常的情况下,将所述第二请求转发至第二备用服务器,并接收所述第二备用服务器反馈的第三响应内容,利用所述第三响应内容对所述第一响应内容进行更新,得到所述第二响应内容;或In a possible implementation, the sending module, when processing the first response content based on the request processing information, is configured to determine the status code indication carried in the first response content. If the response is abnormal, forward the second request to the second backup server, receive the third response content fed back by the second backup server, and use the third response content to update the first response content. , obtain the second response content; or
在确定所述第一响应内容中携带的状态码指示响应正常的情况下,利用所述请求处理信息中携带的内容更新信息,对所述第一响应内容中的响应头信息进行更改,得到所述第二响应内容。When it is determined that the status code carried in the first response content indicates that the response is normal, the content update information carried in the request processing information is used to change the response header information in the first response content to obtain the result. Describe the content of the second response.
在一种可能的实施方式中,所述装置还包括:In a possible implementation, the device further includes:
第二处理模块,用于在所述将处理后的第二响应内容作为所述第一请求的响应结果反馈给所述应用客户端之后,基于所述第一请求、所述第二请求、所述第一响应内容和所述第二响应内容,生成所述第一请求对应的日志信息;和/或,释放处理第一请求时所使用的计算资源。The second processing module is configured to, after the processed second response content is fed back to the application client as the response result of the first request, based on the first request, the second request, and the The first response content and the second response content are used to generate log information corresponding to the first request; and/or, the computing resources used in processing the first request are released.
在一种可能的实施方式中,所述确定模块在所述基于获取的预先配置的路由配置信息和所述请求上下文信息中的路由特征信息,确定所述第一请求对应的目标服务器和请求处理信息时,用于根据所述路由特征信息中的请求域名,
从所述路由配置信息中获取在所述请求域名下的各个预设访问路径;In a possible implementation, the determination module determines the target server and request processing corresponding to the first request based on the obtained pre-configured routing configuration information and the routing feature information in the request context information. information, used to based on the requested domain name in the routing feature information, Obtain each preset access path under the requested domain name from the routing configuration information;
从所述预设访问路径中,确定与所述路由特征信息中的目标访问路径相匹配的各个候选访问路径,所述候选访问路径对应的路径长度小于或等于所述目标访问路径的路径长度;From the preset access paths, determine each candidate access path that matches the target access path in the routing feature information, and the path length corresponding to the candidate access path is less than or equal to the path length of the target access path;
确定各个所述候选访问路径中,路径长度最长的候选访问路径对应的目标配置信息,并从所述目标配置信息中确定所述目标服务器和所述请求处理信息。Determine the target configuration information corresponding to the candidate access path with the longest path length among each of the candidate access paths, and determine the target server and the request processing information from the target configuration information.
在一种可能的实施方式中,所述装置还包括:In a possible implementation, the device further includes:
配置模块,用于按照以下步骤预先配置所述路由配置信息:获取配置中心发送的序列化处理后的路由配置文件;其中,所述路由配置文件为所述配置中心在获取针对所述应用客户端对应的应用的路由配置信息后,对其序列化处理得到的文件;A configuration module configured to pre-configure the routing configuration information according to the following steps: obtain the serialized routing configuration file sent by the configuration center; wherein the routing configuration file is obtained by the configuration center for the application client After routing configuration information of the corresponding application, serialize the resulting file;
对所述路由配置文件执行反序列化处理操作,得到还原后的所述路由配置信息,并利用所述路由配置信息替换历史路由配置信息。Perform a deserialization operation on the routing configuration file to obtain the restored routing configuration information, and use the routing configuration information to replace historical routing configuration information.
第三方面,本公开可选实现方式还提供一种计算机设备,处理器、存储器,所述存储器存储有所述处理器可执行的机器可读指令,所述处理器用于执行所述存储器中存储的机器可读指令,所述机器可读指令被所述处理器执行时,所述机器可读指令被所述处理器执行时执行上述第一方面,或第一方面中任一种可能的实施方式中的步骤。In a third aspect, an optional implementation manner of the present disclosure also provides a computer device, a processor, and a memory. The memory stores machine-readable instructions executable by the processor, and the processor is configured to execute the instructions stored in the memory. Machine-readable instructions, when the machine-readable instructions are executed by the processor, when the machine-readable instructions are executed by the processor, the above-mentioned first aspect, or any possible implementation of the first aspect, is executed. steps in the way.
第四方面,本公开可选实现方式还提供一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,该计算机程序被运行时执行上述第一方面,或第一方面中任一种可能的实施方式中的步骤。In a fourth aspect, an optional implementation manner of the present disclosure also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is run, it executes the above-mentioned first aspect, or any of the first aspects. steps in a possible implementation.
关于上述请求调度装置、计算机设备、及计算机可读存储介质的效果描述参见上述请求调度方法的说明,这里不再赘述。For a description of the effects of the above-mentioned request scheduling device, computer equipment, and computer-readable storage medium, please refer to the description of the above-mentioned request scheduling method, and will not be described again here.
本公开实施例提供的请求调度方法、装置、计算机设备和存储介质,通过在第一请求中提取请求上下文信息的方式,可以得到多条能够用于请求调度的请求特征信息,进而依赖包含丰富信息的请求上下文信息进行请求调度,能够实现细粒度的请求调度,提高请求调度的准确性。利用预先配置的路由配置信息中配置的请求处理信息,对请求上下文信息进行处理,能够实现将请求上下文信息修改为满足配置信息的目标上下文信息,实现了对目标上下文的细粒度更新。再通过目标上下文信息生成第二请求,并将所述第二请求发送至目标服
务器进行处理的方式,第二请求对应于第一请求,利用目标服务器对第二请求处理,也即实现了对第一请求进行及时地调度处理。最后,基于请求处理信息,对目标服务器针对第二请求反馈的第一响应内容进行修改,实现了细粒度地将第一响应内容修改为满足配置信息的第二响应内容,也即得到了更准确且更符合预期的响应结果。The request scheduling method, device, computer equipment and storage medium provided by the embodiments of the present disclosure can obtain multiple pieces of request feature information that can be used for request scheduling by extracting the request context information in the first request, thereby relying on rich information. The request context information is used for request scheduling, which can realize fine-grained request scheduling and improve the accuracy of request scheduling. Using the request processing information configured in the preconfigured routing configuration information to process the request context information, the request context information can be modified to the target context information that satisfies the configuration information, and fine-grained updates to the target context can be achieved. Then generate a second request based on the target context information, and send the second request to the target server. The second request corresponds to the first request, and the target server is used to process the second request, that is, the first request is scheduled and processed in a timely manner. Finally, based on the request processing information, the first response content fed back by the target server for the second request is modified, achieving fine-grained modification of the first response content to the second response content that satisfies the configuration information, that is, a more accurate And more consistent with the expected response results.
为使本公开的上述目的、特征和优点能更明显易懂,下文特举较佳实施例,并配合所附附图,作详细说明如下。In order to make the above-mentioned objects, features and advantages of the present disclosure more obvious and understandable, preferred embodiments are given below and described in detail with reference to the accompanying drawings.
为了更清楚地说明本公开实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,此处的附图被并入说明书中并构成本说明书中的一部分,这些附图示出了符合本公开的实施例,并与说明书一起用于说明本公开的技术方案。应当理解,以下附图仅示出了本公开的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to explain the technical solutions of the embodiments of the present disclosure more clearly, the drawings required to be used in the embodiments will be briefly introduced below. The drawings here are incorporated into the specification and constitute a part of this specification. These drawings are The drawings illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure, and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, without exerting creative efforts, they can also Other relevant drawings are obtained based on these drawings.
图1示出了本公开实施例所提供的一种请求调度方法的流程图;Figure 1 shows a flow chart of a request scheduling method provided by an embodiment of the present disclosure;
图2示出了本公开实施例所提供的一种请求调度方法的具体实施流程图;Figure 2 shows a specific implementation flow chart of a request scheduling method provided by an embodiment of the present disclosure;
图3示出了本公开实施例所提供的一种请求调度装置的示意图;Figure 3 shows a schematic diagram of a request scheduling device provided by an embodiment of the present disclosure;
图4示出了本公开实施例所提供的一种计算机设备结构示意图。FIG. 4 shows a schematic structural diagram of a computer device provided by an embodiment of the present disclosure.
为使本公开实施例的目的、技术方案和优点更加清楚,下面将结合本公开实施例中附图,对本公开实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本公开一部分实施例,而不是全部的实施例。通常在此处描述和示出的本公开实施例的组件可以以各种不同的配置来布置和设计。因此,以下对本公开的实施例的详细描述并非旨在限制要求保护的本公开的范围,而是仅仅表示本公开的选定实施例。基于本公开的实施例,本领域技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本公开保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only These are some embodiments of the present disclosure, but not all embodiments. The components of the disclosed embodiments generally described and illustrated herein may be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of the disclosure is not intended to limit the scope of the claimed disclosure, but rather to represent selected embodiments of the disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without any creative efforts shall fall within the scope of protection of the present disclosure.
另外,本公开实施例中的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够
以除了在这里图示或描述的内容以外的顺序实施。In addition, the terms "first", "second", etc. in the description and claims of the embodiments of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that data so used may be interchanged where appropriate so that the embodiments described herein can in sequences other than those illustrated or described herein.
在本文中提及的“多个或者若干个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。字符“/”一般表示前后关联对象是一种“或”的关系。The "multiple or several" mentioned in this article means two or more. "And/or" describes the relationship between related objects, indicating that there can be three relationships. For example, A and/or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the related objects are in an "or" relationship.
经研究发现,网关在获取到应用请求后,仅利用应用请求中的路由特征信息进行请求调度。具体的,网关利用路由特征信息确定可接收应用请求的服务器,再将应用请求调度至服务器,即实现了应用请求的调度。但仅依赖路由特征信息进行请求调度,存在请求调度的粒度较粗,调度效果较差的问题。After research, it was found that after obtaining the application request, the gateway only uses the routing feature information in the application request to schedule the request. Specifically, the gateway uses the routing feature information to determine the server that can receive the application request, and then schedules the application request to the server, thereby realizing the scheduling of the application request. However, relying only on routing feature information for request scheduling has the problem of coarser granularity of request scheduling and poor scheduling effect.
基于上述研究,本公开提供了一种请求调度方案,通过在第一请求中提取请求上下文信息的方式,可以得到多条能够用于请求调度的请求特征信息,进而依赖包含丰富信息的请求上下文信息进行请求调度,能够实现细粒度的请求调度,提高请求调度的准确性。利用预先配置的路由配置信息中配置的请求处理信息,对请求上下文信息进行处理,能够实现将请求上下文信息修改为满足配置信息的目标上下文信息,实现了对目标上下文的细粒度更新。再通过目标上下文信息生成第二请求,并将所述第二请求发送至目标服务器进行处理的方式,第二请求对应于第一请求,利用目标服务器对第二请求处理,也即实现了对第一请求进行及时地调度处理。最后,基于请求处理信息,对目标服务器针对第二请求反馈的第一响应内容进行修改,实现了细粒度地将第一响应内容修改为满足配置信息的第二响应内容,也即得到了更准确且更符合预期的响应结果。Based on the above research, the present disclosure provides a request scheduling solution. By extracting the request context information in the first request, multiple pieces of request feature information that can be used for request scheduling can be obtained, and then rely on the request context information containing rich information. Request scheduling can achieve fine-grained request scheduling and improve the accuracy of request scheduling. Using the request processing information configured in the preconfigured routing configuration information to process the request context information, the request context information can be modified to the target context information that satisfies the configuration information, and fine-grained updates to the target context can be achieved. Then generate a second request through the target context information, and send the second request to the target server for processing. The second request corresponds to the first request, and the target server is used to process the second request, that is, the second request is processed. A request is dispatched and processed in a timely manner. Finally, based on the request processing information, the first response content fed back by the target server for the second request is modified, achieving fine-grained modification of the first response content to the second response content that satisfies the configuration information, that is, a more accurate And more consistent with the expected response results.
针对以上方案所存在的缺陷,均是发明人在经过实践并仔细研究后得出的结果,因此,上述问题的发现过程以及下文中本公开针对上述问题所提出的解决方案,都应该是发明人在本公开过程中对本公开做出的贡献。The defects in the above solutions are all the results obtained by the inventor after practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed by the present disclosure to the above problems below should be attributed to the inventor. Contributions made during the course of this disclosure.
应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步定义和解释。It should be noted that similar reference numerals and letters represent similar items in the following figures, therefore, once an item is defined in one figure, it does not need further definition and explanation in subsequent figures.
为便于对本实施例进行理解,首先对本公开实施例所公开的一种请求调度方法进行详细介绍,本公开实施例所提供的请求调度方法的执行主体一般为具有一定计算能力的计算机设备,在一些可能的实现方式中,该请求调度方法可
以通过处理器调用存储器中存储的计算机可读指令的方式来实现。In order to facilitate understanding of this embodiment, a request scheduling method disclosed in the embodiment of the present disclosure is first introduced in detail. The execution subject of the request scheduling method provided by the embodiment of the present disclosure is generally a computer device with certain computing capabilities. In some cases, Among possible implementations, this request scheduling method can This is accomplished by invoking computer-readable instructions stored in memory by a processor.
下面以执行主体为功能网关为例对本公开实施例提供的请求调度方法加以说明。The following describes the request scheduling method provided by the embodiment of the present disclosure by taking the execution subject as a functional gateway as an example.
如图1所示,为本公开实施例提供的一种请求调度方法的流程图,可以包括以下步骤:As shown in Figure 1, a flow chart of a request scheduling method provided by an embodiment of the present disclosure may include the following steps:
S101:获取应用客户端发送的第一请求,并从第一请求中提取请求上下文信息;请求上下文信息包括多条请求特征信息。S101: Obtain the first request sent by the application client, and extract request context information from the first request; the request context information includes multiple pieces of request feature information.
这里,应用客户端可以为运行任一应用的客户端。例如,个人电脑、浏览器、终端设备等。上述应用可以为开发人员开发好的任一应用。例如,视频应用、学习应用、游戏应用等。Here, the application client can be a client running any application. For example, personal computers, browsers, terminal devices, etc. The above applications can be any application developed by developers. For example, video applications, learning applications, game applications, etc.
第一请求为应用客户端发起的针对应用的请求。例如,加载目标画面的请求、使用目标功能的请求、展示目标视频的请求等。The first request is a request for the application initiated by the application client. For example, a request to load the target screen, a request to use the target function, a request to display the target video, etc.
请求上下文信息包括多种请求特征信息,不同的请求特征信息用于表征第一请求中的不同特征。具体的,请求特征信息可以包括方法特征信息(method)、路由特征信息、请求头信息(header)、主体信息(body)、客户端地址信息等,其中,路由特征信息可以包括请求域名信息(host)和访问路径(path),请求头信息中还可以包括cookie信息。The request context information includes a variety of request feature information, and different request feature information is used to characterize different features in the first request. Specifically, the request characteristic information may include method characteristic information (method), routing characteristic information, request header information (header), body information (body), client address information, etc., wherein the routing characteristic information may include request domain name information (host ) and access path (path), the request header information can also include cookie information.
具体实施时,功能网关在接收到应用客户端发送的第一请求之后,可以对第一请求进行特征提取,从中提取出method、header、body、host、path、cookie、客户端地址等多种请求特征信息,之后,可以将提取的上述多种请求特征信息存储为第一请求对应的请求上下文信息。During specific implementation, after receiving the first request sent by the application client, the function gateway can perform feature extraction on the first request, and extract multiple requests such as method, header, body, host, path, cookie, client address, etc. Feature information, and then the extracted multiple request feature information can be stored as request context information corresponding to the first request.
S102:基于获取的预先配置的路由配置信息和请求上下文信息中的路由特征信息,确定第一请求对应的目标服务器和请求处理信息。S102: Determine the target server and request processing information corresponding to the first request based on the obtained preconfigured routing configuration information and the routing feature information in the request context information.
这里,路由配置信息可以预先配置在功能网关中。路由配置信息中可以包括多条路由配置,每条路由配置对应于一个请求域名(host)、该请求域名下的预设访问路径(path),以及预设访问路径对应的配置信息。一个请求域名下的预设访问路径可以包括一个或多个,不同的预设访问路径可以对应于不同的配置信息。配置信息中可以包括预设访问路径对应的服务器端口信息和IP地址信息,以及请求处理信息(filter列表配置)。请求处理信息用于对请求上下文信息进行处理,根据服务器端口信息和IP地址信息可以确定预设访问路径对
应的服务器,服务器端口信息和IP地址信息统称为upstream。Here, routing configuration information can be pre-configured in the functional gateway. The routing configuration information may include multiple routing configurations, each routing configuration corresponding to a request domain name (host), a preset access path (path) under the request domain name, and configuration information corresponding to the preset access path. The preset access paths under a requested domain name may include one or more, and different preset access paths may correspond to different configuration information. The configuration information may include server port information and IP address information corresponding to the preset access path, as well as request processing information (filter list configuration). The request processing information is used to process the request context information. The preset access path pair can be determined based on the server port information and IP address information. The corresponding server, server port information and IP address information are collectively called upstream.
一个请求域名下的各个预设访问路径为在访问该域名的情况下,可能访问的各个路径。Each preset access path under a requested domain name is each path that may be accessed when accessing the domain name.
目标服务器即为确定出的可以对第一请求进行处理的服务器。第一请求对应的请求处理信息,用于对第一请求对应的请求上下文信息进行处理。The target server is the determined server that can process the first request. The request processing information corresponding to the first request is used to process the request context information corresponding to the first request.
具体实施时,功能网关可以获取存储的最新的路由配置信息,以及可以从请求上下文信息中筛选出路由特征信息。然后,可以基于路由配置信息和路由特征信息,进行路由匹配,以确定出路由特征信息对应的配置信息。之后,可以确定配置信息中携带的upstream对应的服务器,将该服务器作为目标服务器,将配置信息中携带的请求处理信息作为第一请求对应的请求处理信息。During specific implementation, the function gateway can obtain the latest stored routing configuration information, and can filter out routing feature information from the request context information. Then, route matching can be performed based on the routing configuration information and the routing feature information to determine the configuration information corresponding to the routing feature information. Afterwards, the server corresponding to the upstream carried in the configuration information can be determined, the server is used as the target server, and the request processing information carried in the configuration information is used as the request processing information corresponding to the first request.
在一种实施例中,S102可以按照以下步骤实施:In one embodiment, S102 can be implemented according to the following steps:
S102-1:根据路由特征信息中的请求域名,从路由配置信息中获取在请求域名下的各个预设访问路径。S102-1: According to the requested domain name in the routing feature information, obtain each preset access path under the requested domain name from the routing configuration information.
具体实施时,路由配置信息中包括的多条路由配置可以以树状形式组织,其中,第一级为host,第二级为path。例如,请求域名为“example.com”,path分别为“/a”和“/b”时,以json语言表示对应的路由配置为“{"example.com":{"/a":data1,"/b":data2}}”。During specific implementation, multiple routing configurations included in the routing configuration information may be organized in a tree form, where the first level is host and the second level is path. For example, when the requested domain name is "example.com" and the paths are "/a" and "/b", the corresponding routing configuration expressed in json language is "{"example.com":{"/a":data1, "/b":data2}}".
具体实施时,可以确定路由特征信息中的host,然后根据该host,在路由配置信息中包括的多条路由配置中,确定在该host下的全部预设访问路径。例如,在host为“example.com”的情况下,确定出的全部预设访问路径可以包括“/a”和“/b”。During specific implementation, the host in the routing feature information can be determined, and then based on the host, all preset access paths under the host are determined among multiple routing configurations included in the routing configuration information. For example, when the host is "example.com", all determined preset access paths may include "/a" and "/b".
S102-2:从预设访问路径中,确定与路由特征信息中的目标访问路径相匹配的各个候选访问路径,候选访问路径对应的路径长度小于或等于目标访问路径的路径长度。S102-2: From the preset access paths, determine each candidate access path that matches the target access path in the routing feature information. The path length corresponding to the candidate access path is less than or equal to the path length of the target access path.
这里,目标访问路径为第一请求对应的路由特征信息中携带的path。Here, the target access path is the path carried in the routing feature information corresponding to the first request.
具体实施时,可以根据目标访问路径,确定目标访问路径对应的各个父级path。例如,在目标访问路径为“/a/b/c”的情况下,父级path可以为“/a/b/c”、“/a/b”、“/a”和“/”。During specific implementation, each parent path corresponding to the target access path can be determined based on the target access path. For example, in the case where the target access path is "/a/b/c", the parent paths can be "/a/b/c", "/a/b", "/a" and "/".
进而,可以将目标访问路径对应的各个父级path和目标访问路径,分别与在请求域名下的各个预设访问路径进行匹配,确定出各个候选访问路径。例
如,匹配出的候选访问路径可以为“/a/b”、“/a”和“/”。Furthermore, each parent path and target access path corresponding to the target access path can be matched with each preset access path under the requested domain name, and each candidate access path can be determined. example For example, the matched candidate access paths can be "/a/b", "/a" and "/".
S102-3:确定各个候选访问路径中,路径长度最长的候选访问路径对应的目标配置信息,并从目标配置信息中确定目标服务器和请求处理信息。S102-3: Determine the target configuration information corresponding to the candidate access path with the longest path length among each candidate access path, and determine the target server and request processing information from the target configuration information.
这里,目标配置信息即为路径长度最长的候选访问路径对应的配置信息。Here, the target configuration information is the configuration information corresponding to the candidate access path with the longest path length.
示例性的,在匹配出的候选访问路径为“/a/b”、“/a”和“/”的情况下,可以将路径长度最长的候选访问路径“/a/b”对应的配置信息作为目标配置信息。进而,可以从目标配置信息中提取出第一请求对应的upstream和请求处理信息(filter列表配置),并基于upstream确定第一请求对应的目标服务器。For example, when the matched candidate access paths are "/a/b", "/a" and "/", the candidate access path "/a/b" with the longest path length can be configured accordingly. information as target configuration information. Furthermore, the upstream and request processing information (filter list configuration) corresponding to the first request can be extracted from the target configuration information, and the target server corresponding to the first request is determined based on the upstream.
S103:根据请求处理信息对请求上下文信息进行处理,得到处理后的目标上下文信息。S103: Process the request context information according to the request processing information to obtain processed target context information.
具体实施时,可以根据请求处理信息中携带的针对至少部分请求上下文信息的转换方式,对部分请求上下文信息进行转换,得到目标上下文信息。During specific implementation, the partial request context information may be converted according to the conversion method for at least part of the request context information carried in the request processing information to obtain the target context information.
示例性的,在灰度测试场景下,可以根据第一请求中携带的客户端标识,确定发起第一请求的应用客户端是否属于可进行灰度测试的目标用户,如果是,则可以对请求上下文信息中的method进行更改。For example, in a grayscale test scenario, it can be determined according to the client identifier carried in the first request whether the application client that initiated the first request belongs to the target user who can perform grayscale testing. If so, the request can be processed. method in the context information.
在一种实施例中,S103可以按照以下步骤实施:按照请求处理信息指示的、在第一处理阶段针对请求上下文信息的请求处理操作,对请求上下信息中的请求头信息和/或客户端地址信息进行修改,得到目标上下文信息。In one embodiment, S103 can be implemented according to the following steps: According to the request processing operation for the request context information in the first processing stage as indicated by the request processing information, process the request header information and/or client address in the request context information. The information is modified to obtain the target context information.
这里,请求处理信息即filter列表配置,可以指示有在多个处理阶段分别对应的处理操作。其中,多个处理阶段可以包括用于对请求上下文信息进行处理的第一处理阶段(也称before_request阶段),对请求上下文信息进行检查的第二处理阶段(也称before_proxy阶段),对服务器反馈的响应内容进行处理的第三处理阶段(也称response_header阶段),以及在第一请求响应完毕后针对第一请求的第四处理阶段(也称response_end阶段)。Here, the request processing information, that is, the filter list configuration, can indicate corresponding processing operations in multiple processing stages. Among them, the multiple processing stages may include a first processing stage for processing request context information (also called before_request stage), a second processing stage for checking request context information (also called before_proxy stage), and a processing stage for server feedback. The third processing stage for processing the response content (also called the response_header stage), and the fourth processing stage for the first request after the response to the first request is completed (also called the response_end stage).
具体实施时,在确定filter列表配置后,可以执行filter列表配置指示的before_request阶段,并按照filter列表配置指示的before_request阶段对应的请求处理操作,对请求上下信息中的请求头信息和/或客户端地址信息进行修改,得到目标上下文信息。在得到目标上下信息的情况下,确定before_request阶段执行完成。During specific implementation, after the filter list configuration is determined, the before_request stage indicated by the filter list configuration can be executed, and the request header information and/or client in the request context information can be processed according to the request processing operations corresponding to the before_request stage indicated by the filter list configuration. The address information is modified to obtain the target context information. After obtaining the target context information, it is determined that the before_request phase is completed.
例如,获取请求头信息携带的会话标识(session id),可以确定按照请求
处理操作对应的转换方式,将会话标识转换为用户标识,将携带用户标识的请求头信息以及未进行更改的其他请求特征信息,一起作为目标上下文信息。For example, by obtaining the session ID carried in the request header information, you can determine whether the Process the conversion method corresponding to the operation, convert the session ID into a user ID, and use the request header information carrying the user ID and other request feature information that has not been changed as the target context information.
又例如,获取客户端地址信息,按照请求处理操作对应的地址解析方式,对客户端地址信息进行解析,得到目标地址信息。之后,将目标地址信息和未进行更改的其他请求特征信息,一起作为目标上下文信息。For another example, obtain the client address information, parse the client address information according to the address resolution method corresponding to the request processing operation, and obtain the target address information. Afterwards, the target address information and other request characteristic information that have not been changed are used as the target context information.
需要说明的是,可以根据具体的开发需要对filter列表配置进行设置。在具体实施时,可以利用设置好的filter列表配置,对请求上下文信息中的任一请求特征信息进行更改,本公开实施例不进行限定。It should be noted that the filter list configuration can be set according to specific development needs. During specific implementation, the set filter list configuration can be used to change any request feature information in the request context information, which is not limited by the embodiments of the present disclosure.
可选的,如果请求上下文信息中的各个请求特征信息均满足预设特征条件,在执行before_request阶段时,可以不对请求上下文信息进行修改,直接将请求上下文信息作为目标上下文信息。Optionally, if each request feature information in the request context information satisfies the preset feature conditions, when executing the before_request stage, the request context information may not be modified and the request context information may be directly used as the target context information.
S104:根据目标上下文信息生成第二请求,将第二请求发送至目标服务器,并在获取目标服务器针对第二请求反馈的第一响应内容后,基于请求处理信息对第一响应内容进行处理,将处理后的第二响应内容作为第一请求的响应结果反馈给应用客户端。S104: Generate a second request based on the target context information, send the second request to the target server, and after obtaining the first response content fed back by the target server in response to the second request, process the first response content based on the request processing information, and The processed second response content is fed back to the application client as the response result of the first request.
这里,第二请求为功能网关根据目标上下文信息,构造的用于代理第一请求的请求。目标服务器反馈的针对第二请求的响应内容,可以作为第一请求对应的响应内容。处理后的第二响应内容为对第一响应内容进行处理后得到的响应内容。Here, the second request is a request constructed by the functional gateway based on the target context information for proxying the first request. The response content for the second request fed back by the target server can be used as the response content corresponding to the first request. The processed second response content is the response content obtained after processing the first response content.
具体实施时,功能网关可以根据目标上下文信息,构造第二请求并将第二请求发送至目标服务器。在另一种实施方式中,如果目标上下文为未修改的请求上下文信息,则功能网关也可以将第一请求直接作为第二请求转发至目标服务器。During specific implementation, the function gateway may construct the second request according to the target context information and send the second request to the target server. In another implementation, if the target context is unmodified request context information, the function gateway may also forward the first request directly to the target server as the second request.
之后,目标服务器可以对第二请求进行响应处理,得到第二请求对应的第一响应内容,并将第二响应内容反馈给功能网关。功能网关在得到第一响应内容后,可以获取第一响应内容中携带的响应头信息,并将响应头信息存储为响应上下文信息。或者,也可以直接将第一响应内容作为响应上下文信息。Afterwards, the target server can respond to the second request, obtain the first response content corresponding to the second request, and feed back the second response content to the functional gateway. After obtaining the first response content, the functional gateway may obtain the response header information carried in the first response content, and store the response header information as response context information. Alternatively, the first response content can also be directly used as the response context information.
然后,功能网关可以执行filter列表配置指示的response_header阶段,并按照response_header阶段对应的处理操作,对第一响应内容进行处理。例如,对响应内容中携带的页面颜色信息进行更改,对响应内容中携带的页面尺寸信
息进行修改等等。进一步的,可以将处理后的第一响应内容作为第二响应内容,并将第二响应内容作为第一请求对应的响应结果反馈给应用客户端。Then, the function gateway can execute the response_header stage indicated by the filter list configuration, and process the first response content according to the processing operations corresponding to the response_header stage. For example, change the page color information carried in the response content, change the page size information carried in the response content Modify the information and so on. Further, the processed first response content may be used as the second response content, and the second response content may be fed back to the application client as the response result corresponding to the first request.
在一种可选的实施方式中,也可以不配置response_header阶段,也即,也可以不对第一响应内容进行处理,将第一响应内容直接作为第一请求对应的响应结果并反馈给应用客户端。或者,在配置response_header阶段的情况下,如果第一响应内容符合标准,也可以不执行response_header阶段,也即可以不对第一响应内容进行处理,将第一响应内容直接作为第一请求对应的响应结果并反馈给应用客户端。In an optional implementation, the response_header stage may not be configured, that is, the first response content may not be processed, and the first response content may be directly used as the response result corresponding to the first request and fed back to the application client. . Alternatively, when the response_header stage is configured, if the first response content meets the standard, the response_header stage may not be executed, that is, the first response content may not be processed, and the first response content may be directly used as the response result corresponding to the first request. and feedback to the application client.
这样,通过在第一请求中提取请求上下文信息的方式,可以得到多条能够用于请求调度的请求特征信息,进而依赖包含丰富信息的请求上下文信息进行请求调度,能够实现细粒度的请求调度,提高请求调度的准确性。利用预先配置的路由配置信息中配置的请求处理信息,对请求上下文信息进行处理,能够实现将请求上下文信息修改为满足配置信息的目标上下文信息,实现了对目标上下文的细粒度更新。再通过目标上下文信息生成第二请求,并将所述第二请求发送至目标服务器进行处理的方式,第二请求对应于第一请求,利用目标服务器对第二请求处理,也即实现了对第一请求进行及时地调度处理。最后,基于请求处理信息,对目标服务器针对第二请求反馈的第一响应内容进行修改,实现了细粒度地将第一响应内容修改为满足配置信息的第二响应内容,也即得到了更准确且更符合预期的响应结果。In this way, by extracting the request context information in the first request, multiple pieces of request characteristic information that can be used for request scheduling can be obtained, and then relying on the request context information containing rich information for request scheduling can achieve fine-grained request scheduling. Improve the accuracy of request scheduling. Using the request processing information configured in the preconfigured routing configuration information to process the request context information, the request context information can be modified to the target context information that satisfies the configuration information, and fine-grained updates to the target context can be achieved. Then generate a second request through the target context information, and send the second request to the target server for processing. The second request corresponds to the first request, and the target server is used to process the second request, that is, the second request is processed. A request is dispatched and processed in a timely manner. Finally, based on the request processing information, the first response content fed back by the target server for the second request is modified, achieving fine-grained modification of the first response content to the second response content that satisfies the configuration information, that is, a more accurate And more consistent with the expected response results.
在一种实施例中,请求处理信息中可以携带有各种method在具有不同请求标识的应用客户端请求时,目标服务器对应的目标接收频率。目标接收频率例如可以为针对对应于method1和请求标识1的请求,每分钟可响应100个。请求标识可以为用户标识、客户端标识等。在将第二请求发送至目标服务器之前,还可以执行before_proxy阶段,以实现对第一请求的限流检查,确定目标服务器能否响应第一请求对应第二请求。In one embodiment, the request processing information may carry the target reception frequency corresponding to the target server when various methods are requested by application clients with different request identifiers. The target reception frequency may be, for example, 100 responses per minute for requests corresponding to method 1 and request identifier 1. The request ID can be a user ID, client ID, etc. Before sending the second request to the target server, the before_proxy stage can also be executed to implement a current limit check on the first request and determine whether the target server can respond to the first request corresponding to the second request.
具体的,可以基于目标上下文信息,确定第一请求对应的请求标识和请求方式,也即从目标上下文信息中,筛选出第一请求对应的method和method。并且,还可以基于请求处理信息,确定目标服务器针对第一请求对应的请求方式和请求标识的目标接收频率。Specifically, the request identifier and request method corresponding to the first request can be determined based on the target context information, that is, the method and method corresponding to the first request can be filtered out from the target context information. Furthermore, the request method corresponding to the first request and the target reception frequency of the request identifier by the target server may also be determined based on the request processing information.
然后,确定与第一请求对应的请求方式和请求标识均匹配的请求的当前接
收频率。这里,当前接收频率可以为与第一请求对应的请求方式和请求标识均匹配的请求,在目标接收频率指示的时间段内的接收数量。Then, determine the current interface of the request that matches both the request method and the request identifier corresponding to the first request. receive frequency. Here, the current reception frequency may be the number of requests received within the time period indicated by the target reception frequency for requests that both match the request mode and request identifier corresponding to the first request.
示例性的,第一请求对应的请求方式为method2,请求标识为标识2,目标接收频率为每分钟接收10次,在确定目标接收频率后确定的一分钟内已接收的、对应于method2和标识2的请求的数量为5,则可以确定当前接收频率为一分钟接收了5次。For example, the request mode corresponding to the first request is method2, the request identifier is identifier 2, the target reception frequency is 10 times per minute, and the data corresponding to method2 and identifier has been received within one minute after the target reception frequency is determined. If the number of requests for 2 is 5, it can be determined that the current reception frequency is 5 times per minute.
进一步的,可以执行请求处理信息指示的、在before_proxy阶段针对第一请求的限流检查操作,也即确定当前接收频率是否小于目标接收频率。如果是,则确定目标服务器能够响应第一请求对应的第二请求。继而,可以根据目标上下文信息,生成第二请求,并将第二请求发送至目标服务器。Further, the current limit check operation for the first request in the before_proxy stage as indicated by the request processing information can be performed, that is, it is determined whether the current reception frequency is less than the target reception frequency. If yes, it is determined that the target server can respond to the second request corresponding to the first request. Then, a second request can be generated according to the target context information, and the second request can be sent to the target server.
在另一种实施例中,在确定当前接收频率不小于目标接收频率的情况下,则说明目标服务器不能对第二请求进行响应,则可以获取请求处理信息中指示的第一备用服务器。其中,第一备用服务器为一个兜底的服务器,在任何时刻确定当前接收的请求不能被该请求对应的目标服务器响应时,均可以将该请求发送至第一备用服务器。In another embodiment, if it is determined that the current reception frequency is not less than the target reception frequency, it means that the target server cannot respond to the second request, and the first backup server indicated in the request processing information can be obtained. The first backup server is a back-up server. When it is determined that the currently received request cannot be responded to by the target server corresponding to the request at any time, the request can be sent to the first backup server.
然后,可以将第二请求发送至第一备用服务器,并获取第一备用服务器对第二请求进行响应处理后反馈的响应内容。之后,可以基于请求处理信息对该响应内容进行处理,得到处理后的内容,并将该处理后的内容反馈给应用客户端。或者,也可以将第一备用服务器对第二请求进行响应处理后反馈的响应内容,直接反馈给应用客户端。Then, the second request can be sent to the first backup server, and the response content fed back by the first backup server after processing the response to the second request can be obtained. Afterwards, the response content can be processed based on the request processing information to obtain the processed content, and the processed content can be fed back to the application client. Alternatively, the response content fed back by the first backup server after processing the response to the second request can also be directly fed back to the application client.
这样,通过在请求处理信息中设置兜底的第一备用服务器并利用第一备用服务器对第二请求进行响应的方式,可以保证在目标服务器不能对第二请求进行响应的情况下,第二请求也能够被及时响应,提高了请求响应的及时性。In this way, by setting a first backup server in the request processing information and using the first backup server to respond to the second request, it can be ensured that when the target server cannot respond to the second request, the second request can still be processed. Can be responded to in a timely manner, improving the timeliness of request response.
在一种实施例中,针对S104中基于请求处理信息对第一响应内容进行处理的步骤,还可以按照两种方式(方式一和方式二)中的任一方式实施:In one embodiment, the step of processing the first response content based on the request processing information in S104 can also be implemented in any of two ways (way one and way two):
方式一、在确定第一响应内容中携带的状态码指示响应异常的情况下,将第二请求转发至第二备用服务器,并接收第二备用服务器反馈的第三响应内容,利用第三响应内容对第一响应内容进行更新,得到第二响应内容。Method 1: When it is determined that the status code carried in the first response content indicates that the response is abnormal, forward the second request to the second backup server, receive the third response content fed back by the second backup server, and use the third response content Update the first response content to obtain the second response content.
这里,第一响应内容中可以包括响应头信息、状态码、响应日期、文件类型(图片、页面、视频等)、目标服务器标识等信息。响应头信息用于表征目
标服务器饭反馈的针对第二请求的反馈内容。例如,响应头信息可以为页面文件信息、功能响应信息等。状态码用于指示目标服务器是否正常响应了第二请求。例如,状态码可以为指示目标服务器响应异常的404、指示目标服务器响应成功的200、指示目标服务器不可用的503等。Here, the first response content may include response header information, status code, response date, file type (picture, page, video, etc.), target server identification and other information. Response header information is used to represent the purpose The feedback content of the second request provided by the server. For example, the response header information can be page file information, function response information, etc. The status code is used to indicate whether the target server responded to the second request normally. For example, the status code may be 404 indicating that the target server responded abnormally, 200 indicating that the target server responded successfully, 503 indicating that the target server is unavailable, etc.
第二备用服务器可以与第一备用服务器相同,也可以不同,此处不进行限定。利用第三响应内容对第一响应内容进行更新,得到第二响应内容的操作,具体可以为将第三响应内容直接作为第二响应内容的操作。The second backup server may be the same as the first backup server, or may be different, which is not limited here. The operation of updating the first response content with the third response content to obtain the second response content may specifically be the operation of directly using the third response content as the second response content.
具体实施时,可以执行response_header阶段,并按照response_header阶段对应的响应内容检查操作,对第一响应内容进行解析,获取第一响应内容中的状态码和响应头信息。之后,确定状态码是否指示目标服务器响应异常。如果是,则将第二请求转发至第二备用服务器,并接收第二备用服务器反馈的第三响应内容,将第三响应内容作为第二响应内容,并反馈给应用客户端。During specific implementation, the response_header stage can be executed, and the first response content can be parsed according to the response content checking operation corresponding to the response_header stage, and the status code and response header information in the first response content can be obtained. Afterwards, determine whether the status code indicates that the target server responded abnormally. If so, forward the second request to the second backup server, receive the third response content fed back by the second backup server, use the third response content as the second response content, and feed it back to the application client.
或者,在确定状态码指示响应异常的情况下,可以将默认的第二响应内容反馈给应用客户端。Alternatively, if it is determined that the status code indicates a response exception, the default second response content may be fed back to the application client.
方式二、在确定第一响应内容中携带的状态码指示响应正常的情况下,可以利用请求处理信息中携带的内容更新信息,对第一响应内容中的响应头信息进行更改,从而得到第二响应内容。Method 2: When it is determined that the status code carried in the first response content indicates that the response is normal, the content update information carried in the request processing information can be used to change the response header information in the first response content, thereby obtaining the second Response content.
在具体实施时,在请求头信息为响应上下文信息的情况下,例如可以利用请求处理信息中携带的页面内容更新信息,对响应上下文信息中的页面内容进行更新(例如置灰、更换颜色等),从而得到更新后的响应上下文信息,基于更新后的响应上下文信息,可以生成第二响应内容,并将第二响应内容反馈给应用客户端。这样,通常对第一响应内容进行更改并反馈的方式,可以实现对第一请求的灵活反馈。In specific implementation, when the request header information is response context information, for example, the page content update information carried in the request processing information can be used to update the page content in the response context information (for example, graying out, changing colors, etc.) , thereby obtaining the updated response context information. Based on the updated response context information, the second response content can be generated, and the second response content can be fed back to the application client. In this way, flexible feedback to the first request can be achieved by usually changing the content of the first response and providing feedback.
在另一种实施方式中,也可以不对第一响应内容进行更改,直接将其反馈给应用客户端。In another implementation manner, the first response content may be directly fed back to the application client without changing it.
在一种实施例中,在将第二响应内容反馈给应用客户端之后,还可以执行filter列表配置指示的response_end阶段,基于第一请求、第二请求、第一响应内容和第二响应内容中的至少一个,生成第一请求对应的日志信息,并保存该日志信息。或者,也可以执行response_end阶段,释放处理第一请求时所使用的计算资源。例如,释放目标服务器中的计算资源,释放功能网关中的计算资
源。In one embodiment, after the second response content is fed back to the application client, the response_end phase indicated by the filter list configuration may also be executed, based on the first request, the second request, the first response content and the second response content. At least one of, generates log information corresponding to the first request, and saves the log information. Alternatively, the response_end phase can also be executed to release the computing resources used when processing the first request. For example, release computing resources in the target server, release computing resources in the functional gateway source.
在一种实施例中,本公开实施例还提供了预先配置路由配置信息的方法,具体的,可以按照以下步骤实施:In one embodiment, the embodiment of the present disclosure also provides a method for pre-configuring routing configuration information. Specifically, it can be implemented according to the following steps:
步骤一、获取配置中心发送的序列化处理后的路由配置文件;其中,路由配置文件为配置中心在获取针对应用客户端对应的应用的路由配置信息后,对其序列化处理得到的文件。Step 1: Obtain the serialized routing configuration file sent by the configuration center; the routing configuration file is a file obtained by the configuration center after obtaining the routing configuration information for the application corresponding to the application client and serializing it.
这里,配置中心即控制面,用户可以在配置中心设置针对各种应用的路由配置信息。Here, the configuration center is the control plane, and users can set routing configuration information for various applications in the configuration center.
本步骤在具体实施时,配置中心在获取到用户配置针对应用客户端对应的应用的路由配置信息后,可以对该最新的路由配置信息进行序列化处理,将该最新的路由配置信息序列化处理为功能网关能够存储的路由配置文件。之后,配置中心可以将该路由配置文件发送至功能网关。During the specific implementation of this step, after obtaining the routing configuration information configured by the user for the application corresponding to the application client, the configuration center can serialize the latest routing configuration information and serialize the latest routing configuration information. It is the routing configuration file that the functional gateway can store. The configuration center can then send the routing configuration file to the functional gateway.
步骤二、对路由配置文件执行反序列化处理操作,得到还原后的路由配置信息,并利用路由配置信息替换历史路由配置信息。Step 2: Perform deserialization on the routing configuration file to obtain the restored routing configuration information, and use the routing configuration information to replace the historical routing configuration information.
这里,功能网关也称为数据面。历史路由配置信息可以为功能网关中已存储的路由配置信息。Here, the functional gateway is also called the data plane. Historical routing configuration information can be routing configuration information stored in the functional gateway.
具体实施时,功能网关可以对获取的路由配置文件执行反序列化处理操作,得到还原后的路由配置信息。之后,可以将路由配置信息以结构体的形式存储在功能网关中,以实现对历史路由配置信息的替换。During specific implementation, the function gateway can perform a deserialization operation on the obtained routing configuration file to obtain restored routing configuration information. Afterwards, the routing configuration information can be stored in the functional gateway in the form of a structure to replace historical routing configuration information.
具体的,功能网关可以获取结构体对应的目标指针地址,然后,利用原子操作指令,将已存储的历史路由配置信息对应的指针地址替换为目标指针地址,也即实现了利用最新的路由配置信息替换历史路由配置信息。。这样,在后续接收到新的请求后,可以利用目标指针地址指示的最新的路由配置信息进行路由匹配。Specifically, the function gateway can obtain the target pointer address corresponding to the structure, and then use atomic operation instructions to replace the pointer address corresponding to the stored historical routing configuration information with the target pointer address, that is, utilizing the latest routing configuration information. Replace historical routing configuration information. . In this way, after receiving a new request subsequently, the latest routing configuration information indicated by the target pointer address can be used for routing matching.
这里,针对将已存储的历史路由配置信息对应的指针地址替换为目标指针地址的步骤,如果功能网关中存在已接受但未处理完的请求,则此类型的请求仍需使用已存储的历史路由配置信息进行路由匹配。因此在具体实施时,可以在利用已存储的历史路由配置信息,完成对此类型的请求的路由匹配后,再将历史路由配置信息对应的指针地址替换为目标指针地址。Here, regarding the step of replacing the pointer address corresponding to the stored historical routing configuration information with the target pointer address, if there is a request that has been accepted but not processed in the functional gateway, this type of request still needs to use the stored historical routing Configuration information for route matching. Therefore, during specific implementation, you can use the stored historical routing configuration information to complete route matching for this type of request, and then replace the pointer address corresponding to the historical routing configuration information with the target pointer address.
此时,如果在确定了目标指针地址之后,在将历史路由配置信息对应的指
针地址替换为目标指针地址之前,接收到了新的请求,该新的请求也将使用目标指针地址对应的最新的路由配置信息进行路由匹配。At this time, if after determining the target pointer address, the pointer corresponding to the historical routing configuration information is Before the needle address is replaced with the target pointer address, a new request is received, and the new request will also use the latest routing configuration information corresponding to the target pointer address for routing matching.
这样,由于功能网关不需要重启,通过将路由配置信息存储在功能网关中的方式,可以实现对应用对应的路由配置信息的热更新,相比现有技术中需要重启应用才可以实现路由配置信息的更新而言,本公开实施例提供的配置路由配置信息的方式,提高了路由配置信息更新的及时性和便利性。In this way, since the functional gateway does not need to be restarted, by storing the routing configuration information in the functional gateway, hot update of the routing configuration information corresponding to the application can be achieved. Compared with the existing technology, which requires restarting the application, the routing configuration information can be realized. In terms of updating, the method of configuring routing configuration information provided by the embodiments of the present disclosure improves the timeliness and convenience of updating routing configuration information.
如图2所示,为本公开实施例提供的一种请求调度方法的具体实施流程图,可以包括以下步骤:As shown in Figure 2, a specific implementation flow chart of a request scheduling method provided by an embodiment of the present disclosure may include the following steps:
S201:获取第一请求,并从第一请求中提取请求上下文信息。S201: Obtain the first request and extract the request context information from the first request.
S202:基于路由配置信息和请求上下文信息中的路由特征信息,确定目标服务器和请求处理信息。S202: Determine the target server and request processing information based on the routing feature information in the routing configuration information and the request context information.
S203:按照请求处理信息指示的、在第一处理阶段(before_request阶段)针对请求上下文信息的请求处理操作,对请求上下信息进行修改,得到目标上下文信息。S203: According to the request processing operation for the request context information in the first processing stage (before_request stage) indicated by the request processing information, modify the request context information to obtain the target context information.
S204:执行请求处理信息指示的、在第二处理阶段(before_proxy阶段)针对第一请求的限流检查操作,确定目标服务器是否能够响应第二请求。S204: Execute the current limit check operation for the first request in the second processing stage (before_proxy stage) indicated by the request processing information to determine whether the target server can respond to the second request.
若否,则执行S205;若是,则执行S206。If not, execute S205; if yes, execute S206.
S205:根据目标上下文信息生成第二请求,并将第二请求发送至第一备用服务器。S205: Generate a second request according to the target context information, and send the second request to the first backup server.
这里,执行S205后,可以获取第一备用服务器对第二请求进行响应处理后反馈的响应内容。在得到第一备用服务器反馈的响应内容后,可以直接反馈给应用客户端,也可以执行S208,并将在执行S208后得到的响应内容反馈给客户端。Here, after executing S205, the response content fed back by the first backup server after processing the response to the second request can be obtained. After obtaining the response content fed back by the first backup server, it can be directly fed back to the application client, or S208 can be executed, and the response content obtained after executing S208 is fed back to the client.
S206:根据目标上下文信息生成第二请求,并将第二请求发送至目标服务器。S206: Generate a second request according to the target context information, and send the second request to the target server.
S207:获取目标服务器针对第二请求反馈的第一响应内容。S207: Obtain the first response content fed back by the target server in response to the second request.
S208:按照请求处理信息指示的、在第三处理阶段(response_header阶段)对应的内容更新信息,对第一响应内容中的响应头信息进行更改,得到第二响应内容。S208: According to the content update information corresponding to the third processing stage (response_header stage) indicated by the request processing information, change the response header information in the first response content to obtain the second response content.
这里,在确定第一响应内容中携带的状态码指示响应正常的情况下,可以
执行本步骤。response_header阶段对应的内容更新信息,即为请求处理信息中携带的内容更新信息。Here, when it is determined that the status code carried in the first response content indicates that the response is normal, you can Follow this step. The content update information corresponding to the response_header stage is the content update information carried in the request processing information.
若在执行完S205后执行本步骤,可以内容更新信息对第一备用服务器反馈的响应内容中的响应头信息进行更改,并基于更改后的响应头信息,生成第二响应内容。If this step is performed after S205 is performed, the response header information in the response content fed back by the first backup server can be changed with the content update information, and the second response content is generated based on the changed response header information.
S209:将第二响应内容作为第一请求的响应结果反馈给应用客户端。S209: Feed back the second response content to the application client as the response result of the first request.
S210:执行请求处理信息指示的第四处理阶段(response_end阶段),基于第一请求、第二请求、第一响应内容和第二响应内容,生成第一请求对应的日志信息;和/或,释放处理第一请求时所使用的计算资源。S210: Execute the fourth processing stage (response_end stage) indicated by the request processing information, and generate log information corresponding to the first request based on the first request, the second request, the first response content and the second response content; and/or release The computing resources used to process the first request.
关于上述S201~S210的具体实施步骤,可以参照上述各实施例,此处不进行限定。Regarding the specific implementation steps of S201 to S210, reference may be made to the above embodiments, and there is no limitation here.
本领域技术人员可以理解,在具体实施方式的上述方法中,各步骤的撰写顺序并不意味着严格的执行顺序而对实施过程构成任何限定,各步骤的具体执行顺序应当以其功能和可能的内在逻辑确定。Those skilled in the art can understand that in the above-mentioned methods of specific embodiments, the writing order of each step does not mean a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be based on its function and possible The internal logic is determined.
基于同一发明构思,本公开实施例中还提供了与请求调度方法对应的请求调度装置,由于本公开实施例中的装置解决问题的原理与本公开实施例上述请求调度方法相似,因此装置的实施可以参见方法的实施,重复之处不再赘述。Based on the same inventive concept, the embodiment of the present disclosure also provides a request scheduling device corresponding to the request scheduling method. Since the principle of solving the problem of the device in the embodiment of the present disclosure is similar to the above-mentioned request scheduling method in the embodiment of the present disclosure, the implementation of the device Please refer to the implementation of the method, and the repeated parts will not be repeated.
如图3所示,为本公开实施例提供的一种请求调度装置的示意图,包括:As shown in Figure 3, a schematic diagram of a request scheduling device provided by an embodiment of the present disclosure includes:
获取模块301,用于获取应用客户端发送的第一请求,并从所述第一请求中提取请求上下文信息;所述请求上下文信息包括多条请求特征信息;The acquisition module 301 is used to acquire the first request sent by the application client, and extract request context information from the first request; the request context information includes multiple pieces of request feature information;
确定模块302,用于基于获取的预先配置的路由配置信息和所述请求上下文信息中的路由特征信息,确定所述第一请求对应的目标服务器和请求处理信息;Determining module 302, configured to determine the target server and request processing information corresponding to the first request based on the obtained pre-configured routing configuration information and the routing feature information in the request context information;
第一处理模块303,用于根据所述请求处理信息对所述请求上下文信息进行处理,得到处理后的目标上下文信息;The first processing module 303 is configured to process the request context information according to the request processing information to obtain processed target context information;
发送模块304,用于根据所述目标上下文信息生成第二请求,将所述第二请求发送至所述目标服务器,并在获取所述目标服务器针对所述第二请求反馈的第一响应内容后,基于所述请求处理信息对所述第一响应内容进行处理,将处理后的第二响应内容作为所述第一请求的响应结果反馈给所述应用客户端。Sending module 304, configured to generate a second request according to the target context information, send the second request to the target server, and obtain the first response content fed back by the target server in response to the second request. , process the first response content based on the request processing information, and feed back the processed second response content to the application client as a response result of the first request.
在一种可能的实施方式中,所述第一处理模块303,用于按照所述请求处
理信息指示的、在第一处理阶段针对所述请求上下文信息的请求处理操作,对所述请求上下信息中的请求头信息和/或客户端地址信息进行修改,得到所述目标上下文信息。In a possible implementation, the first processing module 303 is configured to process the request according to the request. According to the request processing operation indicated by the processing information in the first processing stage for the request context information, the request header information and/or the client address information in the request context information are modified to obtain the target context information.
在一种可能的实施方式中,所述发送模块304,在将所述第二请求发送至所述目标服务器之前,还用于基于所述目标上下文信息,确定所述第一请求对应的请求标识和请求方式,并基于所述请求处理信息,确定所述目标服务器针对所述请求方式和所述请求标识的目标接收频率;In a possible implementation, the sending module 304 is further configured to determine the request identifier corresponding to the first request based on the target context information before sending the second request to the target server. and request mode, and based on the request processing information, determine the target reception frequency of the target server for the request mode and the request identification;
确定与所述请求方式和所述请求标识均匹配的请求的当前接收频率,并执行所述请求处理信息指示的、在第二处理阶段针对所述第一请求的限流检查操作,确定所述当前接收频率是否小于所述目标接收频率;Determine the current reception frequency of requests that match both the request mode and the request identification, and perform a current limit check operation for the first request in the second processing stage indicated by the request processing information, and determine the Whether the current receiving frequency is smaller than the target receiving frequency;
若是,确定所述目标服务器能够响应所述第二请求。If yes, it is determined that the target server can respond to the second request.
在一种可能的实施方式中,所述发送模块304,还用于在确定所述当前接收频率不小于所述目标接收频率的情况下,确定所述目标服务器无法响应所述第二请求,并将所述第二请求发送至所述请求处理信息指示的第一备用服务器。In a possible implementation, the sending module 304 is further configured to determine that the target server cannot respond to the second request when it is determined that the current receiving frequency is not less than the target receiving frequency, and Send the second request to the first backup server indicated by the request processing information.
在一种可能的实施方式中,所述发送模块304,在所述基于所述请求处理信息对所述第一响应内容进行处理时,用于在确定所述第一响应内容中携带的状态码指示响应异常的情况下,将所述第二请求转发至第二备用服务器,并接收所述第二备用服务器反馈的第三响应内容,利用所述第三响应内容对所述第一响应内容进行更新,得到所述第二响应内容;或In a possible implementation, the sending module 304 is configured to determine the status code carried in the first response content when processing the first response content based on the request processing information. If an abnormal response is indicated, forward the second request to the second backup server, receive the third response content fed back by the second backup server, and use the third response content to perform processing on the first response content. Update to obtain the second response content; or
在确定所述第一响应内容中携带的状态码指示响应正常的情况下,利用所述请求处理信息中携带的内容更新信息,对所述第一响应内容中的响应头信息进行更改,得到所述第二响应内容。When it is determined that the status code carried in the first response content indicates that the response is normal, the content update information carried in the request processing information is used to change the response header information in the first response content to obtain the result. Describe the content of the second response.
在一种可能的实施方式中,所述装置还包括:In a possible implementation, the device further includes:
第二处理模块305,用于在所述将处理后的第二响应内容作为所述第一请求的响应结果反馈给所述应用客户端之后,基于所述第一请求、所述第二请求、所述第一响应内容和所述第二响应内容,生成所述第一请求对应的日志信息;和/或,释放处理第一请求时所使用的计算资源。The second processing module 305 is configured to, after the processed second response content is fed back to the application client as the response result of the first request, based on the first request, the second request, The first response content and the second response content generate log information corresponding to the first request; and/or release computing resources used when processing the first request.
在一种可能的实施方式中,所述确定模块302在所述基于获取的预先配置的路由配置信息和所述请求上下文信息中的路由特征信息,确定所述第一请求对应的目标服务器和请求处理信息时,用于根据所述路由特征信息中的请求域
名,从所述路由配置信息中获取在所述请求域名下的各个预设访问路径;In a possible implementation, the determination module 302 determines the target server corresponding to the first request and the request based on the obtained pre-configured routing configuration information and the routing feature information in the request context information. When processing information, it is used to determine the request domain in the routing feature information. Name, obtain each preset access path under the requested domain name from the routing configuration information;
从所述预设访问路径中,确定与所述路由特征信息中的目标访问路径相匹配的各个候选访问路径,所述候选访问路径对应的路径长度小于或等于所述目标访问路径的路径长度;From the preset access paths, determine each candidate access path that matches the target access path in the routing feature information, and the path length corresponding to the candidate access path is less than or equal to the path length of the target access path;
确定各个所述候选访问路径中,路径长度最长的候选访问路径对应的目标配置信息,并从所述目标配置信息中确定所述目标服务器和所述请求处理信息。Determine the target configuration information corresponding to the candidate access path with the longest path length among each of the candidate access paths, and determine the target server and the request processing information from the target configuration information.
在一种可能的实施方式中,所述装置还包括:In a possible implementation, the device further includes:
配置模块306,用于按照以下步骤预先配置所述路由配置信息:获取配置中心发送的序列化处理后的路由配置文件;其中,所述路由配置文件为所述配置中心在获取针对所述应用客户端对应的应用的路由配置信息后,对其序列化处理得到的文件;The configuration module 306 is configured to pre-configure the routing configuration information according to the following steps: obtain the serialized routing configuration file sent by the configuration center; wherein the routing configuration file is obtained by the configuration center for the application client. After obtaining the routing configuration information of the corresponding application on the end, serialize it to obtain the file;
对所述路由配置文件执行反序列化处理操作,得到还原后的所述路由配置信息,并利用所述路由配置信息替换历史路由配置信息。Perform a deserialization operation on the routing configuration file to obtain the restored routing configuration information, and use the routing configuration information to replace historical routing configuration information.
关于装置中的各模块的处理流程、以及各模块之间的交互流程的描述可以参照上述方法实施例中的相关说明,这里不再详述。For a description of the processing flow of each module in the device and the interaction flow between the modules, please refer to the relevant descriptions in the above method embodiments, and will not be described in detail here.
本公开实施例还提供了一种计算机设备,如图4所示,为本公开实施例提供的一种计算机设备结构示意图,包括:An embodiment of the present disclosure also provides a computer device. As shown in Figure 4, which is a schematic structural diagram of a computer device provided by an embodiment of the present disclosure, it includes:
处理器41、存储器42和总线43。其中,存储器42存储有处理器41可执行的机器可读指令,处理器41用于执行存储器42中存储的机器可读指令,所述机器可读指令被处理器41执行时,处理器41执行下述步骤:S101:获取应用客户端发送的第一请求,并从第一请求中提取请求上下文信息;请求上下文信息包括多条请求特征信息;S102:基于获取的预先配置的路由配置信息和请求上下文信息中的路由特征信息,确定第一请求对应的目标服务器和请求处理信息;S103:根据请求处理信息对请求上下文信息进行处理,得到处理后的目标上下文信息以及S104:根据目标上下文信息生成第二请求,将第二请求发送至目标服务器,并在获取目标服务器针对第二请求反馈的第一响应内容后,基于请求处理信息对第一响应内容进行处理,将处理后的第二响应内容作为第一请求的响应结果反馈给应用客户端。Processor 41, memory 42 and bus 43. The memory 42 stores machine-readable instructions executable by the processor 41 , and the processor 41 is used to execute the machine-readable instructions stored in the memory 42 . When the machine-readable instructions are executed by the processor 41 , the processor 41 executes The following steps: S101: Obtain the first request sent by the application client, and extract the request context information from the first request; the request context information includes multiple pieces of request feature information; S102: Based on the obtained pre-configured routing configuration information and request The routing feature information in the context information determines the target server and request processing information corresponding to the first request; S103: Process the request context information according to the request processing information to obtain the processed target context information; S104: Generate the third request based on the target context information. Second request, send the second request to the target server, and after obtaining the first response content fed back by the target server in response to the second request, process the first response content based on the request processing information, and use the processed second response content as The response result of the first request is fed back to the application client.
上述存储器42包括内存421和外部存储器422;这里的内存421也称内存储器,用于暂时存放处理器41中的运算数据,以及与硬盘等外部存储器422
交换的数据,处理器41通过内存421与外部存储器422进行数据交换,当计算机设备运行时,处理器41与存储器42之间通过总线43通信,使得处理器41在执行上述方法实施例中所提及的执行指令。The above-mentioned memory 42 includes a memory 421 and an external memory 422; the memory 421 here is also called an internal memory, which is used to temporarily store the operation data in the processor 41, and is combined with an external memory 422 such as a hard disk. The processor 41 exchanges data with the external memory 422 through the memory 421. When the computer device is running, the processor 41 and the memory 42 communicate through the bus 43, so that the processor 41 performs the steps mentioned in the above method embodiment. and execution instructions.
上述指令的具体执行过程可以参考本公开实施例中所述的请求调度方法的步骤,此处不再赘述。For the specific execution process of the above instructions, reference can be made to the steps of the request scheduling method described in the embodiments of the present disclosure, which will not be described again here.
本公开实施例还提供一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,该计算机程序被处理器运行时执行上述方法实施例中所述的请求调度方法的步骤。其中,该存储介质可以是易失性或非易失的计算机可读取存储介质。Embodiments of the present disclosure also provide a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. When the computer program is run by a processor, the computer program executes the steps of the request scheduling method described in the above method embodiment. Wherein, the storage medium may be a volatile or non-volatile computer-readable storage medium.
本公开实施例所提供的请求调度方法的计算机程序产品,包括存储了程序代码的计算机可读存储介质,所述程序代码包括的指令可用于执行上述方法实施例中所述的请求调度方法的步骤,具体可参见上述方法实施例,在此不再赘述。The computer program product of the request scheduling method provided by the embodiment of the present disclosure includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the steps of the request scheduling method described in the above method embodiment. , please refer to the above method embodiments for details, and will not be described again here.
该计算机程序产品可以具体通过硬件、软件或其结合的方式实现。在一个可选实施例中,所述计算机程序产品具体体现为计算机存储介质,在另一个可选实施例中,计算机程序产品具体体现为软件产品,例如软件开发包(Software Development Kit,SDK)等等。The computer program product can be implemented specifically through hardware, software or a combination thereof. In an optional embodiment, the computer program product is embodied as a computer storage medium. In another optional embodiment, the computer program product is embodied as a software product, such as a Software Development Kit (SDK), etc. wait.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的装置的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。在本公开所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,又例如,多个单元或组件可以结合,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些通信接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the device described above can be referred to the corresponding process in the foregoing method embodiment, and will not be described again here. In the several embodiments provided in this disclosure, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined. Or some features can be ignored, or not implemented. On the other hand, the coupling or direct coupling or communication connection between each other shown or discussed may be through some communication interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本公开各个实施例中的各功能单元可以集成在一个处理单元中,
也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in various embodiments of the present disclosure can be integrated into one processing unit, Each unit may exist physically alone, or two or more units may be integrated into one unit.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个处理器可执行的非易失的计算机可读取存储介质中。基于这样的理解,本公开的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本公开各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure is essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present disclosure. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program code. .
最后应说明的是:以上所述实施例,仅为本公开的具体实施方式,用以说明本公开的技术方案,而非对其限制,本公开的保护范围并不局限于此,尽管参照前述实施例对本公开进行了详细的说明,本领域的普通技术人员应当理解:任何熟悉本技术领域的技术人员在本公开揭露的技术范围内,其依然可以对前述实施例所记载的技术方案进行修改或可轻易想到变化,或者对其中部分技术特征进行等同替换;而这些修改、变化或者替换,并不使相应技术方案的本质脱离本公开实施例技术方案的精神和范围,都应涵盖在本公开的保护范围之内。因此,本公开的保护范围应所述以权利要求的保护范围为准。
Finally, it should be noted that the above-mentioned embodiments are only specific implementations of the present disclosure and are used to illustrate the technical solutions of the present disclosure rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although refer to the foregoing The embodiments describe the present disclosure in detail. Those of ordinary skill in the art should understand that any person familiar with the technical field can still modify the technical solutions recorded in the foregoing embodiments within the technical scope disclosed in the present disclosure. Changes may be easily imagined, or equivalent substitutions may be made to some of the technical features; and these modifications, changes or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and shall be included in the present disclosure. within the scope of protection. Therefore, the protection scope of the present disclosure should be determined by the protection scope of the claims.
Claims (12)
- 一种请求调度方法,其特征在于,包括:A request scheduling method, characterized by including:获取应用客户端发送的第一请求,并从所述第一请求中提取请求上下文信息;所述请求上下文信息包括多条请求特征信息,所述请求特征信息包括路由特征信息;Obtain the first request sent by the application client, and extract request context information from the first request; the request context information includes multiple pieces of request feature information, and the request feature information includes routing feature information;基于获取的预先配置的路由配置信息和所述请求上下文信息中的所述路由特征信息,确定所述第一请求对应的目标服务器和请求处理信息;Determine the target server and request processing information corresponding to the first request based on the obtained preconfigured routing configuration information and the routing feature information in the request context information;根据所述请求处理信息对所述请求上下文信息进行处理,得到处理后的目标上下文信息;Process the request context information according to the request processing information to obtain processed target context information;根据所述目标上下文信息生成第二请求,将所述第二请求发送至所述目标服务器,并在获取所述目标服务器针对所述第二请求反馈的第一响应内容后,基于所述请求处理信息对所述第一响应内容进行处理,将处理后的第二响应内容作为所述第一请求的响应结果反馈给所述应用客户端。Generate a second request according to the target context information, send the second request to the target server, and after obtaining the first response content fed back by the target server in response to the second request, process the request based on the The information processes the first response content, and feeds the processed second response content back to the application client as a response result of the first request.
- 根据权利要求1所述的方法,其特征在于,所述根据所述请求处理信息对所述请求上下文信息进行处理,得到处理后的目标上下文信息,包括:The method according to claim 1, characterized in that the request context information is processed according to the request processing information to obtain processed target context information, including:按照所述请求处理信息指示的、在第一处理阶段针对所述请求上下文信息的请求处理操作,对所述请求上下信息中的请求头信息和/或客户端地址信息进行修改,得到所述目标上下文信息。According to the request processing operation for the request context information in the first processing stage as indicated by the request processing information, modify the request header information and/or client address information in the request context information to obtain the target Contextual information.
- 根据权利要求2所述的方法,其特征在于,在将所述第二请求发送至所述目标服务器之前,还包括:The method according to claim 2, characterized in that, before sending the second request to the target server, it further includes:基于所述目标上下文信息,确定所述第一请求对应的请求标识和请求方式,并基于所述请求处理信息,确定所述目标服务器针对所述请求方式和所述请求标识的目标接收频率;Based on the target context information, determine the request identification and request method corresponding to the first request, and based on the request processing information, determine the target reception frequency of the target server for the request method and the request identification;确定与所述请求方式和所述请求标识均匹配的请求的当前接收频率,并执行所述请求处理信息指示的、在第二处理阶段针对所述第一请求的限流检查操作,确定所述当前接收频率是否小于所述目标接收频率;Determine the current reception frequency of requests that match both the request mode and the request identification, and perform a current limit check operation for the first request in the second processing stage indicated by the request processing information, and determine the Whether the current receiving frequency is smaller than the target receiving frequency;若所述当前接收频率小于所述目标接收频率,确定所述目标服务器能够响应所述第二请求。If the current reception frequency is less than the target reception frequency, it is determined that the target server can respond to the second request.
- 根据权利要求3所述的方法,其特征在于,所述方法还包括:The method of claim 3, further comprising:在确定所述当前接收频率不小于所述目标接收频率的情况下,确定所述目 标服务器无法响应所述第二请求,并将所述第二请求发送至所述请求处理信息指示的第一备用服务器。When it is determined that the current receiving frequency is not less than the target receiving frequency, it is determined that the target receiving frequency The target server is unable to respond to the second request, and sends the second request to the first backup server indicated by the request processing information.
- 根据权利要求1所述的方法,其特征在于,所述基于所述请求处理信息对所述第一响应内容进行处理,包括:The method of claim 1, wherein processing the first response content based on the request processing information includes:在确定所述第一响应内容中携带的状态码指示响应异常的情况下,将所述第二请求转发至第二备用服务器,并接收所述第二备用服务器反馈的第三响应内容,利用所述第三响应内容对所述第一响应内容进行更新,得到所述第二响应内容;或,When it is determined that the status code carried in the first response content indicates that the response is abnormal, forward the second request to the second backup server, receive the third response content fed back by the second backup server, and use the The third response content updates the first response content to obtain the second response content; or,在确定所述第一响应内容中携带的状态码指示响应正常的情况下,利用所述请求处理信息中携带的内容更新信息,对所述第一响应内容中的响应头信息进行更改,得到所述第二响应内容。When it is determined that the status code carried in the first response content indicates that the response is normal, the content update information carried in the request processing information is used to change the response header information in the first response content to obtain the result. Describe the content of the second response.
- 根据权利要求1所述的方法,其特征在于,在所述将处理后的第二响应内容作为所述第一请求的响应结果反馈给所述应用客户端之后,还包括:The method according to claim 1, characterized in that, after the processed second response content is fed back to the application client as the response result of the first request, it further includes:基于所述第一请求、所述第二请求、所述第一响应内容和所述第二响应内容,生成所述第一请求对应的日志信息;和/或,释放处理第一请求时所使用的计算资源。Based on the first request, the second request, the first response content and the second response content, generate log information corresponding to the first request; and/or release the information used when processing the first request. computing resources.
- 根据权利要求1所述的方法,其特征在于,所述基于获取的预先配置的路由配置信息和所述请求上下文信息中的路由特征信息,确定所述第一请求对应的目标服务器和请求处理信息,包括:The method according to claim 1, characterized in that the target server and request processing information corresponding to the first request are determined based on the acquired pre-configured routing configuration information and the routing feature information in the request context information. ,include:根据所述路由特征信息中的请求域名,从所述路由配置信息中获取在所述请求域名下的各个预设访问路径;According to the requested domain name in the routing feature information, obtain each preset access path under the requested domain name from the routing configuration information;从所述预设访问路径中,确定与所述路由特征信息中的目标访问路径相匹配的各个候选访问路径,所述候选访问路径对应的路径长度小于或等于所述目标访问路径的路径长度;From the preset access paths, determine each candidate access path that matches the target access path in the routing feature information, and the path length corresponding to the candidate access path is less than or equal to the path length of the target access path;确定各个所述候选访问路径中,路径长度最长的候选访问路径对应的目标配置信息,并从所述目标配置信息中确定所述目标服务器和所述请求处理信息。Determine the target configuration information corresponding to the candidate access path with the longest path length among each of the candidate access paths, and determine the target server and the request processing information from the target configuration information.
- 根据权利要求1所述的方法,其特征在于,所述方法还包括预先配置所述路由配置信息的步骤:The method according to claim 1, characterized in that the method further includes the step of pre-configuring the routing configuration information:获取配置中心发送的序列化处理后的路由配置文件;其中,所述路由配置文件为所述配置中心在获取针对所述应用客户端对应的应用的路由配置信息 后,对其序列化处理得到的文件;Obtain the serialized routing configuration file sent by the configuration center; wherein the routing configuration file is the routing configuration information for the application corresponding to the application client obtained by the configuration center. Finally, serialize the resulting file;对所述路由配置文件执行反序列化处理操作,得到还原后的所述路由配置信息,并利用所述路由配置信息替换历史路由配置信息。Perform a deserialization operation on the routing configuration file to obtain the restored routing configuration information, and use the routing configuration information to replace historical routing configuration information.
- 一种请求调度装置,其特征在于,包括:A request scheduling device, characterized by including:获取模块,用于获取应用客户端发送的第一请求,并从所述第一请求中提取请求上下文信息;所述请求上下文信息包括多条请求特征信息,所述请求特征信息包括路由特征信息;An acquisition module, configured to acquire the first request sent by the application client, and extract request context information from the first request; the request context information includes multiple pieces of request feature information, and the request feature information includes routing feature information;确定模块,用于基于获取的预先配置的路由配置信息和所述请求上下文信息中的所述路由特征信息,确定所述第一请求对应的目标服务器和请求处理信息;A determination module configured to determine the target server and request processing information corresponding to the first request based on the obtained preconfigured routing configuration information and the routing feature information in the request context information;第一处理模块,用于根据所述请求处理信息对所述请求上下文信息进行处理,得到处理后的目标上下文信息;A first processing module, configured to process the request context information according to the request processing information to obtain processed target context information;发送模块,用于根据所述目标上下文信息生成第二请求,将所述第二请求发送至所述目标服务器,并在获取所述目标服务器针对所述第二请求反馈的第一响应内容后,基于所述请求处理信息对所述第一响应内容进行处理,将处理后的第二响应内容作为所述第一请求的响应结果反馈给所述应用客户端。A sending module, configured to generate a second request according to the target context information, send the second request to the target server, and after obtaining the first response content fed back by the target server in response to the second request, The first response content is processed based on the request processing information, and the processed second response content is fed back to the application client as a response result of the first request.
- 一种计算机设备,其特征在于,包括:处理器、存储器,所述存储器存储有所述处理器可执行的机器可读指令,所述处理器用于执行所述存储器中存储的机器可读指令,所述机器可读指令被所述处理器执行时,所述处理器执行如权利要求1至8任意一项所述的请求调度方法的步骤。A computer device, characterized in that it includes: a processor and a memory, the memory stores machine-readable instructions executable by the processor, and the processor is used to execute the machine-readable instructions stored in the memory, When the machine-readable instructions are executed by the processor, the processor executes the steps of the request scheduling method according to any one of claims 1 to 8.
- 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被计算机设备运行时,所述计算机设备执行如权利要求1至8任意一项所述的请求调度方法的步骤。A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is run by a computer device, the computer device executes the method according to any one of claims 1 to 8. The steps of the request scheduling method described above.
- 一种计算机程序产品,其特征在于,当所述计算机程序产品在计算机上运行时,使得计算机执行如权利要求1-8中任一项所述的方法。 A computer program product, characterized in that, when the computer program product is run on a computer, it causes the computer to execute the method according to any one of claims 1-8.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210356147.9 | 2022-04-06 | ||
CN202210356147.9A CN114615336A (en) | 2022-04-06 | 2022-04-06 | Request scheduling method and device, computer equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2023193631A1 true WO2023193631A1 (en) | 2023-10-12 |
Family
ID=81869843
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2023/084315 WO2023193631A1 (en) | 2022-04-06 | 2023-03-28 | Request scheduling method and apparatus, and computer device and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN114615336A (en) |
WO (1) | WO2023193631A1 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117749520A (en) * | 2023-12-29 | 2024-03-22 | 云盾智慧安全科技有限公司 | Network traffic scheduling management method and system |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114615336A (en) * | 2022-04-06 | 2022-06-10 | 北京字节跳动网络技术有限公司 | Request scheduling method and device, computer equipment and storage medium |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2013207493A (en) * | 2012-03-28 | 2013-10-07 | Kddi Corp | Wireless lan setting method, program, and its recording medium |
CN106856434A (en) * | 2015-12-08 | 2017-06-16 | 阿里巴巴集团控股有限公司 | The method and apparatus of access request conversion |
CN110120917A (en) * | 2019-06-28 | 2019-08-13 | 北京百度网讯科技有限公司 | Method for routing and device based on content |
WO2021051880A1 (en) * | 2019-09-18 | 2021-03-25 | 平安科技(深圳)有限公司 | Resource data acquisition method and apparatus, computer device and storage medium |
CN113691615A (en) * | 2021-08-23 | 2021-11-23 | 广联达科技股份有限公司 | Service request processing method, system and data gateway |
CN114095415A (en) * | 2021-11-26 | 2022-02-25 | 山石网科通信技术股份有限公司 | Route determining method, device, gateway equipment and storage medium |
CN114615336A (en) * | 2022-04-06 | 2022-06-10 | 北京字节跳动网络技术有限公司 | Request scheduling method and device, computer equipment and storage medium |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106789668B (en) * | 2016-12-12 | 2020-05-22 | 锐捷网络股份有限公司 | Method and device for processing message |
CN109547513A (en) * | 2017-09-22 | 2019-03-29 | 华为技术有限公司 | The treating method and apparatus of application context |
CN110691042A (en) * | 2019-10-23 | 2020-01-14 | 上海艾融软件股份有限公司 | Resource allocation method and device |
US11627129B2 (en) * | 2020-10-14 | 2023-04-11 | Citrix Systems, Inc. | Method and system for contextual access control |
CN113301168A (en) * | 2021-07-23 | 2021-08-24 | 浩鲸云计算科技股份有限公司 | Method and system for realizing accurate shunting of requests by dynamic policy gray scale release engine |
CN113938293A (en) * | 2021-09-23 | 2022-01-14 | 深圳市柔宇科技股份有限公司 | VPN network sharing method, storage medium and terminal device |
-
2022
- 2022-04-06 CN CN202210356147.9A patent/CN114615336A/en active Pending
-
2023
- 2023-03-28 WO PCT/CN2023/084315 patent/WO2023193631A1/en unknown
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2013207493A (en) * | 2012-03-28 | 2013-10-07 | Kddi Corp | Wireless lan setting method, program, and its recording medium |
CN106856434A (en) * | 2015-12-08 | 2017-06-16 | 阿里巴巴集团控股有限公司 | The method and apparatus of access request conversion |
CN110120917A (en) * | 2019-06-28 | 2019-08-13 | 北京百度网讯科技有限公司 | Method for routing and device based on content |
WO2021051880A1 (en) * | 2019-09-18 | 2021-03-25 | 平安科技(深圳)有限公司 | Resource data acquisition method and apparatus, computer device and storage medium |
CN113691615A (en) * | 2021-08-23 | 2021-11-23 | 广联达科技股份有限公司 | Service request processing method, system and data gateway |
CN114095415A (en) * | 2021-11-26 | 2022-02-25 | 山石网科通信技术股份有限公司 | Route determining method, device, gateway equipment and storage medium |
CN114615336A (en) * | 2022-04-06 | 2022-06-10 | 北京字节跳动网络技术有限公司 | Request scheduling method and device, computer equipment and storage medium |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117749520A (en) * | 2023-12-29 | 2024-03-22 | 云盾智慧安全科技有限公司 | Network traffic scheduling management method and system |
Also Published As
Publication number | Publication date |
---|---|
CN114615336A (en) | 2022-06-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2023193631A1 (en) | Request scheduling method and apparatus, and computer device and storage medium | |
JP7333424B2 (en) | Graph generation for distributed event processing systems | |
US9996338B2 (en) | Synchronization of configuration changes between applications and their platforms | |
CN108804306B (en) | Method and system for automatic test system | |
US8799230B2 (en) | Method and system for centralized issue tracking | |
WO2017143844A1 (en) | Data operation method and data management server | |
US20110161349A1 (en) | Message based synchronization for mobile business objects | |
TW201101744A (en) | Method, client computer system, network system, and computer readable medium for remotely printing a document on a network | |
US11340970B2 (en) | Distributed queueing over a Redis cluster | |
US20220292083A1 (en) | System and method for batch and real-time feature computation | |
WO2019161620A1 (en) | Application dependency update method, terminal and device, and storage medium | |
US8527995B2 (en) | Synchronization system for entities maintained by multiple applications | |
US20230205619A1 (en) | Common platform for fulfilling different actions | |
US11669547B2 (en) | Parallel data synchronization of hierarchical data | |
CN110325980B (en) | Expansion method of user interface back-end cluster for database binding type application | |
WO2016090938A1 (en) | Data communication method and apparatus, and computer storage medium | |
CN113360689B (en) | Image retrieval system, method, related device and computer program product | |
US20220391388A1 (en) | Automatic replacement of command parameters during command history searching | |
US20180063242A1 (en) | Method and apparatus for operating infrastructure layer in cloud computing architecture | |
CN113190532A (en) | Data processing method, device, equipment and computer readable storage medium | |
US11455318B2 (en) | Data replication using probabilistic replication filters | |
WO2020006930A1 (en) | Data forgery method and apparatus, and computer storage medium | |
US11954538B2 (en) | Updating a state of a client device using a limited event size protocol | |
CN114896258B (en) | Transaction data synchronization method and device, computer equipment and storage medium | |
US12045258B2 (en) | System and method of providing conditional copying of data |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 23784195 Country of ref document: EP Kind code of ref document: A1 |