CN115022174B - Request processing method and device, readable storage medium and electronic equipment - Google Patents

Request processing method and device, readable storage medium and electronic equipment Download PDF

Info

Publication number
CN115022174B
CN115022174B CN202210697590.2A CN202210697590A CN115022174B CN 115022174 B CN115022174 B CN 115022174B CN 202210697590 A CN202210697590 A CN 202210697590A CN 115022174 B CN115022174 B CN 115022174B
Authority
CN
China
Prior art keywords
service request
resource pool
request
preset
forwarding rule
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210697590.2A
Other languages
Chinese (zh)
Other versions
CN115022174A (en
Inventor
徐俊贤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN202210697590.2A priority Critical patent/CN115022174B/en
Publication of CN115022174A publication Critical patent/CN115022174A/en
Application granted granted Critical
Publication of CN115022174B publication Critical patent/CN115022174B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0823Configuration setting characterised by the purposes of a change of settings, e.g. optimising configuration for enhancing reliability
    • H04L41/0836Configuration setting characterised by the purposes of a change of settings, e.g. optimising configuration for enhancing reliability to enhance reliability, e.g. reduce downtime
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1012Server selection for load balancing based on compliance of requirements or conditions with available server resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention provides a request processing method, a request processing device, a computer readable storage medium and electronic equipment, wherein the method comprises the following steps: receiving a service request sent by a client; responding to the service request to accord with a preset forwarding rule, forwarding the service request to a first resource pool, wherein the first resource pool is used for deploying version data which is not verified and is on line; determining first response data corresponding to the service request based on the first resource pool; and in response to the service request not conforming to the preset forwarding rule, forwarding the service request to a second resource pool, wherein the second resource pool is used for deploying the existing version data on line, and determining second response data corresponding to the service request based on the second resource pool. In the technical scheme provided by the invention, the version data which is directly online and is not verified is deployed in a resource pool different from the existing version data on line, so that the requirement of quick online of the new version data is met, and the influence range of the new version data is effectively reduced.

Description

Request processing method and device, readable storage medium and electronic equipment
Technical Field
The present invention relates to the field of data processing, and more particularly, to a request processing method, apparatus, readable storage medium, and electronic device.
Background
With the continuous development of internet technology, audience groups of internet services are expanding, and service updating speed is faster and faster. At present, in order to ensure the stability of a system, gray level release is often adopted when new version data is released, namely, a gray level period of at least one week is required when iterative version data is updated online each time, so that when problems occur in online logic, the problems can be timely found in the gray level period, rollback is performed as soon as possible, and the influence on a user is reduced. However, when the emergency requirement is met, iteration of the on-line version data needs to be performed as soon as possible, and on-line version data is performed at the minute level, and at the moment, the on-line version data does not have time to pass through gray level verification, so that the version data has a large potential safety hazard after being rapidly on-line, and the influence is large when on-line logic is in a problem.
Disclosure of Invention
The invention provides a request processing method, a request processing device, a computer readable storage medium and electronic equipment, which are used for solving the technical problem that version data have larger potential safety hazards after being rapidly online in the prior art.
According to a first aspect of the present invention, there is provided a request processing method, including:
receiving a service request sent by a client;
Responding to the service request to accord with a preset forwarding rule, forwarding the service request to a first resource pool, wherein the first resource pool is used for deploying version data which is not verified to be online; determining first response data corresponding to the service request based on the first resource pool;
and responding to the service request not conforming to the preset forwarding rule, forwarding the service request to a second resource pool, wherein the second resource pool is used for deploying the existing version data on line, and determining second response data corresponding to the service request based on the second resource pool.
Optionally, the method further comprises:
determining a default parameter value of a system variable corresponding to the service request, wherein the system variable is a parameter which is added in advance and used for indicating a resource pool object, and the default parameter value is used for indicating forwarding to a second resource pool;
the responding to the service request accords with a preset forwarding rule, forwards the service request to a first resource pool, and comprises the following steps:
and responding to the service request to meet a preset forwarding rule, rewriting a default parameter value of the system variable into a dynamic parameter value, and forwarding the service request to a first resource pool based on the dynamic parameter value.
Optionally, the responding to the service request accords with a preset forwarding rule, and rewriting the default parameter value of the system variable into a dynamic parameter value includes:
reading a preset forwarding rule in the Lua script, and acquiring a protocol method corresponding to the service request;
acquiring request parameters carried by the service request based on the protocol method;
and if the request parameter accords with a preset parameter, the service request accords with a preset forwarding rule, and the default parameter value of the system variable is rewritten into a dynamic parameter value.
Optionally, based on the protocol method, the obtaining the request parameter carried by the service request includes:
responding to the protocol method as a GET method, and determining URL parameters carried by the service request as request parameters;
and/or, in response to the protocol method being a POST method, reading the request content of the service request and obtaining the request parameters.
Optionally, the responding to the protocol method being a POST method, reads the request content of the service request, and obtains a request parameter, including:
and responding to the protocol method as a POST method, reading the request content of the service request, and if the target field in the request content is empty, determining the URL parameter carried by the service request as a request parameter.
Optionally, the method further comprises:
determining a resource utilization rate of the second resource pool;
and in response to the resource utilization rate being greater than a preset utilization rate, forwarding the service request to be forwarded to the second resource pool to a third resource pool, wherein the third resource pool is used for deploying the online existing version data.
Optionally, before receiving the service request sent by the client, the method further includes:
when the Nginx interface is preconfigured, determining a target interface, adding a system variable, and assigning the system variable as a default parameter value;
the receiving the service request sent by the client side comprises the following steps:
and receiving a service request which is sent by the client and corresponds to the target interface.
According to a second aspect of the present invention, there is provided a request processing apparatus comprising:
the request receiving module is used for receiving a service request sent by the client;
the first processing module is used for responding to the service request to accord with a preset forwarding rule and forwarding the service request to a first resource pool, wherein the first resource pool is used for deploying version data which is not verified to be online; determining first response data corresponding to the service request based on the first resource pool;
And the second processing module is used for responding to the service request which does not accord with the preset forwarding rule, forwarding the service request to a second resource pool, wherein the second resource pool is used for deploying the on-line existing version data, and determining second response data corresponding to the service request based on the second resource pool.
According to a third aspect of the present invention, there is provided a computer-readable storage medium storing a computer program for executing the above-described request processing method.
According to a fourth aspect of the present invention, there is provided an electronic device comprising:
a processor;
a memory for storing the processor-executable instructions;
the processor is configured to read the executable instruction from the memory and execute the instruction to implement the request processing method described above.
Compared with the prior art, the request processing method, the request processing device, the computer readable storage medium and the electronic equipment provided by the invention at least comprise the following beneficial effects:
when unverified version data is uploaded, the unverified version data is deployed in a first resource pool, stable online existing version data is deployed in a second resource pool, preset forwarding rules are preset, and resource pool objects corresponding to different service requests are determined by using the preset forwarding rules. When the request is processed, judging whether a service request sent by a client accords with a preset forwarding rule, responding to the service request to accord with the preset forwarding rule, forwarding the service request to a first resource pool, and determining first response data corresponding to the service request based on the first resource pool; and responding to the service request not conforming to the preset forwarding rule, forwarding the service request to a second resource pool, and determining second response data corresponding to the service request based on the second resource pool. According to the technical scheme, the first resource pool is newly added, the version data which is not verified and online is deployed in the first resource pool, the requirement of quick online of the new version data can be met by separately deploying the version data which is not verified and online and the existing version data, when the logic on the version data line which is not verified and online subsequently goes wrong, the whole business operation is not stopped under the condition that the existing version data on the line effectively operates, and the influence range of the new version data is effectively reduced.
Drawings
In order to more clearly illustrate the technical solutions of the present invention, the drawings that are needed in the description of the present invention will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart illustrating a request processing method according to an exemplary embodiment of the present invention;
FIG. 2 is a flowchart illustrating a request processing method according to a second embodiment of the present invention;
fig. 3 is a flowchart illustrating steps 2011 to 2013 in a request processing method according to an exemplary embodiment of the present invention;
FIG. 4 is a flowchart illustrating a request processing method according to an exemplary embodiment of the present invention;
FIG. 5 is a schematic diagram of a request processing apparatus according to an exemplary embodiment of the present invention;
fig. 6 is a block diagram of an electronic device according to an exemplary embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made more apparent and fully hereinafter with reference to the accompanying drawings, in which some, but not all embodiments of the invention are shown. All other embodiments, which can be made by one of ordinary skill in the art without creative efforts, based on the embodiments of the present invention are within the protection scope of the present embodiments.
Exemplary method
Fig. 1 is a flow chart of a request processing method according to an exemplary embodiment of the present invention, which at least includes the following steps:
and step 10, receiving a service request sent by the client.
In an embodiment, after the user performs a corresponding operation on the client, a service request is sent to the server, and the server receives the service request. Wherein clients include, but are not limited to, cell phones, computers, smart phones, and smart speakers. The server side comprises, but is not limited to, a server and a cloud server.
In one possible application scenario, a user clicks on a mobile phone to play video a, and at this time, a mobile phone client sends a video access request (service request) to a server, and the server receives the video access request and performs subsequent processing.
Step 20, forwarding the service request to a first resource pool in response to the service request conforming to a preset forwarding rule, wherein the first resource pool is used for deploying version data which is not verified to be online; and determining first response data corresponding to the service request based on the first resource pool.
In an embodiment, the preset forwarding rule is a preset rule for determining a resource pool object corresponding to a service request, the service request accords with the preset forwarding rule, the resource pool object corresponding to the service request is a first resource pool, the service request does not accord with the preset forwarding rule, and the resource pool object corresponding to the service request is a second resource pool. The first resource pool is used for deploying the version data which are not verified and are on line, the specific non-verified version data which are not verified and are on line can be non-stable code data, and potential safety hazards often exist in the non-verified version data, so that the non-verified version data are deployed in a resource pool which is different from the stable version data on line in a mode of adding the resource pool, and the influence range of the non-verified version data is reduced. After the service request is forwarded to the first resource pool, the service request is responded by utilizing the resources in the first resource pool, first response data corresponding to the service request is determined, and the first response data is returned to the client. Wherein the first response data includes, but is not limited to, an access address and password for a resource in the first resource pool.
Specifically, the resources deployed in the first resource pool do not need too many, possibly 3-5 instances, and only a few minutes are needed for one full deployment, so that for new version data on line in emergency needs, only the resources of the first resource pool are required to be redeployed, the requirement of quick on line of the new version data is met, and the influence scope of the new version data is effectively reduced.
In one possible implementation manner, the content of the preset forwarding rule may be that the interface corresponding to the service request is a preset interface. When the service request received by the server corresponds to a preset interface, namely the service request accords with a preset forwarding rule, forwarding the service request to a first resource pool; when the service request received by the server corresponds to a non-preset interface, that is, the service request does not accord with a preset forwarding rule, step 30 is further executed, the service request is forwarded to the second resource pool, and the request flow forwarding based on the interface is realized.
For example, the preset interface corresponding to the preset forwarding rule as the service request is the interface a. When the service terminal is connected to the service request 1, determining an interface corresponding to the service request 1, and if the interface corresponding to the service request 1 is A, conforming to a preset forwarding rule; if the interface corresponding to the service request 1 is B, the service request does not accord with the preset forwarding rule. In the implementation manner, the fact that the preset forwarding rule is met indicates that the service request corresponds to the preset interface and is forwarded to the first resource pool; and if the service request does not accord with the preset forwarding rule, the service request corresponds to a non-preset interface and is forwarded to a second resource pool.
In another possible implementation, the content of the preset forwarding rule may carry the target parameter for the service request. When the service request received by the server side carries the target parameter, namely the service request accords with a preset forwarding rule, the service request is forwarded to a first resource pool; when the service request received by the server does not carry the target parameter, that is, the service request does not accord with the preset forwarding rule, step 30 is further executed to forward the service request to the second resource pool, so as to realize the request flow forwarding based on the parameter. Of course, a plurality of target parameters may be set, and the request traffic may be forwarded after the condition aggregation of the plurality of target parameters is performed.
For example, the preset forwarding rule is that the target parameter carried by the service request is [ "agent type" ] = "32". When the service terminal is connected to the service request 2, determining parameter information carried by the service request 2, and if the parameter information carried by the service request 2 is [ "agent type" ] = "32", conforming the service request to a preset forwarding rule; if the parameter information carried by the service request 2 is [ "agent type" ] = "16", the service request does not conform to the preset forwarding rule. In the implementation manner, the fact that the preset forwarding rule is met indicates that the service request carries the target parameter and is forwarded to the first resource pool; and if the service request does not meet the preset forwarding rule, the service request does not carry the target parameter and is forwarded to the second resource pool.
In another possible implementation manner, the content of the preset forwarding rule may also be a target method for a protocol method corresponding to the service request. When a protocol method corresponding to a service request received by a server is a target method, namely the service request accords with a preset forwarding rule, forwarding the service request to a first resource pool; when the protocol method corresponding to the service request received by the server is a non-target method, the service request does not accord with the preset forwarding rule, and then step 30 is executed to forward the service request to the second resource pool, so as to realize the forwarding of the request flow based on the method.
For example, the protocol method corresponding to the preset forwarding rule as the service request is a GET method. When the service terminal is connected to the service request 3, determining a protocol method corresponding to the service request 3, and if the protocol method corresponding to the service request 3 is a GET method, conforming the service request to a preset forwarding rule; if the protocol method corresponding to the service request 3 is a POST method, the service request does not accord with the preset forwarding rule. In the implementation manner, a protocol method corresponding to a service request is represented as a target method according to a preset forwarding rule, and is forwarded to a first resource pool; and if the protocol method does not accord with the preset forwarding rule, the protocol method corresponding to the service request is a non-target method and is forwarded to the second resource pool.
It should be noted that, the content of the preset forwarding rule may also be a combination of the above implementation manners, for example, the preset forwarding rule is that an interface corresponding to the service request is a preset interface, and the corresponding protocol method is a target method. And forwarding the request traffic of different service requests by setting different preset forwarding rules. In this embodiment, the specific content of the preset forwarding rule is not limited, and a user may set according to an actual requirement, and may determine the resource pool objects corresponding to different service requests through the preset forwarding rule.
And step 30, in response to the service request not conforming to the preset forwarding rule, forwarding the service request to a second resource pool, wherein the second resource pool is used for deploying the online existing version data, and determining second response data corresponding to the service request based on the second resource pool.
In an embodiment, the second resource pool deploys the on-line version data, which may be a code version verified by a gray period, and is stable version data, and is usually safer to use in long-term operation. If the existing version data on the line is directly iterated and replaced by the version data on the line which is not verified, when the on-line logic of the version data on the line which is not verified subsequently is problematic, the operation of the whole service is affected, and the influence range is larger. In this embodiment, the service request is forwarded through a preset forwarding rule, and for the service request forwarded to the second resource pool, the service request is responded by using the resources in the second resource pool, second response data corresponding to the service request is determined, and the second response data is returned to the client, so that the second resource pool can still operate normally even if the on-line logic problem exists in the version data which is not verified to be on-line. Wherein the second response data includes, but is not limited to, an access address and password for the resource in the second resource pool.
In the above embodiment, when unverified version data is online, the unverified version data is deployed in a first resource pool, and stable online existing version data is deployed in a second resource pool, and preset forwarding rules are preset, and resource pool objects corresponding to different service requests are determined by using the preset forwarding rules. When the request is processed, judging whether a service request sent by a client accords with a preset forwarding rule, responding to the service request to accord with the preset forwarding rule, forwarding the service request to a first resource pool, and determining first response data corresponding to the service request based on the first resource pool; and responding to the service request not conforming to the preset forwarding rule, forwarding the service request to a second resource pool, and determining second response data corresponding to the service request based on the second resource pool. In the embodiment, a first resource pool is newly added, the version data which is not verified and online is deployed in the first resource pool, the requirement of quick online of the version data can be met by separately deploying the version data which is not verified and online existing version data, and when the online logic of the version data which is not verified and online subsequently has a problem, the whole business operation is not stagnated under the condition that the online existing version data effectively operates, so that the influence range of the new version data is effectively reduced.
As shown in fig. 2, in an exemplary embodiment of the present invention, the method further includes:
step 40, determining a default parameter value of a system variable corresponding to the service request, wherein the system variable is a parameter which is added in advance and used for indicating a resource pool object, and the default parameter value is used for indicating forwarding to a second resource pool.
In this embodiment, the step 20 includes:
and step 201, in response to the service request conforming to a preset forwarding rule, rewriting a default parameter value of the system variable into a dynamic parameter value, and forwarding the service request to a first resource pool based on the dynamic parameter value.
Step 202, determining first response data corresponding to the service request based on the first resource pool.
In one possible implementation manner, the forwarding the service request to the second resource pool in response to the service request not meeting the preset forwarding rule includes: and responding to the service request not conforming to the preset forwarding rule, and forwarding the service request to a second resource pool based on the default parameter value of the system variable.
In the above embodiment, a system variable is preset, where the system variable is used to indicate a resource pool object, and assign the system variable to a default parameter value, and for each received service request, the system variable corresponding to the service request is a default parameter value, where the default parameter value is used to indicate that the resource pool object is a second resource pool, that is, if the default parameter value of the system variable is not rewritten, the service request is forwarded to the second resource pool for processing. After receiving the service request, judging whether the service request accords with a preset forwarding rule, if so, rewriting a default parameter value of a system variable into a dynamic parameter value, wherein the dynamic parameter value is used for indicating a resource pool object as a first resource pool, and forwarding the service request to the first resource pool according to the rewritten dynamic parameter value. And controlling the resource pool object corresponding to the service request through the parameter value of the system variable, and when the service request accords with the preset forwarding rule, rewriting the default parameter value of the system variable, so that the resource pool object corresponding to different service requests can be rapidly and accurately determined.
As shown in fig. 3, in an exemplary embodiment of the present invention, the step 201 of rewriting the default parameter values of the system variables to dynamic parameter values in response to the service request conforming to a preset forwarding rule includes:
and 2011, reading a preset forwarding rule in the Lua script, and acquiring a protocol method corresponding to the service request.
In an embodiment, a predetermined forwarding rule is set through a Lua script, and Lua is a light-weight scripting language and has high performance, and because of the compactness, rapidness and built-in cooperative range of Lua, the Lua script is adopted to realize service logic, so that the realization cost of the service logic is greatly reduced while the high concurrency service capability is ensured. And reading a preset forwarding rule set in the Lua script, and acquiring a protocol method corresponding to the service request according to the content of the preset forwarding rule. The specific protocol method is an HTTP protocol method.
Step 2012, based on the protocol method, obtaining the request parameters carried by the service request.
In an embodiment, the service request may carry request parameters, where the request parameters include, but are not limited to Agenttype, source, user id, and different protocol methods, and the manner of obtaining the request parameters carried by the service request is different, so after determining the protocol method corresponding to the service request, the request parameters carried by the service request are further obtained according to the protocol method corresponding to the service request.
Specifically, a target method is preset, and the obtaining, based on the protocol method, a request parameter carried by the service request includes: judging whether the protocol method is a target method or not, and if the protocol request is the target method, acquiring request parameters carried by the service request based on the protocol request. The target method can be set as a GET method, or a POST method, or a GET method and a POST method, so that preliminary request flow screening based on the target method is realized.
In one possible implementation manner, the obtaining, based on the protocol method, a request parameter carried by the service request includes: and determining the URL parameter carried by the service request as a request parameter in response to the protocol method being a GET method. At this time, the target method may be set as a GET method, so that when it is determined that the protocol method corresponding to the service request is the GET method, a URL parameter in the GET method is obtained, the URL parameter is determined as a request parameter, and at this time, preliminary request traffic screening based on the GET method is implemented.
In another possible implementation manner, the obtaining, based on the protocol method, a request parameter carried by the service request includes: and responding to the protocol method being a POST method, reading the request content of the service request and obtaining request parameters. At this time, the target method can be set as a POST method, so that when the protocol method corresponding to the service request is determined to be the POST method, the request content of the service request is read, the request parameters are obtained, and at this time, preliminary request flow screening based on the POST method is realized.
Further, the responding to the protocol method being a POST method, reading the request content of the service request, and obtaining the request parameters includes: and responding to the protocol method as a POST method, reading the request content of the service request, and if the target field in the request content is empty, determining the URL parameter carried by the service request as a request parameter. In one possible application scenario, the protocol method is a nonstandard POST method, where the target field in the request content may be null, where the target field is a preselected field, for example, a "from" field, and in order to further obtain the request parameter, the URL parameter carried by the service request is obtained, and the URL parameter is determined as the request parameter.
In another possible implementation manner, the obtaining, based on the protocol method, a request parameter carried by the service request includes: responding to the protocol method as a GET method, and determining URL parameters carried by the service request as request parameters; and responding to the protocol method being a POST method, reading the request content of the service request and obtaining request parameters. At the moment, preliminary request flow screening based on a GET method and a POST method is realized.
Step 2013, if the request parameter meets the preset parameter, the service request meets a preset forwarding rule, the default parameter value of the system variable is rewritten into a dynamic parameter value, and the service request is forwarded to the first resource pool based on the dynamic parameter value.
In an embodiment, a preset parameter is specified in advance, a judgment logic in the content of a preset forwarding rule is set as whether the request parameter accords with the preset parameter, if the request parameter accords with the preset parameter, namely, the service request accords with the preset forwarding rule, so that a default parameter value of a system variable is rewritten into a dynamic parameter value, and request flow forwarding based on the preset parameter is realized.
Further, if the request parameter meets a preset parameter, the service request meets a preset forwarding rule, and the rewriting the default parameter value of the system variable into a dynamic parameter value includes: and if the request parameter value corresponding to the request parameter accords with the preset parameter value corresponding to the preset parameter, the service request accords with a preset forwarding rule, and the default parameter value of the system variable is rewritten into a dynamic parameter value. That is, the preset parameters are designated in advance, the preset parameter values are designated, the judgment logic in the preset forwarding rule content is set to be whether the request parameter values accord with the preset parameter values, if the request parameter values accord with the preset parameter values, the service request accords with the preset forwarding rule, and therefore the default parameter values of the system variables are rewritten to dynamic parameter values, and forwarding of the request flow based on the preset parameters and the preset parameter values is achieved.
In this embodiment, the method further includes: when the Nginx interface is preconfigured, determining a target interface, adding a system variable, and assigning the system variable as a default parameter value;
correspondingly, the receiving the service request sent by the client includes: and receiving a service request which is sent by the client and corresponds to the target interface.
And (3) carrying out rule configuration on the Nginx interface in advance, when the configuration is carried out, delineating the target interface, adding a system variable, assigning the system variable as a default parameter value, after the target interface is delineating, after receiving a service request corresponding to the target interface, further executing step 20 and step 30, further realizing preliminary request flow screening based on the target interface, and carrying out further request flow forwarding on the preliminarily screened service request through a preset forwarding rule.
For example, the nginnx interface is configured in advance, and the interface configuration rule is illustrated as follows:
that is, two target interfaces, i.e., the/apis/threldrate/callback/action, are determined by using the location/apis/threldrate/(logic|callback). Action; and (3) adding a system variable passapi_new_feature_upstream by using a set $ passapi_new_feature_upstream "threaded_pool", and simultaneously assigning a default parameter value of the system variable as threaded_pool, wherein threaded_pool is a second resource pool, namely, the threaded_pool is internally provided with on-line version data. Loading a script of passapi_new_feature_request_request.lua, rewriting default parameter values of system variables through a preset forwarding rule set in the Lua script, and forwarding dynamic request traffic according to the rewritten system variables. An example of the Lua script passapi_new_feature_update.lua is as follows:
That is, a protocol Method for acquiring a service request, that is, HTTP Method, acquires a URL parameter using ngx.req.get_uri_args () when the service request corresponds to the GET Method, and assigns the URL parameter to args. When the service request corresponds to a POST method, reading request content through ngx.req.read_body (), and assigning a parameter value in the request content to args; the target field 'from' is preset, when the target field 'from' is judged to be empty, the URL parameter of the service request is acquired through ngx.req.get_uri_args (), and the URL parameter is assigned to args. Further, whether the args has an "agenttype" parameter (preset parameter) and whether the value of the agenttype parameter is equal to 32 (preset parameter value) is determined, if the args has the "agenttype" parameter and the value is 32, the variable passapi_new_feature_up is assigned as passport_new_feature_up. The system parameters are rewritten through the preset forwarding rules set by the Lua script, if the preset forwarding rules are met, the request flow is forwarded to a first resource pool, namely, a report_new_feature_upstream by the nginx; if the preset forwarding rule is not met, the request flow is forwarded to a default second resource pool, namely the third resource pool. And dynamically changing system variables by configuring the variable names of the upstream through proxy_pass of Nginx, so as to forward different request flows to different resource pool objects.
In the above embodiment, by using the combination method of the nginnx and the Lua script, a specific preset forwarding rule is formulated according to the actual service situation, and the relevant request traffic is forwarded to the first resource pool, so that the requirement of fast online of new version data can be met, and the influence scope of the new version data can be reduced.
As shown in fig. 4, in an embodiment of the present invention, the method further includes:
and step 50, determining the resource utilization rate of the second resource pool.
And step 60, in response to the resource utilization rate being greater than the preset utilization rate, forwarding the service request to be forwarded to the second resource pool to a third resource pool, wherein the third resource pool is used for deploying the existing version data on the line.
In the above embodiment, a third resource pool is added, where the third resource pool is used to deploy the existing version data on the line, and the third resource pool may be regarded as a branch of the second resource pool. When the resource utilization rate of the second resource pool is larger than the preset utilization rate, the service request which is originally forwarded to the second resource pool is forwarded to a third resource pool, so that the third resource pool processes the temporarily-increased service request. The temporarily-increased service request is a service request that suddenly increases in a specific time period, for example, when a certain television shows a hot spot, or when a certain public host broadcasts a live broadcast, or when a certain evening broadcasts, there may be a temporarily-increased service request, and if the temporarily-increased service request updates the second resource pool, the second resource pool may be idle. Therefore, by adding the third resource pool, the temporarily-increased service request is forwarded to the third resource pool, so that quick and flexible response can be made to the temporarily-increased service request, resources in the third resource pool can be recovered in time when the temporarily-increased service request disappears, the flexibility of resource pool configuration is ensured, and the second resource pool is protected.
ExampleSex device
Based on the same conception as the embodiment of the method, the embodiment of the invention also provides a request processing device.
Fig. 5 is a schematic structural diagram of a request processing apparatus according to an exemplary embodiment of the present invention, including:
a request receiving module 51, configured to receive a service request sent by a client;
a first processing module 52, configured to forward the service request to a first resource pool in response to the service request conforming to a preset forwarding rule, where the first resource pool is used to deploy version data that is not verified to be online; determining first response data corresponding to the service request based on the first resource pool;
and the second processing module 53 is configured to forward the service request to a second resource pool in response to the service request not conforming to the preset forwarding rule, where the second resource pool is used to deploy on-line existing version data, and determine second response data corresponding to the service request based on the second resource pool.
In an exemplary embodiment of the invention, the apparatus further comprises:
the parameter determining module is used for determining a default parameter value of a system variable corresponding to the service request, wherein the system variable is a parameter which is added in advance and used for indicating a resource pool object, and the default parameter value is used for indicating forwarding to a second resource pool;
The first processing module includes:
a parameter rewriting unit, configured to rewrite a default parameter value of the system variable into a dynamic parameter value in response to the service request conforming to a preset forwarding rule, and forward the service request to a first resource pool based on the dynamic parameter value;
and the request response unit is used for determining first response data corresponding to the service request based on the first resource pool.
In an exemplary embodiment of the present invention, the parameter rewriting unit includes:
the method acquisition subunit is used for reading a preset forwarding rule in the Lua script and acquiring a protocol method corresponding to the service request;
a parameter obtaining subunit, configured to obtain a request parameter carried by the service request based on the protocol method;
and the parameter rewriting subunit is used for rewriting the default parameter value of the system variable into a dynamic parameter value and forwarding the service request to the first resource pool based on the dynamic parameter value if the request parameter accords with a preset parameter and the service request accords with a preset forwarding rule.
In an exemplary embodiment of the present invention, the parameter obtaining subunit is configured to determine, as a request parameter, a URL parameter carried by the service request in response to the protocol method being a GET method; and/or, in response to the protocol method being a POST method, reading the request content of the service request and obtaining the request parameters.
In an exemplary embodiment of the present invention, the parameter obtaining subunit is configured to determine, as a request parameter, a URL parameter carried by the service request in response to the protocol method being a GET method; and/or, in response to the protocol method being a POST method, reading the request content of the service request, and if the target field in the request content is empty, determining the URL parameter carried by the service request as a request parameter.
In an exemplary embodiment of the invention, the apparatus further comprises: a resource protection module; the resource protection module is configured to determine a resource usage rate of the second resource pool; and in response to the resource utilization rate being greater than a preset utilization rate, forwarding the service request to be forwarded to the second resource pool to a third resource pool, wherein the third resource pool is used for deploying the online existing version data.
In an exemplary embodiment of the invention, the apparatus further comprises:
the parameter configuration module is used for determining a target interface, adding a system variable and assigning the system variable as a default parameter value when the Nginx interface is preconfigured;
the request receiving module is used for receiving the service request of the corresponding target interface sent by the client.
Exemplary electronic device
Fig. 6 illustrates a block diagram of an electronic device according to an embodiment of the invention.
As shown in fig. 6, the electronic device 100 includes one or more processors 101 and memory 102.
The processor 101 may be a Central Processing Unit (CPU) or other form of processing unit having data processing and/or instruction execution capabilities and may control other components in the electronic device 100 to perform desired functions.
Memory 102 may include one or more computer program products that may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. The volatile memory may include, for example, random Access Memory (RAM) and/or cache memory (cache), and the like. The non-volatile memory may include, for example, read Only Memory (ROM), hard disk, flash memory, and the like. One or more computer program instructions may be stored on the computer readable storage medium that can be executed by the processor 101 to implement the request processing methods and/or other desired functions of the various embodiments of the present invention described above.
In one example, the electronic device 100 may further include: an input device 103 and an output device 104, which are interconnected by a bus system and/or other forms of connection mechanisms (not shown).
Of course, only some of the components of the electronic device 100 that are relevant to the present invention are shown in fig. 6 for simplicity, components such as buses, input/output interfaces, etc. are omitted. In addition, the electronic device 100 may include any other suitable components depending on the particular application.
Exemplary computer program product and computer readable storage Medium
In a sixth aspect, embodiments of the invention may be a computer program product comprising computer program instructions, in addition to the above-described methods and devices, which when executed by a processor cause the processor to perform the steps in a request processing method according to various embodiments of the invention described in the above-described "exemplary methods" section of this specification.
The computer program product may write program code for performing operations of embodiments of the present invention in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device, partly on a remote computing device, or entirely on the remote computing device or server.
Furthermore, embodiments of the present invention may also be a computer-readable storage medium, having stored thereon computer program instructions that, when executed by a processor, cause the processor to perform steps in a request processing method according to various embodiments of the present invention described in the "exemplary method" section above in the present specification.
The computer readable storage medium may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may include, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable disk, a hard disk, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The basic principles of the present invention have been described above in connection with specific embodiments, however, it should be noted that the advantages, benefits, effects, etc. mentioned in the present invention are merely examples and not intended to be limiting, and these advantages, benefits, effects, etc. are not to be considered as essential to the various embodiments of the present invention. Furthermore, the specific details of the invention described above are for purposes of illustration and understanding only, and are not intended to be limiting, as the invention may be practiced with the specific details described above.
The block diagrams of the devices, apparatuses, devices, systems referred to in the present invention are only illustrative examples and are not intended to require or imply that the connections, arrangements, configurations must be made in the manner shown in the block diagrams. As will be appreciated by one of skill in the art, the devices, apparatuses, devices, systems may be connected, arranged, configured in any manner. Words such as "including," "comprising," "having," and the like are words of openness and mean "including but not limited to," and are used interchangeably therewith. The terms "or" and "as used herein refer to and are used interchangeably with the term" and/or "unless the context clearly indicates otherwise. The term "such as" as used herein refers to, and is used interchangeably with, the phrase "such as, but not limited to.
It is also noted that in the apparatus, devices and methods of the present invention, the components or steps may be disassembled and/or assembled. Such decomposition and/or recombination should be considered as equivalent aspects of the present invention.
The previous description of the inventive aspects is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these aspects will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other aspects without departing from the scope of the invention. Thus, the present invention is not intended to be limited to the aspects shown herein but is to be accorded the widest scope consistent with the principles and novel features herein.
The foregoing description has been presented for purposes of illustration and description. Furthermore, this description is not intended to limit embodiments of the invention to the form disclosed herein. Although a number of example aspects and embodiments have been discussed above, a person of ordinary skill in the art will recognize certain variations, modifications, alterations, additions, and subcombinations thereof.

Claims (10)

1. A method of processing a request, comprising:
receiving a service request sent by a client;
responding to the service request to accord with a preset forwarding rule, forwarding the service request to a first resource pool, wherein the first resource pool is used for deploying version data which is not verified to be online; determining first response data corresponding to the service request based on the first resource pool, wherein the preset forwarding rule is preset so as to determine resource pool objects corresponding to different service requests by using the preset forwarding rule; the content of the preset forwarding rule comprises at least one of the following: the interface corresponding to the service request is a preset interface, the service request carries target parameters, and the protocol method corresponding to the service request is a target method;
and responding to the service request not conforming to the preset forwarding rule, forwarding the service request to a second resource pool, wherein the second resource pool is used for deploying the existing version data on line, and determining second response data corresponding to the service request based on the second resource pool.
2. The method according to claim 1, wherein the method further comprises:
determining a default parameter value of a system variable corresponding to the service request, wherein the system variable is a parameter which is added in advance and used for indicating a resource pool object, and the default parameter value is used for indicating forwarding to a second resource pool;
the responding to the service request accords with a preset forwarding rule, forwards the service request to a first resource pool, and comprises the following steps:
and responding to the service request to meet a preset forwarding rule, rewriting a default parameter value of the system variable into a dynamic parameter value, and forwarding the service request to a first resource pool based on the dynamic parameter value.
3. The method of claim 2, wherein the adapting the default parameter value of the system variable to the dynamic parameter value in response to the service request conforming to a preset forwarding rule comprises:
reading a preset forwarding rule in the Lua script, and acquiring a protocol method corresponding to the service request;
acquiring request parameters carried by the service request based on the protocol method;
and if the request parameter accords with a preset parameter, the service request accords with a preset forwarding rule, and the default parameter value of the system variable is rewritten into a dynamic parameter value.
4. The method according to claim 3, wherein the obtaining, based on the protocol method, a request parameter carried by the service request includes:
responding to the protocol method as a GET method, and determining URL parameters carried by the service request as request parameters; and/or the number of the groups of groups,
and responding to the protocol method being a POST method, reading the request content of the service request and obtaining request parameters.
5. The method of claim 4, wherein the responding to the protocol method being a POST method, reading the request content of the service request, and obtaining the request parameters includes:
and responding to the protocol method as a POST method, reading the request content of the service request, and if the target field in the request content is empty, determining the URL parameter carried by the service request as a request parameter.
6. The method according to claim 1, wherein the method further comprises:
determining a resource utilization rate of the second resource pool;
and in response to the resource utilization rate being greater than a preset utilization rate, forwarding the service request to be forwarded to the second resource pool to a third resource pool, wherein the third resource pool is used for deploying the online existing version data.
7. The method according to any of claims 1-6, wherein prior to receiving the service request sent by the client, the method further comprises:
when the Nginx interface is preconfigured, determining a target interface, adding a system variable, and assigning the system variable as a default parameter value;
the receiving the service request sent by the client side comprises the following steps:
and receiving a service request which is sent by the client and corresponds to the target interface.
8. A request processing apparatus, comprising:
the request receiving module is used for receiving a service request sent by the client;
the first processing module is used for responding to the service request to accord with a preset forwarding rule and forwarding the service request to a first resource pool, wherein the first resource pool is used for deploying version data which is not verified to be online; determining first response data corresponding to the service request based on the first resource pool, wherein the preset forwarding rule is preset so as to determine resource pool objects corresponding to different service requests by using the preset forwarding rule; the content of the preset forwarding rule comprises at least one of the following: the interface corresponding to the service request is a preset interface, the service request carries target parameters, and the protocol method corresponding to the service request is a target method;
And the second processing module is used for responding to the service request which does not accord with the preset forwarding rule, forwarding the service request to a second resource pool, wherein the second resource pool is used for deploying the on-line existing version data, and determining second response data corresponding to the service request based on the second resource pool.
9. A computer-readable storage medium storing a computer program for executing the request processing method according to any one of the preceding claims 1 to 7.
10. An electronic device, the electronic device comprising:
a processor;
a memory for storing the processor-executable instructions;
the processor being configured to read the executable instructions from the memory and execute the instructions to implement the request processing method of any of the preceding claims 1-7.
CN202210697590.2A 2022-06-20 2022-06-20 Request processing method and device, readable storage medium and electronic equipment Active CN115022174B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210697590.2A CN115022174B (en) 2022-06-20 2022-06-20 Request processing method and device, readable storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210697590.2A CN115022174B (en) 2022-06-20 2022-06-20 Request processing method and device, readable storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN115022174A CN115022174A (en) 2022-09-06
CN115022174B true CN115022174B (en) 2024-03-26

Family

ID=83074960

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210697590.2A Active CN115022174B (en) 2022-06-20 2022-06-20 Request processing method and device, readable storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN115022174B (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103905225A (en) * 2012-12-25 2014-07-02 ***通信集团浙江有限公司 Service control method, service control device and service system
CN105955761A (en) * 2016-06-30 2016-09-21 乐视控股(北京)有限公司 Docker-based gray level issuing device and docker-based gray level issuing method
CN106998369A (en) * 2017-05-26 2017-08-01 努比亚技术有限公司 Gray scale dissemination method, gateway blocker and computer-readable recording medium
CN109857428A (en) * 2018-12-29 2019-06-07 大唐软件技术股份有限公司 Gray scale dissemination method for IOM system
CN110365502A (en) * 2018-03-26 2019-10-22 华为技术有限公司 A kind of method, apparatus and storage medium of service upgrade management
CN111857763A (en) * 2019-04-30 2020-10-30 北京达佳互联信息技术有限公司 Data processing method and device, electronic equipment and storage medium
CN111897542A (en) * 2020-08-31 2020-11-06 北京三快在线科技有限公司 Method and device for gray scale release
CN111988200A (en) * 2020-08-18 2020-11-24 湖南快乐阳光互动娱乐传媒有限公司 Automatic regression testing method and device based on real flow
WO2020252751A1 (en) * 2019-06-20 2020-12-24 深圳市欢太科技有限公司 Resource pushing method, device, server, and storage medium
CN112162762A (en) * 2020-10-16 2021-01-01 中国工商银行股份有限公司 Gray scale distribution method, gray scale distribution device and electronic equipment
CN112988394A (en) * 2021-04-20 2021-06-18 北京世纪好未来教育科技有限公司 Business service publishing method, device, medium and equipment based on cloud native container
CN113676549A (en) * 2021-09-02 2021-11-19 京东科技信息技术有限公司 Application request distribution method, application gateway, electronic device and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060236319A1 (en) * 2005-04-15 2006-10-19 Microsoft Corporation Version control system
CN110120917B (en) * 2019-06-28 2024-02-02 北京瑛菲网络科技有限公司 Routing method and device based on content

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103905225A (en) * 2012-12-25 2014-07-02 ***通信集团浙江有限公司 Service control method, service control device and service system
CN105955761A (en) * 2016-06-30 2016-09-21 乐视控股(北京)有限公司 Docker-based gray level issuing device and docker-based gray level issuing method
CN106998369A (en) * 2017-05-26 2017-08-01 努比亚技术有限公司 Gray scale dissemination method, gateway blocker and computer-readable recording medium
CN110365502A (en) * 2018-03-26 2019-10-22 华为技术有限公司 A kind of method, apparatus and storage medium of service upgrade management
CN109857428A (en) * 2018-12-29 2019-06-07 大唐软件技术股份有限公司 Gray scale dissemination method for IOM system
CN111857763A (en) * 2019-04-30 2020-10-30 北京达佳互联信息技术有限公司 Data processing method and device, electronic equipment and storage medium
WO2020252751A1 (en) * 2019-06-20 2020-12-24 深圳市欢太科技有限公司 Resource pushing method, device, server, and storage medium
CN111988200A (en) * 2020-08-18 2020-11-24 湖南快乐阳光互动娱乐传媒有限公司 Automatic regression testing method and device based on real flow
CN111897542A (en) * 2020-08-31 2020-11-06 北京三快在线科技有限公司 Method and device for gray scale release
CN112162762A (en) * 2020-10-16 2021-01-01 中国工商银行股份有限公司 Gray scale distribution method, gray scale distribution device and electronic equipment
CN112988394A (en) * 2021-04-20 2021-06-18 北京世纪好未来教育科技有限公司 Business service publishing method, device, medium and equipment based on cloud native container
CN113676549A (en) * 2021-09-02 2021-11-19 京东科技信息技术有限公司 Application request distribution method, application gateway, electronic device and storage medium

Also Published As

Publication number Publication date
CN115022174A (en) 2022-09-06

Similar Documents

Publication Publication Date Title
CN109618176B (en) Processing method, equipment and storage medium for live broadcast service
CN110826799B (en) Service prediction method, device, server and readable storage medium
CN106375866B (en) Page loading method and terminal
CN111586437B (en) Barrage message processing method, system, computing device and storage medium
CN113572833B (en) Cloud mobile phone maintenance method and device, electronic equipment and storage medium
CN115022174B (en) Request processing method and device, readable storage medium and electronic equipment
CN111698281B (en) Resource downloading method and device, electronic equipment and storage medium
CN113835789A (en) Rendering method, rendering device, electronic equipment and computer storage medium
CN115865718A (en) Service arrangement control method and device based on Yaml template
CN115811481A (en) Interactive service testing method and device, computer equipment and storage medium
CN104407846B (en) Information processing method and device
CN114020360A (en) Method, device and equipment for preloading small program resources and storage medium
CN115914219A (en) Task request processing method, device and system, readable storage medium and electronic equipment
CN113946376A (en) Load adjustment method and device, electronic equipment and storage medium
CN107315951B (en) Program installation package anti-interception method and device
CN114077409A (en) Screen projection method and device, electronic equipment and computer readable medium
CN105991728B (en) File downloading method and terminal
CN115129469B (en) Cross-process communication method, device, equipment and storage medium
CN114157917B (en) Video editing method and device and terminal equipment
CN110858240A (en) Front-end module loading method and device
CN110704026A (en) Calling method and device of software development kit, terminal and readable medium
CN113094607B (en) Method and device for obtaining local resources
CN113645214B (en) Data detection method, device, electronic equipment and readable storage medium
CN112596793B (en) Redirection method and device for composite equipment
CN115473806A (en) Resource downloading control method and device, electronic equipment and computer readable medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant