CN113037862A - Service request processing method, device, equipment and storage medium - Google Patents

Service request processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN113037862A
CN113037862A CN202110341184.8A CN202110341184A CN113037862A CN 113037862 A CN113037862 A CN 113037862A CN 202110341184 A CN202110341184 A CN 202110341184A CN 113037862 A CN113037862 A CN 113037862A
Authority
CN
China
Prior art keywords
current limiting
service request
limiting parameter
parameter
current
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.)
Granted
Application number
CN202110341184.8A
Other languages
Chinese (zh)
Other versions
CN113037862B (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 Sankuai Online Technology Co Ltd
Original Assignee
Beijing Sankuai Online 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 Sankuai Online Technology Co Ltd filed Critical Beijing Sankuai Online Technology Co Ltd
Priority to CN202110341184.8A priority Critical patent/CN113037862B/en
Publication of CN113037862A publication Critical patent/CN113037862A/en
Application granted granted Critical
Publication of CN113037862B publication Critical patent/CN113037862B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/61Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources taking into account QoS or priority requirements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/63Routing a service request depending on the request content or context

Landscapes

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

Abstract

The application provides a service request processing method, a service request processing device, service request processing equipment and a storage medium, and belongs to the technical field of Internet. The method comprises the following steps: receiving a service request sent by a first client, wherein the service request is used for requesting to call a third-party server to perform service processing; acquiring a first current limiting parameter corresponding to a current time period, wherein the first current limiting parameter is a current limiting parameter for processing a service request received in the current time period, and the first current limiting parameter is updated based on different time periods; and calling the third-party server to process the service request based on the first current limiting parameter. The method realizes the dynamic adjustment of the current limiting parameter at the service request outlet, thereby improving the service efficiency of the third-party server to the service request.

Description

Service request processing method, device, equipment and storage medium
Technical Field
The present application relates to the field of internet technologies, and in particular, to a method, an apparatus, a device, and a storage medium for processing a service request.
Background
With the development of internet technology, the application of network services is more and more common; while providing network services, an internet often requires a third-party network service provider to provide network services. When a third-party network service party is accessed by a large number of service requests of any internet, the service quality is reduced due to the service requests which are instantly inrush, and even the third-party network service party is broken down, so that the service requests need to be limited to ensure the normal operation of the third-party network service party.
In the related art, a third-party network service party generally performs current limiting on a service request entering the third-party network service party at a gateway layer, and a current limiting policy of the third-party network service party is to limit the current of the service request based on a fixed current limiting frequency stored by the third-party network service party. Because the current limiting frequency is fixed, when the initiation frequency of the service request is higher than the threshold value of the current limiting frequency, the service request except the current limiting frequency cannot be processed by the third-party network service party, so that the service request fails to call the third-party network service, the service efficiency of the third-party network service party is low, and the service quality of the third-party network service party is further reduced.
Disclosure of Invention
The embodiment of the application provides a method and a device for processing a service request, a server and a storage medium, which can improve the service efficiency of a third-party network service party. The technical scheme is as follows:
in one aspect, a method for processing a service request is provided, where the method includes:
receiving a service request sent by a first client, wherein the service request is used for requesting to call a third-party server to perform service processing;
acquiring a first current limiting parameter corresponding to a current time period, wherein the first current limiting parameter is a current limiting parameter for processing a service request received in the current time period, and the first current limiting parameter is updated based on different time periods;
and calling the third-party server to process the service request based on the first current limiting parameter.
In a possible implementation manner, the invoking the third-party server to process the service request based on the first current limiting parameter includes:
responding to the request parameter of the service request to meet the current limiting condition, calling the service parameter of the third-party server in the current period to reach the threshold value of the first current limiting parameter, and carrying out speed limiting processing on the service request;
and responding to the request parameter of the service request not meeting the current limiting condition or calling the service parameter of the third-party server in the current period not reaching the threshold value of the first current limiting parameter, and requesting the third-party server to process the service request.
In a possible implementation manner, the performing the speed limit processing on the service request includes:
and adding the service request into a target waiting queue, wherein the service request in the target waiting queue is used for waiting for scheduled processing.
In a possible implementation manner, the adding the service request to a target waiting queue includes:
adding the service request to the end of the target wait queue based on the request time of the service request; or,
and determining a target position with the matched priority in the target waiting queue based on the priority of the service request, and adding the service request to the target position in the target waiting queue.
In a possible implementation manner, the adding the service request to a target waiting queue includes:
determining the service type of the service request;
acquiring a target waiting queue matched with the service type, wherein the target waiting queue is used for storing the service request of the service type;
and adding the service request into the target waiting queue.
In one possible implementation, the method further includes:
acquiring the timeout timestamp of each service request in the target waiting queue, wherein the timeout timestamp of any service request is used for indicating that the any service request can fail after the timeout timestamp;
determining a target service request from the target waiting queue, wherein the target service request is a service request with an overtime timestamp earlier than the current time;
and deleting the target service request from the target waiting queue.
In a possible implementation manner, the invoking the third-party server to process the service request based on the first current limiting parameter includes:
configuring a speed limiter example based on the first current limiting parameter, wherein the first current limiting parameter of the speed limiter example is the first current limiting parameter;
and calling the third-party server to process the service request through the speed limiter example.
In one possible implementation, the method further includes:
responding to the current time entering the next time period, and acquiring a second current limiting parameter corresponding to the next time period, wherein the second current limiting parameter is a current limiting parameter for processing a service request received in the next time period;
and updating the first current limiting parameter corresponding to the current time period to the second current limiting parameter corresponding to the next time period.
In a possible implementation manner, the obtaining the second current limiting parameter corresponding to the next time period includes:
monitoring whether the current limiting parameter configured by the speed limiting server is changed or not through monitoring the event;
and in response to monitoring that the current limiting parameter configured by the speed limiting server is changed, acquiring a second current limiting parameter corresponding to the next time period configured by the speed limiting server.
In a possible implementation manner, the obtaining of the second current limiting parameter corresponding to the next time period configured by the speed limit server includes:
and acquiring a second current limiting parameter corresponding to the next time period from a central server, wherein the second current limiting parameter corresponding to the next time period in the central server is configured in advance by the speed limiting server.
In another aspect, a method for processing a service request is provided, where the method includes:
determining a first current limiting parameter corresponding to a current time period, synchronizing the first current limiting parameter to a second client, and calling a third-party server to process a service request based on the current limiting parameter when the second client receives the service request sent by a first client;
and in response to the condition of meeting the updating condition, determining a second current limiting parameter corresponding to the next time period, and synchronizing the second current limiting parameter to the second client, so that the second client updates the first current limiting parameter corresponding to the current time period to the second current limiting parameter.
In one possible implementation, the synchronizing the second current limiting parameter to the second client includes:
and synchronizing the second current limiting parameter to a central server, wherein the second client is used for acquiring the second current limiting parameter from the central server when monitoring that the updated second current limiting parameter exists in the central server.
In one possible implementation, the method further includes:
determining a target timestamp for updating the current limiting parameter next time;
creating a first parameter updating task, wherein the first parameter updating task is used for updating a current limiting parameter, and the execution timestamp of the first parameter updating task is the target timestamp;
and if the current time reaches the target timestamp, determining that the updating condition is met.
In one possible implementation, the method further includes:
scanning a parameter updating task in a task library, wherein the task library is used for storing the unexecuted parameter updating task;
and if a second parameter updating task exists in the task library, determining that the updating condition is met, wherein the second parameter updating task is a parameter updating task which has an execution timestamp earlier than the current time and is not executed.
In another aspect, an apparatus for processing a service request is provided, the apparatus includes:
the receiving module is used for receiving a service request sent by a first client, wherein the service request is used for requesting to call a third-party server to perform service processing;
the system comprises a first acquisition module, a first processing module and a second acquisition module, wherein the first acquisition module is used for acquiring a first current limiting parameter corresponding to a current time period, the first current limiting parameter is a current limiting parameter for processing a service request received in the current time period, and the first current limiting parameter is updated based on different time periods;
and the calling module is used for calling the third-party server to process the service request based on the first current limiting parameter.
In one possible implementation, the first current limiting parameter includes a current limiting condition and a threshold of the first current limiting parameter; the calling module comprises:
the processing unit is used for responding that the request parameter of the service request meets the current limiting condition, calling the service parameter of the third-party server in the current period to reach the threshold value of the first current limiting parameter, and carrying out speed limiting processing on the service request;
and the request unit is used for responding that the request parameter of the service request does not meet the current limiting condition or the service parameter calling the third-party server in the current period does not reach the threshold value of the first current limiting parameter, and requesting the third-party server to process the service request.
In one possible implementation manner, the processing unit includes:
and the adding subunit is used for adding the service request into a target waiting queue, and the service request in the target waiting queue is used for waiting for scheduled processing.
In one possible implementation, the joining subunit includes:
adding the service request to the end of the target wait queue based on the request time of the service request; or,
and determining a target position with the matched priority in the target waiting queue based on the priority of the service request, and adding the service request to the target position in the target waiting queue.
In one possible implementation, the joining subunit includes:
determining the service type of the service request;
acquiring a target waiting queue matched with the service type, wherein the target waiting queue is used for storing the service request of the service type;
and adding the service request into the target waiting queue.
In one possible implementation, the apparatus further includes:
a second obtaining module, configured to obtain a timeout timestamp of each service request in the target wait queue, where the timeout timestamp of any service request is used to indicate that the any service request fails after the timeout timestamp;
a third determining module, configured to determine a target service request from the target waiting queue, where the target service request is a service request whose timeout timestamp is earlier than the current time;
and the deleting module is used for deleting the target service request from the target waiting queue.
In one possible implementation manner, the invoking module includes:
the configuration unit is used for configuring a speed limiter example based on the first current limiting parameter, and the first current limiting parameter of the speed limiter example is the first current limiting parameter;
and the calling unit is used for calling the third-party server to process the service request through the speed limiter example.
In one possible implementation, the apparatus further includes:
a third obtaining module, configured to obtain a second current limiting parameter corresponding to a next time period in response to a current time entering the next time period, where the second current limiting parameter is a current limiting parameter for processing a service request received in the next time period;
and the updating module is used for updating the first current limiting parameter corresponding to the current time period to the second current limiting parameter corresponding to the next time period.
In a possible implementation manner, the third obtaining module includes:
the monitoring unit is used for monitoring whether the current limiting parameter configured by the speed limiting server is changed or not through monitoring an event;
and the acquisition unit is used for responding to the monitored change of the current limiting parameter configured by the speed limiting server and acquiring a second current limiting parameter corresponding to the next time period configured by the speed limiting server.
In a possible implementation manner, the obtaining unit includes:
and the obtaining subunit is configured to obtain, from the central server, a second current limiting parameter corresponding to the next time period, where the second current limiting parameter corresponding to the next time period in the central server is configured in advance by the speed limit server.
In another aspect, an apparatus for processing a service request is provided, the apparatus includes:
the first determining module is used for determining a first current limiting parameter corresponding to the current time period, synchronizing the first current limiting parameter to a second client, and calling a third-party server to process a service request based on the current limiting parameter when the second client receives the service request sent by the first client;
and the second determining module is used for determining a second current limiting parameter corresponding to the next time period in response to the update condition being met, synchronizing the second current limiting parameter to the second client, and updating the first current limiting parameter corresponding to the current time period to the second current limiting parameter by the second client.
In one possible implementation manner, the second determining module includes:
and the second client is used for acquiring the second current limiting parameter from the central server when monitoring that the updated second current limiting parameter exists in the central server.
In one possible implementation, the apparatus further includes:
the fourth determining module is used for determining a target timestamp for updating the current limiting parameter next time;
the creating module is used for creating a first parameter updating task, the first parameter updating task is used for updating the current limiting parameter, and the execution timestamp of the first parameter updating task is the target timestamp;
and the fifth determining module is used for determining that the updating condition is met if the current time reaches the target timestamp.
In one possible implementation, the apparatus further includes:
the scanning module is used for scanning the parameter updating tasks in the task library, and the task library is used for storing the unexecuted parameter updating tasks;
a sixth determining module, configured to determine that the update condition is met if a second parameter update task exists in the task library, where the second parameter update task is a parameter update task that has an execution timestamp earlier than a current time and is not executed.
In another aspect, a second client is provided, where the second client includes one or more processors and one or more memories, and the one or more memories store at least one instruction, and the at least one instruction is loaded and executed by the one or more processors to implement the operations performed by the method for processing a service request as described above.
In another aspect, a speed limit server is provided, where the speed limit server includes one or more processors and one or more memories, and the one or more memories store at least one instruction, and the at least one instruction is loaded and executed by the one or more processors to implement the operations performed by the method for processing a service request as described above.
In another aspect, a computer-readable storage medium is provided, in which at least one instruction is stored, and the at least one instruction is loaded and executed by a processor to implement the operations performed by the service request processing method as described above.
The technical scheme provided by the embodiment of the application has the beneficial effects that at least:
in the embodiment of the application, after receiving the service request, the third-party server is called to process the service request based on the first current-limiting parameter of the current time period, which means that the service request is limited at the service request outlet, and the current-limiting parameter can be updated based on different time periods, so that the dynamic adjustment of the current-limiting parameter at the service request outlet is realized, and the service efficiency of the third-party server on the service request is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic illustration of an implementation environment provided by an embodiment of the present application;
fig. 2 is a flowchart of a method for processing a service request according to an embodiment of the present application;
fig. 3 is a flowchart of a method for processing a service request according to an embodiment of the present application;
fig. 4 is a flowchart of a method for processing a service request according to an embodiment of the present application;
FIG. 5 is a block diagram of a rate-limiting scheduler provided in an embodiment of the present application;
fig. 6 is a flowchart of a method for processing a service request according to an embodiment of the present application;
fig. 7 is a block diagram of a speed limiter provided in an embodiment of the present application;
fig. 8 is a schematic diagram of a service request processing apparatus according to an embodiment of the present application;
fig. 9 is a schematic diagram of a service request processing apparatus according to an embodiment of the present application;
fig. 10 is a block diagram of a server according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
The terms "first," "second," "third," and "fourth," etc. in the description and claims of this application and in the accompanying drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "comprising" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
The embodiment of the application provides an implementation environment, referring to fig. 1, which comprises a speed limit server 10, a third party server 20, a central server 30, a first client 40 and a second client 50. The first client 40 is connected with the second client 50 through a network, the second client 50 is respectively connected with the speed limiting server 10, the third-party server 20 and the central server 30 through a network, and the central server 30 is connected with the speed limiting server 10 through a network.
The first client 40 is a client that initiates a service request for requesting the third-party server 20 to perform service processing; the first client 40 is any client installed on the terminal; for example, the first client 40 is a shopping client, a take-away client, a payment client, a bank client, a social application client, or a game client, among others. Accordingly, the service request is a request of any service that the first client 40 can support; for example, the service request may be at least one of a search request, a translation request, a call request, a presentation request, and the like.
The second client 50 is a client corresponding to the third-party server 20 installed on the terminal and used for performing current limiting; that is, the second client 50 may also be referred to as a current limiting client; for example, the second client 50 is a browser client or the like. The terminal is at least one of a mobile phone, a tablet computer, a Personal Computer (PC) device and the like.
The third party server 20 is a server that handles service requests, i.e. a background server of the second client 50. Also, the third party server 20 may be at least one of a server, a server cluster composed of a plurality of servers, a cloud server, a cloud computing platform, and a virtualization center.
In the embodiment of the present application, in order for the third-party server 20 to be flushed, the second client 50 needs to obtain the current limiting parameter, and perform current limiting based on the current limiting parameter. And the speed limit server 10 is a server that sets a current limit parameter. Furthermore, the speed limit server 10 may be at least one of a server, a server cluster composed of a plurality of servers, a cloud server, a cloud computing platform, and a virtualization center.
The central server 30 is a server for delivering the flow limiting parameters as an intermediary between the second client 50 and the speed limit server. Also, the center server 30 may be at least one of one server, a server cluster composed of a plurality of servers, a cloud server, a cloud computing platform, and a virtualization center.
An embodiment of the present application provides a method for processing a service request, referring to fig. 2, where the method includes:
step 201: and receiving a service request sent by the first client, wherein the service request is used for requesting to call a third-party server to perform service processing.
Step 202: acquiring a first current limiting parameter corresponding to the current time period, wherein the first current limiting parameter is a current limiting parameter for processing a service request received in the current time period, and the first current limiting parameter is updated based on different time periods.
Step 203: and calling a third-party server to process the service request based on the first current limiting parameter.
In one possible implementation, the first current limiting parameter includes a current limiting condition and a threshold of the first current limiting parameter; based on the first current limiting parameter, calling a third-party server to process the service request, wherein the process comprises the following steps:
and responding to the request parameter of the service request to meet the current limiting condition, calling the service parameter of the third-party server in the current period to reach the threshold value of the first current limiting parameter, and carrying out speed limiting processing on the service request.
And responding to the condition that the request parameter of the service request does not meet the current limiting condition, or calling the service parameter of the third-party server in the current period without reaching the threshold value of the first current limiting parameter, and requesting the third-party server to process the service request.
In a possible implementation manner, the speed-limiting processing of the service request includes:
and adding the service request into a target waiting queue, wherein the service request in the target waiting queue is used for waiting for scheduled processing.
In one possible implementation, adding the service request to the target wait queue includes:
adding the service request to the end of the target waiting queue based on the request time of the service request; or,
and determining a target position with matched priority in the target waiting queue based on the priority of the service request, and adding the service request to the target position in the target waiting queue.
In one possible implementation, adding the service request to the target wait queue includes:
determining the service type of the service request;
and acquiring a target waiting queue matched with the service type, wherein the target waiting queue is used for storing the service request of the service type.
And adding the service request into the target waiting queue.
In one possible implementation, the method further includes:
and acquiring the timeout timestamp of each service request in the target waiting queue, wherein the timeout timestamp of any service request is used for indicating that any service request can fail after the timeout timestamp.
And determining a target service request from the target waiting queue, wherein the target service request is a service request with an overtime timestamp earlier than the current time.
And deleting the target service request from the target waiting queue.
In a possible implementation manner, invoking a third-party server to process a service request based on a first current limiting parameter includes:
and configuring a speed limiter example based on the first current limiting parameter, wherein the first current limiting parameter of the speed limiter example is the first current limiting parameter.
And calling a third-party server to process the service request through the speed limiter example.
In one possible implementation, the method further includes:
and responding to the current time entering the next time period, and acquiring a second current limiting parameter corresponding to the next time period, wherein the second current limiting parameter is a current limiting parameter for processing the service request received in the next time period.
And updating the first current limiting parameter corresponding to the current time period to be the second current limiting parameter corresponding to the next time period.
In a possible implementation manner, obtaining a second current limiting parameter corresponding to a next time period includes:
and monitoring whether the current limiting parameter configured by the speed limiting server is changed or not through monitoring the event.
And in response to monitoring that the current limiting parameter configured by the speed limiting server is changed, acquiring a second current limiting parameter corresponding to the next time period configured by the speed limiting server.
Acquiring a second current limiting parameter corresponding to the next time period configured by the speed limit server, wherein the second current limiting parameter comprises:
and acquiring a second current limiting parameter corresponding to the next time period from the central server, wherein the second current limiting parameter corresponding to the next time period in the central server is configured in advance by the speed limiting server.
In the embodiment of the application, after receiving the service request, the third-party server is called to process the service request based on the first current-limiting parameter of the current time period, which means that the service request is limited at the service request outlet, and the current-limiting parameter can be updated based on different time periods, so that the dynamic adjustment of the current-limiting parameter at the service request outlet is realized, and the service efficiency of the third-party server on the service request is improved.
An embodiment of the present application provides a method for processing a service request, referring to fig. 3, where the method includes:
step 301: and determining a first current limiting parameter corresponding to the current time period, synchronizing the first current limiting parameter to the second client, and calling a third-party server to process the service request based on the current limiting parameter when the second client receives the service request sent by the first client.
Step 302: and in response to the update condition being met, determining a second current limiting parameter corresponding to the next time period, and synchronizing the second current limiting parameter to the second client, so that the second client updates the first current limiting parameter corresponding to the current time period to the second current limiting parameter.
In one possible implementation, synchronizing the second current limiting parameter to the second client includes:
and the second client is used for acquiring the second current limiting parameter from the central server when monitoring that the updated second current limiting parameter exists in the central server.
In one possible implementation, the method further includes:
a target timestamp for a next update of the current limit parameter is determined.
And creating a first parameter updating task, wherein the first parameter updating task is used for updating the current limiting parameter, and the execution timestamp of the first parameter updating task is the target timestamp.
And if the current time reaches the target timestamp, determining that the updating condition is met.
In one possible implementation, the method further includes:
and scanning the parameter updating tasks in a task library, wherein the task library is used for storing the unexecuted parameter updating tasks.
And if the second parameter updating task exists in the task library, determining that the updating condition is met, wherein the second parameter updating task is a parameter updating task which has an execution timestamp earlier than the current time and is not executed.
In the embodiment of the application, different current limiting parameters are determined in different time periods, and the updated current limiting parameters in the next time period can be timely synchronized to the second client, so that the real-time performance of the current limiting parameters is guaranteed, and the second client calls the third-party server to process the service request based on the updated current limiting parameters, so that the accuracy of current limiting can be guaranteed.
An embodiment of the present application provides a method for processing a service request, referring to fig. 4, where the method includes:
step 401: and the speed limit server determines a first current limiting parameter corresponding to the current time period, synchronizes the first current limiting parameter to the second client, and is used for calling a third-party server to process the service request based on the current limiting parameter when the second client receives the service request sent by the first client.
The service request may be at least one of a search request, a translation request, a connection request, and the like.
The service request carries request parameters, and the request parameters comprise at least one of domain name information, method information, service information and the like. The method information may be a path of the service request, and the service information may be at least one of a user name, a user password, and the like.
The first client is a client initiating a service request, the second client is a client limiting the service request, and the third-party server is a background server of the second client.
Referring to fig. 5, the speed limit server is a server configured with a current limiting parameter, and the current limiting parameter is configured in advance in the speed limit server and includes a current limiting condition and a threshold of the current limiting parameter. The current limiting condition refers to a condition for limiting a service request, that is, if the service request satisfies the current limiting condition, the service request is limited, and if the service request does not satisfy the current limiting condition, the service request is not limited, that is, the service request is normally processed. Wherein the current limit condition includes at least one condition information; for example, at least one of domain name information, method information, and service parameter information for current limiting; and, determining whether the service request satisfies the current limiting parameter is based on a unique identifier matching method.
The threshold of the current limiting parameter is the maximum value of the current limiting parameter, that is, if the current limiting parameter exceeds the threshold, the current limiting parameter limits the received service request, and if the current limiting parameter does not exceed the threshold, the received service request is not processed, that is, the service request is processed normally. The current limiting parameter is the current limiting frequency in unit time, the threshold value of the current limiting parameter is the threshold value of the time interval, the threshold values of the current limiting parameter in the same time interval are the same, and the threshold values of the current limiting parameter in different time intervals are different.
The speed limit server determines a first current limiting parameter of the current time period based on a preset current limiting parameter, wherein the first current limiting parameter comprises a current limiting condition and a threshold value of the first current limiting parameter.
The speed limit server calculates a first current limiting parameter corresponding to the current time period according to the configured time-division period, the threshold value of the current limiting parameter of the time-division period and the time difference.
With continued reference to fig. 5, the speed limit server creates a current limiting parameter calculation engine, and calculates a first current limiting parameter corresponding to the current time period through current limiting parameter calculation.
After the speed limit server determines a first current limiting parameter of the current time period, synchronizing the first current limiting parameter to a central server; the central server is used as an intermediate party between the second client and the speed limit server and used for transmitting the current limiting parameters, and the central server can store the current limiting parameters.
Continuing to refer to fig. 5, the speed limit server creates a synchronization module, the synchronization module is respectively connected with the current limiting parameter calculation engine and the central server in a wired or wireless manner, and the synchronization module synchronizes the first current limiting parameter corresponding to the current time period calculated and calculated by the current limiting parameter to the central server.
In the embodiment of the application, the first current limiting parameter corresponding to the current time period is determined, and the first current limiting parameter can be timely synchronized to the second client, so that the second client can call the third-party server to process the service request based on the current limiting parameter, and the real-time performance of the current limiting parameter is ensured.
Step 402: and the speed limit server responds to the condition that the updating condition is met, determines a second current limiting parameter corresponding to the next time period, synchronizes the second current limiting parameter to the second client, and is used for updating the first current limiting parameter corresponding to the current time period into the second current limiting parameter by the second client.
The speed limiting server determines a target timestamp for updating the current limiting parameter next time; the method comprises the steps that a current limiting parameter calculation engine creates a first parameter updating task, the first parameter updating task is used for updating current limiting parameters, and an execution timestamp of the first parameter updating task is a target timestamp; and if the current time reaches the target timestamp, determining that the updating condition is met.
The target timestamp is the time point of next updating of the current limiting parameter, and the speed limiting server determines the target timestamp based on the preset time-division periods and the preset threshold value of the current limiting parameter of the time-division period.
The speed limit server calculates a target timestamp through a current limit parameter calculation engine based on a preset time division period, a preset threshold value of a current limit parameter of the time division period and a preset time difference.
In one possible implementation, the current limit parameter calculation engine sends a delay MQ message corresponding to the first parameter update task, and delays the sending time point to the target timestamp.
The first parameter updating task carries information such as a speed limiter id and an expected execution time point.
And after the current limiting parameter calculation engine receives the delay MQ message at the target timestamp, executing a first parameter updating task.
And the speed limit server determines a second current limiting parameter of the next time period based on the preset current limiting parameter, wherein the second current limiting parameter comprises a current limiting condition and a threshold value of the second current limiting parameter.
And the speed limit server calculates a second current limiting parameter corresponding to a second time period through a current limiting parameter calculation engine according to the configured time-division period, the threshold value of the current limiting parameter of the time-division period and the time difference.
For example, the speed limit server and the third-party server belong to different network service parties in China. And the third-party server is in the service request high concurrency time period from 8 to 20 in the first time period, and is in the service request low concurrency time period from 20 in the second time period to 8 in the next day, the speed limit server side reduces the threshold value of the current limiting parameter in the first time period and increases the threshold value of the current limiting parameter in the second time period so as to match the current limiting rule of the third-party server.
For example, the second client and the third-party server both belong to network servers located within the country. And if the third-party server is in a service request high concurrency time period during the first festival/holiday in China, the threshold value of the current limiting parameter during the first festival/holiday is adjusted to be low.
In the embodiment of the application, the threshold of the current limiting parameter is divided by time intervals according to different concurrency degrees of the service requests in different time intervals, so that the accurate current limiting of the service requests can be realized on the basis of the current limiting of the service requests, and the utilization rate of a third-party server can be further improved.
In a possible implementation manner, in an international service scenario, the threshold of the current limiting parameter is divided into time divisions on the basis of time division, the thresholds of the current limiting parameters in the same time zone are the same, and the thresholds of the current limiting parameters in different time zones are different.
For example, the speed-limiting client belongs to a domestic network service party, the third-party server belongs to a foreign A country network service party, and on the basis of dividing the threshold value by time period, the threshold values of the time division zone and the time division period of the current limiting parameter are determined by combining the time zone time difference between the domestic country and the A country, and the threshold values are adjusted; for example, the time difference between country a and country b is 6 hours, the third-party server is in the service request high concurrency time period when the first time period is 8-20 hours, and is in the service request low concurrency time period when the second time period is 20-8 days, the third time period corresponding to the first time period is 2-14 days, and the fourth time period corresponding to the second time period is 14-2 days, the speed-limiting client reduces the threshold of the current-limiting parameter of the third time period, and increases the threshold of the current-limiting parameter of the fourth time period to match the current-limiting rule of the third-party server.
For example, the speed-limiting client belongs to a domestic network service party, the third-party server belongs to a foreign A network service party, the third-party server is in a service request high concurrency time period in the second section/holiday period of the A country, and after the time difference between the domestic and the A countries is calculated, the threshold value of the current-limiting parameter corresponding to the third section of holiday period in the domestic is adjusted to be lower so as to match the current-limiting rule of the third-party server.
In the international business scenario, network services are deployed around the world, and the business peak time period of the service system is related to factors such as time zones, national/foreign festivals and holidays.
After determining a second current limiting parameter in a next time period, the speed limiting server synchronizes the second current limiting parameter to the central server, and the second client is used for acquiring the second current limiting parameter from the central server when monitoring that the updated second current limiting parameter exists in the central server.
And the speed limiting server synchronizes the second current limiting parameter to the central server through the synchronization module.
In the embodiment of the application, the current limiting parameter can be updated when the target timestamp arrives through the first parameter updating task, so that the current limiting parameter can be updated timely, and the instantaneity of the current limiting parameter is further ensured.
In one possible implementation mode, the speed limit server scans a parameter updating task in a task library, and the task library is used for storing the unexecuted parameter updating task; and if the second parameter updating task exists in the task library, determining that the updating condition is met, wherein the second parameter updating task is a parameter updating task which has an execution timestamp earlier than the current time and is not executed.
The speed limiting server scans a parameter updating task in a task library through a current limiting parameter calculation engine, if a second parameter updating task exists in the task library, the condition is determined to be met, a current limiting parameter corresponding to the second parameter updating task is recalculated, the current limiting parameter is updated to obtain a second current limiting parameter corresponding to the next time period, and the updated second current limiting parameter is synchronized to the central server through a synchronization module.
In the embodiment of the application, even if the unexecuted parameter updating task in the timing scanning task library is not executed after the parameter updating task reaches the execution timestamp, the unexecuted parameter updating task can be scanned and identified through the timing scanning task, and then the current limiting parameter is updated in time based on the identified parameter updating task, so that the consistency of the current time period current limiting parameter and the current limiting parameter configured by the speed limiting server is ensured.
In the embodiment of the application, different current limiting parameters are determined in different time periods, the current limiting parameters can be updated in time through the updating conditions, the updated current limiting parameters in the next time period can be synchronized to the second client in time, the real-time performance of the current limiting parameters is guaranteed, then the second client calls the third-party server to process the service request based on the updated current limiting parameters, and the accuracy of current limiting can be guaranteed.
An embodiment of the present application provides a method for processing a service request, referring to fig. 6, where the method includes:
step 601: and the second client receives the service request sent by the first client, and the service request is used for requesting to call the third-party server to perform service processing.
The service request may be at least one of a search request, a translation request, a connection request, and the like.
The service request carries request parameters, and the request parameters comprise at least one of domain name information, method information, service information and the like. The method information may be a path of the service request, and the service information may be at least one of a user name, a user password, and the like.
The first client is a client initiating a service request, the second client is a client limiting the service request, and the third-party server is a background server of the second client.
Step 602: the second client acquires a first current limiting parameter corresponding to the current time period, wherein the first current limiting parameter is a current limiting parameter for processing a service request received in the current time period, and the first current limiting parameter is updated based on different time periods.
The second client acquires a first current limiting parameter corresponding to the current time period from the central server, wherein the first current limiting parameter corresponding to the current time period in the central server is configured in advance by the speed limiting server.
With continued reference to fig. 5, the second client creates a current limiting parameter pull engine, and pulls the first current limiting parameter corresponding to the current time period from the central server through the speed limiting parameter pull engine.
In a possible implementation manner, the second client, in response to the current time entering the next time period, acquires a second current limiting parameter corresponding to the next time period, where the second current limiting parameter is a current limiting parameter for processing a service request received in the next time period; and updating the first current limiting parameter corresponding to the current time period to be the second current limiting parameter corresponding to the next time period.
The second client monitors whether the current limiting parameter of the center is changed or not by monitoring an event; and in response to monitoring that the current limiting parameter of the central server is changed, acquiring a second current limiting parameter corresponding to the next time period.
And the second client acquires a second current limiting parameter corresponding to the next time period from the central server. And the second current limiting parameter corresponding to the next time period in the central server is configured in advance by the speed limiting server.
The monitoring event is a monitoring event registered by the second client to the central server.
Continuing to refer to fig. 5, the second client creates a current limiting parameter change monitoring engine corresponding to the monitoring event, when the current limiting parameter updated by the speed limiting server is synchronized to the central server, the central server synchronizes the latest current limiting parameter to the monitor of the monitoring event, the monitoring event monitors that the current limiting parameter configured by the speed limiting server is changed, sends a change push to the current limiting parameter change monitoring engine, and the current limiting parameter pull engine pulls the second current limiting parameter corresponding to the next time period of the speed limiting server configuration to the second client.
In the embodiment of the application, the central server can synchronize the current limiting parameters configured by the speed limiting server to the second client, so that the decoupling between the speed limiting server and the second client is realized.
In the embodiment of the application, whether the current limiting parameter changes can be monitored through monitoring the event, so that the changed current limiting parameter can be obtained in time, the current limiting parameter is matched with the current time period, and the accuracy of the current limiting parameter is ensured.
Step 603: and the second client calls the third-party server to process the service request based on the first current limiting parameter.
The second client configures a speed limiter example based on the first current limiting parameter, wherein the first current limiting parameter of the speed limiter example is the first current limiting parameter; and calling a third-party server to process the service request through the speed limiter example.
And the second client performs model conversion on the first current limiting parameter, and configures the speed limiter instance based on the converted current limiting parameter.
Continuing to refer to fig. 5, the second client creates a current limiting parameter analysis engine, model conversion is performed on the current limiting parameter drawn by the current limiting parameter analysis engine, and the second client configures a speed limiter example based on the converted current limiting parameter; the speed limiter example can be a flow control module realized based on a simple window, a sliding window, a leaky bucket or a token bucket algorithm.
The governor instance updates the second current limit parameter to the governor instance in response to the first current limit parameter in the second client changing to the second current limit parameter.
With continued reference to fig. 5, the governor instance creates a speed limit parameter update engine that is used to update the current limit parameter, and in response to a change in the first current limit parameter in the second client to the second current limit parameter, the speed limit parameter update engine updates the second current limit parameter to the governor instance.
In the embodiment of the application, the third-party server can be called to process the service request through the speed limiter instance by configuring the speed limiter instance.
In a possible implementation manner, the second client responds that the request parameter of the service request meets the current limiting condition, and invokes the service parameter of the third-party server to reach the threshold value of the first current limiting parameter in the current period, so as to perform speed limiting processing on the service request.
Wherein the current limit condition includes at least one condition information; for example, at least one of domain name information, method information, and service parameter information for current limiting; the request parameter includes at least one of domain name parameter, method parameter, service parameter, etc.
For example, the current limiting condition includes domain name information, the request parameter includes domain name information, it is determined whether the domain name information included in the request parameter is the same as the domain name information included in the current limiting condition, and if the domain name information included in the request parameter is the same, it is determined that the current limiting condition is satisfied.
And calling the service parameter of the third-party server to reach the threshold value of the first current limiting parameter in the current period in response to the request parameter of the service request meeting the current limiting condition, and carrying out speed limiting processing on the service request through the speed limiter example.
With continued reference to fig. 5, the speed limiter instance creates a speed limit parameter verification engine and a speed limit execution engine, and the speed limit parameter verification engine determines whether the speed limiter instance can act on the current service request according to whether the request parameter of the service request satisfies the current limit condition. Responding to the request parameter of the service request meeting the current limiting condition, calling the service parameter of the third-party server in the current period to reach the threshold value of the first current limiting parameter, and carrying out speed limiting processing on the service request by the speed limiter execution engine; at this time, the speed limit execution engine fails to acquire the speed limit token.
The speed limit execution engine is based on a distributed cluster current limiting design, and a distributed cache mode, such as Redis (remote dictionary service), is used at the bottom layer of the speed limit execution engine.
Referring to fig. 7, the second client creates a rate-limiting scheduler for providing queuing and sorting functions according to priority to the service requests for rate-limiting processing.
Responding to the request parameter of the service request meeting the current limiting condition, calling the service parameter of the third-party server in the current period to reach the threshold value of the first current limiting parameter, namely the service request fails to acquire the token, adding the service request into a target waiting queue by the speed-limiting scheduler, wherein the service request in the target waiting queue is used for waiting for being scheduled and processed.
In a possible implementation manner, when the service request in the target waiting queue is scheduled and processed, the service parameter calling the third-party server in the current period does not reach the threshold of the first current limiting parameter, and the third-party server is requested to process the service request.
In another possible implementation manner, when the service request in the target waiting queue is scheduled and processed, the service parameter calling the third-party server in the current period reaches the threshold of the first current limiting parameter, and the service parameter calling the third-party server in the next period does not reach the threshold of the first current limiting parameter, so that the third-party server is requested to process the service request.
In the embodiment of the application, the service requests are added into the target queue, so that the service requests can be temporarily stored and sequenced, the service requests waiting in a queue can be directly obtained from the target queue when the service requests are scheduled and processed, and the efficiency of scheduling and processing the service requests can be improved.
The second client provides the estimated time difference of the distance from which the next latest speed-limiting token can be obtained, the second client tries to obtain the token again after the service request fails to obtain the token and leisure appointed time, and the appointed dormant time corresponds to the estimated time difference of the distance from which the next latest speed-limiting token can be obtained.
In the embodiment of the application, the service request which fails to acquire the token can be processed in the next period based on the target waiting queue, so that the condition that the service request fails to call the token and directly enters the fusing logic is avoided, and the processing efficiency of the service request is improved.
The speed-limiting scheduler adds the service request to the tail end of the target waiting queue based on the request time of the service request; or, based on the priority of the service request, determining a target position with matched priority in the target waiting queue, and adding the service request to the target position in the target waiting queue.
A coordination thread of the speed limit scheduler blocks and acquires a service request to be executed from the priority queue, namely when the service request exists in the priority queue, the coordination thread takes out the service request and sends the service request to a speed limiter example for speed limit processing; when a service request exists in the priority queue, the coordination thread waits for the service request to appear in the priority queue.
In the embodiment of the application, the service request can be added into the target waiting queue based on the priority of the service request, so that the service request with high priority can be guaranteed to be responded and processed preferentially.
In one possible implementation, the rate-limiting scheduler supports traffic isolation for traffic requests.
The speed-limiting scheduler determines the service type of the service request; acquiring a target waiting queue matched with the service type, wherein the target waiting queue is used for storing service requests of the service type; and adding the service request into the target waiting queue.
Wherein, the service type corresponds to the service request; for example, when the service request is a search request, the service type is a search class, and when the service request is a translation request, the service type is a translation class; and then adding the search request into a target waiting queue of the search class, and adding the translation request into a target waiting queue of the translation class.
In the embodiment of the application, the service requests of different service types can be added into different target waiting queues according to the service types of the service requests, so that service isolation of the service requests is realized, and convenience in sub-processing of the service requests is improved.
In one possible implementation manner, the speed limit scheduler obtains a timeout timestamp of each service request in the target waiting queue, and the timeout timestamp of any service request is used for indicating that any service request can fail after the timeout timestamp. The speed-limiting scheduler determines a target service request from a target waiting queue, wherein the target service request is a service request with an overtime timestamp earlier than the current time; and deleting the target service request from the target waiting queue.
When the first client sends the service requests, the timeout time is set in advance for each service request, and the timeout timestamp of each service request corresponds to the timeout time of each service request.
In a possible implementation manner, when the first client adds at least one service request to the speed-limiting scheduler, the first client obtains an object instance capable of observing the service execution state, and based on the object instance, the first client may obtain a returned result of the service request after the service request is completed.
In the embodiment of the application, the business requests which are not executed overtime can be deleted from the target waiting queue, so that the business requests which are not executed overtime do not occupy the space of the target waiting queue, more business requests can be processed in a speed-limiting mode, and the speed-limiting processing efficiency is improved.
In another possible implementation manner, the second client requests the third-party server to process the service request in response to that the request parameter of the service request does not satisfy the current limiting condition or that the service parameter calling the third-party server in the current period does not reach the threshold of the first current limiting parameter.
And the second client requests the third-party server to process the service through the speed limiter example.
Wherein the current limit condition includes at least one condition information; for example, at least one of domain name information, method information, and service parameter information for current limiting; the request parameter includes at least one of domain name parameter, method parameter, service parameter, etc.
For example, the current limiting condition includes domain name information, the request parameter includes domain name information, it is determined whether the domain name information included in the request parameter is the same as the domain name information included in the current limiting condition, and if not, it is determined that the current limiting condition is not satisfied.
In another possible implementation manner, the speed limiter instance responds that the request parameter of the service request meets the current limiting condition, and the service parameter calling the third-party server in the current period does not reach the threshold value of the first current limiting parameter, at this time, the speed limit execution engine successfully acquires the token, and submits the service request to the thread pool for asynchronous execution.
Continuing to refer to fig. 7, the first client sends tasks of multiple service requests to the speed-limiting scheduler, the tasks corresponding to the multiple service requests are sorted in a priority queue of the speed-limiting scheduler according to priority, when the multiple service requests pass through the speed limiter instance, the current-limiting condition is met, and the token acquisition is successful, the multiple service requests enter a thread pool, are asynchronously executed, and return the result to the first client.
In the embodiment of the application, the service request can be limited by the current limiting condition, and the service request meeting the current limiting condition can be limited by the speed limiter instance, so that the pertinence of limiting the service request can be improved.
In the embodiment of the application, after receiving the service request, the third-party server is called to process the service request based on the first current-limiting parameter of the current time period, which means that the service request is limited at the service request outlet, and the current-limiting parameter can be updated based on different time periods, so that the dynamic adjustment of the current-limiting parameter at the service request outlet is realized, and the service efficiency of the third-party server on the service request is improved.
An embodiment of the present application provides a device for processing a service request, and referring to fig. 8, the device includes:
a receiving module 801, configured to receive a service request sent by a first client, where the service request is used to request to call a third-party server to perform service processing;
a first obtaining module 802, configured to obtain a first current limiting parameter corresponding to a current time period, where the first current limiting parameter is a current limiting parameter for processing a service request received in the current time period, and the first current limiting parameter is updated based on different time periods;
the invoking module 803 is configured to invoke the third-party server to process the service request based on the first current limiting parameter.
In one possible implementation, the first current limiting parameter includes a current limiting condition and a threshold of the first current limiting parameter; a calling module 803, including:
the processing unit is used for responding that the request parameter of the service request meets the current limiting condition, calling the service parameter of the third-party server in the current period to reach the threshold value of the first current limiting parameter, and carrying out speed limiting processing on the service request;
and the request unit is used for responding that the request parameter of the service request does not meet the current limiting condition or the service parameter calling the third-party server in the current period does not reach the threshold value of the first current limiting parameter, and requesting the third-party server to process the service request.
In one possible implementation, a processing unit includes:
and the adding subunit is used for adding the service request into a target waiting queue, and the service request in the target waiting queue is used for waiting for scheduled processing.
In one possible implementation, adding a subunit includes:
adding the service request to the end of the target waiting queue based on the request time of the service request; or,
and determining a target position with matched priority in the target waiting queue based on the priority of the service request, and adding the service request to the target position in the target waiting queue.
In one possible implementation, adding a subunit includes:
determining the service type of the service request;
acquiring a target waiting queue matched with the service type, wherein the target waiting queue is used for storing service requests of the service type;
and adding the service request into the target waiting queue.
In one possible implementation, the apparatus further includes:
the second acquisition module is used for acquiring the overtime timestamp of each service request in the target waiting queue, and the overtime timestamp of any service request is used for indicating that any service request can be invalid after the overtime timestamp;
a third determining module, configured to determine a target service request from the target waiting queue, where the target service request is a service request whose timeout timestamp is earlier than the current time;
and the deleting module is used for deleting the target service request from the target waiting queue.
In one possible implementation, the calling module 803 includes:
the configuration unit is used for configuring a speed limiter example based on a first current limiting parameter, wherein the first current limiting parameter of the speed limiter example is the first current limiting parameter;
and the calling unit is used for calling the third-party server to process the service request through the speed limiter example.
In one possible implementation, the apparatus further includes:
a third obtaining module, configured to obtain a second current limiting parameter corresponding to a next time period in response to a current time entering the next time period, where the second current limiting parameter is a current limiting parameter for processing a service request received in the next time period;
and the updating module is used for updating the first current limiting parameter corresponding to the current time period into the second current limiting parameter corresponding to the next time period.
In one possible implementation manner, the third obtaining module includes:
the monitoring unit is used for monitoring whether the current limiting parameter configured by the speed limiting server is changed or not through monitoring an event;
and the acquisition unit is used for responding to the monitored change of the current limiting parameter configured by the speed limiting server and acquiring a second current limiting parameter corresponding to the next time period configured by the speed limiting server.
In one possible implementation, the obtaining unit includes:
and the acquiring subunit is used for acquiring a second current limiting parameter corresponding to the next time period from the central server, wherein the second current limiting parameter corresponding to the next time period in the central server is configured in advance by the speed limiting server.
An embodiment of the present application provides a device for processing a service request, referring to fig. 9, where the device includes:
a first determining module 901, configured to determine a first current limiting parameter corresponding to a current time period, synchronize the first current limiting parameter to a second client, and invoke a third-party server to process a service request based on the current limiting parameter when the second client receives the service request sent by the first client;
a second determining module 902, configured to determine, in response to that the update condition is met, a second current limiting parameter corresponding to a next time period, synchronize the second current limiting parameter to the second client, and enable the second client to update the first current limiting parameter corresponding to the current time period to the second current limiting parameter.
In one possible implementation, the second determining module 902 includes:
and the second client is used for acquiring the second current limiting parameter from the central server when monitoring that the updated second current limiting parameter exists in the central server.
In one possible implementation, the apparatus further includes:
the fourth determining module is used for determining a target timestamp for updating the current limiting parameter next time;
the system comprises a creating module, a processing module and a processing module, wherein the creating module is used for creating a first parameter updating task, the first parameter updating task is used for updating a current limiting parameter, and an execution timestamp of the first parameter updating task is a target timestamp;
and the fifth determining module is used for determining that the updating condition is met if the current time reaches the target timestamp.
In one possible implementation, the apparatus further includes:
the scanning module is used for scanning the parameter updating tasks in the task library, and the task library is used for storing the unexecuted parameter updating tasks;
and the sixth determining module is used for determining that the updating condition is met if a second parameter updating task exists in the task library, wherein the second parameter updating task is a parameter updating task which has an execution timestamp earlier than the current time and is not executed.
In the embodiment of the application, after receiving the service request, the third-party server is called based on the first current-limiting parameter of the current time period to process the service request, and it can be known that the service request is subjected to current limiting at the service request outlet, and since the current-limiting parameter can be updated based on different time periods, dynamic adjustment of the current-limiting parameter at the service request outlet is realized, so that the flexibility of current limiting is improved.
The embodiment of the present application provides a second client, where the second client includes one or more processors and one or more memories, and at least one instruction is stored in the one or more memories, and the at least one instruction is loaded and executed by the one or more processors to implement the operations performed by the service request processing method as described above.
The embodiment of the application provides a speed limit server, which comprises one or more processors and one or more memories, wherein at least one instruction is stored in the one or more memories, and the at least one instruction is loaded and executed by the one or more processors to realize the operation executed by the service request processing method.
Fig. 10 is a block diagram of a server provided in an embodiment of the present disclosure, where the server 1000 may be a speed limit server in the above embodiment, or may be a third-party server in the above embodiment. The server 1000 may generate a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 1001 and one or more memories 1002, where the memories 1002 are used for storing executable instructions, and the processors 1001 are configured to execute the executable instructions to implement the Processing method of the service request provided by the foregoing method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input/output interface, so as to perform input/output, and the server may also include other components for implementing the functions of the device, which are not described herein again.
In an exemplary embodiment, there is also provided a storage medium comprising instructions, such as a memory 1002 comprising instructions, executable by a processor 1001 of the server 1000 to perform the method of service request described above. Alternatively, the storage medium may be a non-transitory computer readable storage medium, for example, the non-transitory computer readable storage medium may be a ROM (Read-Only Memory), a RAM (Random Access Memory), a CD-ROM (Compact Disc Read-Only Memory), a magnetic tape, a floppy disk, an optical data storage device, and the like.
The embodiment of the present application provides a computer-readable storage medium, where at least one instruction is stored in the storage medium, and the at least one instruction is loaded and executed by a processor to implement the operations performed by the service request processing method as described above.
The above description is only exemplary of the present application and should not be taken as limiting, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (15)

1. A method for processing service requests, the method comprising:
receiving a service request sent by a first client, wherein the service request is used for requesting to call a third-party server to perform service processing;
acquiring a first current limiting parameter corresponding to a current time period, wherein the first current limiting parameter is a current limiting parameter for processing a service request received in the current time period, and the first current limiting parameter is updated based on different time periods;
and calling the third-party server to process the service request based on the first current limiting parameter.
2. The method according to claim 1, wherein the first current limiting parameter includes a current limiting condition and a threshold of the first current limiting parameter, and the invoking the third-party server to process the service request based on the first current limiting parameter comprises:
responding to the request parameter of the service request to meet the current limiting condition, calling the service parameter of the third-party server in the current period to reach the threshold value of the first current limiting parameter, and carrying out speed limiting processing on the service request;
and responding to the request parameter of the service request not meeting the current limiting condition or calling the service parameter of the third-party server in the current period not reaching the threshold value of the first current limiting parameter, and requesting the third-party server to process the service request.
3. The method for processing service request according to claim 2, wherein the rate-limiting processing of the service request includes:
and adding the service request into a target waiting queue, wherein the service request in the target waiting queue is used for waiting for scheduled processing.
4. The method of claim 3, wherein the adding the service request to a target waiting queue comprises:
adding the service request to the end of the target wait queue based on the request time of the service request; or,
determining a target position with the matched priority in the target waiting queue based on the priority of the service request, and adding the service request to the target position in the target waiting queue; or,
determining the service type of the service request, and acquiring a target waiting queue matched with the service type, wherein the target waiting queue is used for storing the service request of the service type and adding the service request into the target waiting queue.
5. The method of claim 3, wherein the method further comprises:
acquiring the timeout timestamp of each service request in the target waiting queue, wherein the timeout timestamp of any service request is used for indicating that the any service request can fail after the timeout timestamp;
determining a target service request from the target waiting queue, wherein the target service request is a service request with an overtime timestamp earlier than the current time;
and deleting the target service request from the target waiting queue.
6. The method for processing the service request according to claim 1, wherein the invoking the third-party server to process the service request based on the first current limiting parameter includes:
configuring a speed limiter example based on the first current limiting parameter, wherein the first current limiting parameter of the speed limiter example is the first current limiting parameter;
and calling the third-party server to process the service request through the speed limiter example.
7. The method of claim 1, wherein the method further comprises:
responding to the current time entering the next time period, and acquiring a second current limiting parameter corresponding to the next time period, wherein the second current limiting parameter is a current limiting parameter for processing a service request received in the next time period;
and updating the first current limiting parameter corresponding to the current time period to the second current limiting parameter corresponding to the next time period.
8. A method for processing service requests, the method comprising:
determining a first current limiting parameter corresponding to a current time period, synchronizing the first current limiting parameter to a second client, and calling a third-party server to process a service request based on the current limiting parameter when the second client receives the service request sent by a first client;
and in response to the condition of meeting the updating condition, determining a second current limiting parameter corresponding to the next time period, and synchronizing the second current limiting parameter to the second client, so that the second client updates the first current limiting parameter corresponding to the current time period to the second current limiting parameter.
9. The method of claim 8, wherein the synchronizing the second current limiting parameter to the second client comprises:
and synchronizing the second current limiting parameter to a central server, wherein the second client is used for acquiring the second current limiting parameter from the central server when monitoring that the updated second current limiting parameter exists in the central server.
10. A method for processing service requests according to claim 8 or 9, characterized in that the method further comprises:
determining a target timestamp for updating the current limiting parameter next time;
creating a first parameter updating task, wherein the first parameter updating task is used for updating a current limiting parameter, and the execution timestamp of the first parameter updating task is the target timestamp;
and if the current time reaches the target timestamp, determining that the updating condition is met.
11. An apparatus for processing service requests, the apparatus comprising:
the receiving module is used for receiving a service request sent by a first client, wherein the service request is used for requesting to call a third-party server to perform service processing;
the system comprises a first acquisition module, a first processing module and a second acquisition module, wherein the first acquisition module is used for acquiring a first current limiting parameter corresponding to a current time period, the first current limiting parameter is a current limiting parameter for processing a service request received in the current time period, and the first current limiting parameter is updated based on different time periods;
and the calling module is used for calling the third-party server to process the service request based on the first current limiting parameter.
12. An apparatus for processing service requests, the apparatus comprising:
the first determining module is used for determining a first current limiting parameter corresponding to the current time period, synchronizing the first current limiting parameter to a second client, and calling a third-party server to process a service request based on the current limiting parameter when the second client receives the service request sent by the first client;
and the second determining module is used for determining a second current limiting parameter corresponding to the next time period in response to the update condition being met, synchronizing the second current limiting parameter to the second client, and updating the first current limiting parameter corresponding to the current time period to the second current limiting parameter by the second client.
13. A second client, characterized in that the second client comprises one or more processors and one or more memories, in which at least one instruction is stored, the at least one instruction being loaded and executed by the one or more processors to implement the operations performed by the processing method of a service request according to any one of claims 1 to 7.
14. A speed limit server, characterized in that the speed limit server comprises one or more processors and one or more memories, wherein at least one instruction is stored in the one or more memories, and the at least one instruction is loaded and executed by the one or more processors to implement the operations executed by the processing method of the service request according to any one of claims 8 to 10.
15. A computer-readable storage medium, having stored therein at least one instruction, which is loaded and executed by a processor to perform operations performed by a method of processing a service request according to any one of claims 1 to 10.
CN202110341184.8A 2021-03-30 2021-03-30 Service request processing method, device, equipment and storage medium Active CN113037862B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110341184.8A CN113037862B (en) 2021-03-30 2021-03-30 Service request processing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110341184.8A CN113037862B (en) 2021-03-30 2021-03-30 Service request processing method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113037862A true CN113037862A (en) 2021-06-25
CN113037862B CN113037862B (en) 2022-07-29

Family

ID=76453456

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110341184.8A Active CN113037862B (en) 2021-03-30 2021-03-30 Service request processing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113037862B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113342498A (en) * 2021-06-28 2021-09-03 平安信托有限责任公司 Concurrent request processing method, device, server and storage medium
CN115102852A (en) * 2022-06-17 2022-09-23 中国联合网络通信集团有限公司 Internet of things service opening method and device, electronic equipment and computer medium
CN115174487A (en) * 2022-09-06 2022-10-11 浙江大华技术股份有限公司 High-concurrency current limiting method and device and computer storage medium
WO2023015869A1 (en) * 2021-08-10 2023-02-16 中国银联股份有限公司 Traffic limiting control method, apparatus and device, and storage medium
CN116708297A (en) * 2023-05-31 2023-09-05 杭州复恒科技有限公司 Cross-platform server flow resource adjusting method, system and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170272371A1 (en) * 2016-03-21 2017-09-21 Alibaba Group Holding Limited Flow control in connection with an access request
CN108848037A (en) * 2018-05-31 2018-11-20 平安医疗科技有限公司 Service request processing method, device, computer equipment and storage medium
US20190182168A1 (en) * 2017-12-11 2019-06-13 International Business Machines Corporation Dynamic throttling thresholds
CN110120973A (en) * 2019-04-28 2019-08-13 华为技术有限公司 A kind of request control method, relevant device and computer storage medium
CN111786895A (en) * 2020-03-16 2020-10-16 北京京东尚科信息技术有限公司 Method and apparatus for dynamic global current limiting

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170272371A1 (en) * 2016-03-21 2017-09-21 Alibaba Group Holding Limited Flow control in connection with an access request
CN107222426A (en) * 2016-03-21 2017-09-29 阿里巴巴集团控股有限公司 The method of flow control, apparatus and system
US20190182168A1 (en) * 2017-12-11 2019-06-13 International Business Machines Corporation Dynamic throttling thresholds
CN108848037A (en) * 2018-05-31 2018-11-20 平安医疗科技有限公司 Service request processing method, device, computer equipment and storage medium
CN110120973A (en) * 2019-04-28 2019-08-13 华为技术有限公司 A kind of request control method, relevant device and computer storage medium
CN111786895A (en) * 2020-03-16 2020-10-16 北京京东尚科信息技术有限公司 Method and apparatus for dynamic global current limiting

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113342498A (en) * 2021-06-28 2021-09-03 平安信托有限责任公司 Concurrent request processing method, device, server and storage medium
WO2023015869A1 (en) * 2021-08-10 2023-02-16 中国银联股份有限公司 Traffic limiting control method, apparatus and device, and storage medium
CN115102852A (en) * 2022-06-17 2022-09-23 中国联合网络通信集团有限公司 Internet of things service opening method and device, electronic equipment and computer medium
CN115102852B (en) * 2022-06-17 2023-07-21 中国联合网络通信集团有限公司 Internet of things service opening method and device, electronic equipment and computer medium
CN115174487A (en) * 2022-09-06 2022-10-11 浙江大华技术股份有限公司 High-concurrency current limiting method and device and computer storage medium
CN116708297A (en) * 2023-05-31 2023-09-05 杭州复恒科技有限公司 Cross-platform server flow resource adjusting method, system and device
CN116708297B (en) * 2023-05-31 2024-06-11 杭州复恒科技有限公司 Cross-platform server flow resource adjusting method, system and device

Also Published As

Publication number Publication date
CN113037862B (en) 2022-07-29

Similar Documents

Publication Publication Date Title
CN113037862B (en) Service request processing method, device, equipment and storage medium
CN109327509B (en) Low-coupling distributed streaming computing system of master/slave architecture
US10067789B2 (en) Method and apparatus for scheduling concurrent task among service servers by using processing thread
US8584136B2 (en) Context-aware request dispatching in clustered environments
CN108023908B (en) Data updating method, device and system
CN109257293B (en) Speed limiting method and device for network congestion and gateway server
EP2838243B1 (en) Capability aggregation and exposure method and system
WO2020192649A1 (en) Data center management system
CN112583895B (en) TCP communication method, system and device
CN113127564B (en) Parameter synchronization method and device
CN116304390B (en) Time sequence data processing method and device, storage medium and electronic equipment
CN111427670A (en) Task scheduling method and system
US20230275976A1 (en) Data processing method and apparatus, and computer-readable storage medium
CN112839067A (en) Data synchronization method and device
CN111200606A (en) Deep learning model task processing method, system, server and storage medium
CN115794262A (en) Task processing method, device, equipment, storage medium and program product
CN110727507B (en) Message processing method and device, computer equipment and storage medium
CN112527530A (en) Message processing method, device, equipment, storage medium and computer program product
CN111475315A (en) Server and subscription notification push control and execution method
CN110798495B (en) Method and server for end-to-end message push in cluster architecture mode
CN117950850A (en) Data transmission method, device, electronic equipment and computer readable medium
US10616109B1 (en) System and method for web service atomic transaction (WS-AT) affinity routing
CN114840329A (en) Cloud and native hybrid integration method based on block chain
CN110324425B (en) Hybrid cloud transaction route processing method and device
CN114500398A (en) Processor cooperative acceleration method, device, equipment and 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