CN116112441A - Service request current limiting method, device, electronic equipment and storage medium - Google Patents
Service request current limiting method, device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN116112441A CN116112441A CN202310119145.2A CN202310119145A CN116112441A CN 116112441 A CN116112441 A CN 116112441A CN 202310119145 A CN202310119145 A CN 202310119145A CN 116112441 A CN116112441 A CN 116112441A
- Authority
- CN
- China
- Prior art keywords
- concurrency
- remote
- total
- update
- updating
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 56
- 238000012545 processing Methods 0.000 claims abstract description 36
- 238000004590 computer program Methods 0.000 claims description 14
- 238000013518 transcription Methods 0.000 abstract description 14
- 230000035897 transcription Effects 0.000 abstract description 14
- 238000013473 artificial intelligence Methods 0.000 abstract description 4
- 238000005516 engineering process Methods 0.000 abstract description 3
- 238000012546 transfer Methods 0.000 description 16
- 238000010586 diagram Methods 0.000 description 9
- 238000004891 communication Methods 0.000 description 8
- 230000008569 process Effects 0.000 description 8
- 238000013519 translation Methods 0.000 description 6
- 230000006870 function Effects 0.000 description 4
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 101100129590 Schizosaccharomyces pombe (strain 972 / ATCC 24843) mcp5 gene Proteins 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 230000015556 catabolic process Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000001953 sensory effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/20—Traffic policing
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Telephonic Communication Services (AREA)
Abstract
The disclosure provides a method and a device for limiting service requests, electronic equipment and a storage medium, and relates to the field of artificial intelligence such as voice technology, and particularly relates to the field of voice transcription. The specific implementation scheme is as follows: under the condition that the target region current limiting service cluster receives a service request of a target user, acquiring a request total concurrency limit, remote concurrency information and local concurrency quantity corresponding to the target user; and carrying out current limiting processing on the service request under the condition that the sum of the total concurrency quantity of the first far end and the local concurrency quantity in the far-end concurrency information is larger than the total concurrency limit of the request. Therefore, each regional current limiting service cluster can limit the current of the service request when the sum of the total concurrency quantity of the remote ends and the local concurrency quantity is larger than the total concurrency limit of the request, so that the cross-regional current limiting of the service request is realized, and the multi-regional current limiting service clusters can limit the current on the whole, thereby effectively utilizing resources on the whole and improving the utilization rate of the resources.
Description
Technical Field
The disclosure relates to the field of artificial intelligence such as voice technology, in particular to the field of voice transcription, and specifically relates to a current limiting method and device for service requests, electronic equipment and a storage medium.
Background
With the development of internet technology, various services such as translation service, voice transcription service (such as text-to-speech, voice-to-text) and the like can be provided for people, and the services can continuously work for a short time after each time a service request is received, so that the concurrency quantity of the service request needs to be limited in order to avoid service breakdown caused by overlarge pressure of the underlying service.
In the related art, concurrency limits are set for different regional current-limiting service clusters, and each regional current-limiting service cluster performs current limiting according to the own concurrency limit. However, there is a possibility that the traffic of a plurality of areas is not uniform, and the resource utilization rate is low.
Disclosure of Invention
The disclosure provides a method, a device, electronic equipment and a storage medium for limiting service requests. The specific scheme is as follows:
according to an aspect of the present disclosure, there is provided a method of throttling a service request, including:
under the condition that the target region current limiting service cluster receives a service request of a target user, acquiring a request total concurrency limit, remote concurrency information and local concurrency quantity corresponding to the target user;
carrying out current limiting processing on the service request under the condition that the sum of the total concurrency quantity of the first far end and the local concurrency quantity in the far-end concurrency information is larger than the total concurrency limit of the request;
The first remote concurrency number refers to the sum of the concurrency request numbers of the target users in other regional current limiting service clusters except the target regional current limiting service cluster.
According to another aspect of the present disclosure, there is provided a flow restricting apparatus for a service request, including:
the first acquisition module is used for acquiring the total concurrency limit, the remote concurrency information and the local concurrency quantity of the request corresponding to the target user under the condition that the target region current limiting service cluster receives the service request of the target user;
the current limiting processing module is used for carrying out current limiting processing on the service request under the condition that the sum of the total concurrency quantity of the first far end and the local concurrency quantity in the far end concurrency information is larger than the total concurrency limit of the request;
the first remote concurrency number refers to the sum of the concurrency request numbers of the target users in other regional current limiting service clusters except the target regional current limiting service cluster.
According to another aspect of the present disclosure, there is provided an electronic device including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of the above embodiments.
According to another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform the method according to the above-described embodiments.
According to another aspect of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the steps of the method described in the above embodiments.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following specification.
Drawings
The drawings are for a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
fig. 1 is a flow chart illustrating a method for limiting a service request according to an embodiment of the disclosure;
FIG. 2 is a schematic diagram of an overall request flow provided by the present disclosure;
FIG. 3 is a flow chart illustrating a method for throttling a service request according to another embodiment of the present disclosure;
FIG. 4 is a flow chart illustrating a method for throttling a service request according to another embodiment of the present disclosure;
FIG. 5 is a schematic diagram illustrating a flow limiting process for a service request according to an embodiment of the disclosure;
fig. 6 is a schematic structural diagram of a current limiting device for service request according to an embodiment of the disclosure;
fig. 7 is a block diagram of an electronic device for implementing a method of throttling a service request according to an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure to facilitate understanding, and should be considered as merely exemplary. Accordingly, one of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The following describes a method, an apparatus, an electronic device, and a storage medium for limiting a service request according to an embodiment of the present disclosure with reference to the accompanying drawings.
Fig. 1 is a flow chart illustrating a flow chart of a method for limiting a service request according to an embodiment of the disclosure.
The method for limiting the service request according to the embodiment of the disclosure may be performed by the device for limiting the service request according to the embodiment of the disclosure, where the device may be configured in an electronic device to implement a function of limiting the service request.
The electronic device may be any device with computing capability, for example, may be a personal computer, a mobile terminal, a server, etc., and the mobile terminal may be, for example, a vehicle-mounted device, a mobile phone, a tablet computer, a personal digital assistant, a wearable device, etc., which have various operating systems, touch screens, and/or display screens.
As shown in fig. 1, the method for limiting the service request includes:
In the present disclosure, a current limiting service cluster may be set in a plurality of regions, where each region current limiting service cluster may be used to perform current limiting processing on a service request of a local region, and the target region current limiting service cluster may be any region current limiting service cluster in all region current limiting service clusters.
In the present disclosure, the service request may be a voice transcription service request, a translation request, or another service request, which is not limited in this disclosure.
In the disclosure, when the target region current limiting service cluster receives a service request of a target user, a total request concurrency limit corresponding to the target user, remote concurrency information corresponding to the target user, and local concurrency quantity corresponding to the target user can be obtained.
The target user may be any user of the service request processing provider, and the total request concurrency limit corresponding to the target user may refer to the maximum number of service requests that the target user can concur with; the remote concurrency information corresponding to the target user may include, but is not limited to, a first remote total concurrency number, where the first remote total concurrency number may refer to a sum of concurrency request numbers of the target user in other regional current limiting service clusters except the target regional current limiting service cluster in all regional current limiting service clusters; the local concurrency number corresponding to the target user may refer to the concurrency number of the service request of the target user in the target regional current-limiting service cluster.
For example, the target user is the party to which a certain reading software belongs, the service request is a translation request, and the number of translation requests initiated by the user using the reading software at time a is the number of concurrent requests corresponding to the party to which the reading software belongs at time a.
In the present disclosure, remote concurrency information may be stored in a database, for example, in redis (Remote Dictionary Server, remote dictionary service), which is a key-value-based non-relational database implemented based on memory, or remote concurrency information may be stored in other databases, which is not limited in this disclosure.
In the present disclosure, the total concurrency limit of requests corresponding to different users may be the same or different, which is not limited in the present disclosure.
The total concurrency limit, the remote concurrency information, and the local concurrency amount are requested, and may be the same service request or may be multiple service requests, which is not limited in this disclosure.
For example, the total request concurrency limit, the remote concurrency information and the local concurrency amount refer to voice transcription service requests, and then the total request concurrency limit corresponding to the target user refers to the maximum number of voice transcription service requests that can be concurrent by the target user, the first remote total concurrency amount in the remote concurrency information refers to the sum of the concurrency amounts of voice transcription service requests corresponding to the target user in other regional current limiting service clusters, and the local concurrency amount refers to the concurrency amount of voice transcription service requests corresponding to the target user in the target regional current limiting service clusters.
For another example, the total request concurrency limit, the remote concurrency information and the local concurrency amount refer to a voice transfer service request and a translation request, when the target current limiting service cluster receives any one of the voice transfer service request and the translation request, the obtained total request concurrency limit corresponding to the target user refers to the maximum number of two service requests which can be concurrent by the target user, the first remote total concurrency amount in the remote concurrency information can refer to the sum of the concurrency amounts of the two service requests corresponding to the target user in other current limiting service clusters, and the local concurrency amount refers to the concurrency amount of the two service requests corresponding to the target user in the target current limiting service cluster.
And 102, performing current limiting processing on the service request under the condition that the sum of the first remote total concurrency quantity and the local concurrency quantity in the remote concurrency information is greater than the total concurrency limit of the request.
In the present disclosure, the sum of the total number of concurrency of the first remote end and the local concurrency number may be calculated, and if the sum of the total number of concurrency of the first remote end and the local concurrency number is greater than the total concurrency limit of the request, the service request may be subjected to a current limiting process, for example, the service request is not forwarded to the corresponding service cluster process.
Optionally, when the service request is subjected to the current limiting process, prompt information can be generated to prompt the target user. The prompt information may be used to prompt the target user that the total concurrency number of the current service requests exceeds the total concurrency limit of the requests.
Optionally, if the sum of the total number of the first remote concurrency and the local concurrency is less than or equal to the total concurrency limit of the request, the service request may be forwarded to the corresponding service cluster processing. Therefore, each regional current-limiting service cluster can forward the received service request to the corresponding service cluster for processing when the total concurrency quantity of the service requests does not exceed the total concurrency limit of the requests, so that the utilization rate of resources can be improved as a whole.
For ease of understanding, the following description will take a service request as an example of a voice transcription service request, and fig. 2 is a schematic diagram of an overall request flow provided in the present disclosure.
As shown in fig. 2, there are two regional current limiting service clusters, namely an a-regional current limiting service cluster and a B-regional current limiting service cluster, and the voice transfer service request of the target user in the a-region can be forwarded to the a-regional current limiting service cluster through a forwarding layer, and when the a-regional current limiting service cluster receives the voice transfer service request of the target user, the remote concurrency information of the target user can be obtained from an a-regional database redis, and the total concurrency allowance and the local concurrency quantity of the request of the voice transfer service request of the target user can be obtained. If the sum of the total concurrency quantity of the far ends and the local concurrency quantity in the far-end concurrency information is greater than the total concurrency limit of the request, the A region current limiting service cluster limits the current of the voice transfer service request and does not forward the current to the voice transfer service cluster for processing; if the sum of the total remote concurrency quantity and the local concurrency quantity in the remote concurrency information is smaller than or equal to the total concurrency limit of the request, the A region current limiting service cluster sends the voice transfer service request to the voice transfer service cluster for processing.
Similarly, the voice transfer service request of the target user in the region B can be forwarded to the region B current limiting service cluster through the forwarding layer, and when the region B current limiting service cluster receives the voice transfer service request of the target user, the region B current limiting service cluster can acquire remote concurrency information of the target user from a region B database redis and acquire the total concurrency limit and the local concurrency quantity of the request of the voice transfer service request of the target user. If the sum of the total concurrency quantity of the far ends and the local concurrency quantity in the far-end concurrency information is greater than the total concurrency limit of the request, the B region current limiting service cluster limits the current of the voice transfer service request and does not forward the current to the voice transfer service cluster for processing; if the sum of the total remote concurrency quantity and the local concurrency quantity in the remote concurrency information is smaller than or equal to the total concurrency limit of the request, the B region current limiting service cluster sends the voice transfer service request to the voice transfer service cluster for processing.
In the embodiment of the disclosure, when the target region current limiting service cluster receives a service request of a target user, a request total concurrency limit, remote concurrency information and local concurrency quantity corresponding to the target user can be obtained, and when the sum of the first remote total concurrency quantity and the local concurrency quantity in the remote concurrency information is greater than the request total concurrency limit, current limiting processing is performed on the service request. Therefore, each regional current limiting service cluster can limit the current of the service request when the sum of the total concurrency quantity of the remote ends and the local concurrency quantity is larger than the total concurrency limit of the request, so that the cross-regional current limiting of the service request is realized, and the multi-regional current limiting service clusters can limit the current on the whole, thereby effectively utilizing resources on the whole and improving the utilization rate of the resources.
Fig. 3 is a flow chart illustrating a method for limiting a service request according to another embodiment of the disclosure.
As shown in fig. 3, the method for limiting the service request includes:
In the present disclosure, any implementation manner of each embodiment of the present disclosure may be adopted in step 301 to step 302, which will not be described in detail.
And 303, under the condition that the next updating time is earlier than or equal to the current time, acquiring the current concurrent request quantity of the target user in the current clothes cluster of other regions.
In the present disclosure, the remote concurrency information may further include a next update time, where the next update time may refer to a time recorded in the remote concurrency information for updating the remote concurrency information next time.
In the disclosure, if the next update time in the remote concurrency information is earlier than or equal to the current time, it is indicated that the total concurrency number of the first remote in the remote concurrency information may be different from the total concurrency number of the current remote, so that the current concurrency request number of the target user in the current limited service cluster of other regions can be obtained. The current time may refer to a time when the service request is received by the target domain current-limiting service request.
For example, there are 3 regional current limiting service clusters s1, s2 and s3, the service request is a voice transcription service request, taking s1 as an example, s1 obtains a request total concurrency limit thre1, remote concurrency information and a local concurrency number num1 corresponding to the target user when receiving a voice transcription service request r1 of the target user, and if the sum of the local concurrency number num1 and a first remote total concurrency number num2 in the remote concurrency information is greater than thre1, the voice transcription service request r1 can be limited.
And if the next update time in the remote concurrency information is t1, the current time is t2, that is, the time when s1 receives the voice transcription service request r1 is t2, and if t1 is earlier than t2, the current concurrency request number of the voice transcription service request of the target user in s2 and the current concurrency request number in s3 can be obtained.
In the present disclosure, the sum of the current concurrency request numbers of other regional current limiting service clusters may be determined as the second remote total concurrency number. That is, the second remote total concurrency number is the sum of the concurrency request numbers of the target user in other regional current limiting service clusters at the current time, that is, the second remote total concurrency number is the current total concurrency number.
In step 305, the remote concurrency information is updated according to the second total remote concurrency number and the local concurrency number.
In the present disclosure, a first update level and a first update time of the remote concurrency information may be determined according to a sum of a total concurrency number of the second remote and a local concurrency number, and the remote concurrency information may be updated according to the first update level and the first update time. Therefore, when the next updating time is earlier than or equal to the current time, the remote concurrency information can be updated based on the current total concurrency quantity and the local concurrency quantity, so that the accuracy of the remote concurrency information can be improved.
When determining the first update level and the first update time, the corresponding relation between the ratio range between the total concurrency number and the request total concurrency limit and the update level and the time interval can be preset, the first ratio between the sum of the second remote total concurrency number and the local concurrency number and the request total concurrency limit can be calculated, the ratio range to which the first ratio belongs can be determined, the update level corresponding to the ratio range to which the first ratio belongs can be determined as the first update level, the time interval corresponding to the ratio range to which the first ratio belongs can be determined as the first time interval, and the sum of the current time and the first time interval can be determined as the first update time.
For example, the correspondence relationship may be: when the ratio range between the total concurrency quantity and the total concurrency limit of the request is smaller than 0.5, updating the updating grade to be 1 and updating after 30 seconds; when the ratio range is more than 0.5 and less than 0.75, updating the updating grade to be 2 and updating after 15 seconds; when the ratio range is more than 0.75 and less than 0.8, updating after updating the grade for 3,5 seconds; when the ratio range is greater than 0.8, the updating grade is 4, and updating is performed after 1 second. Wherein, the larger the value of the update level is, the higher the update level is.
For another example, if the total number of first remote concurrency is 500, the next update time is 16:30:00 on a certain day, and the update level is 1, the total number of second remote concurrency is 600, the current time is 16:31:00 seconds on the certain day, the next update time is earlier than the current time, according to the sum of the total number of second remote concurrency and the local concurrency and the object relationship in the above example, the first update level is determined to be 1, the first time interval is updated after 30 seconds, that is, 30 seconds, and the first update time can be determined to be 16:31:30 on the certain day, then the total number of first remote concurrency in the remote concurrency information can be updated to 600, the next update time is updated to be 16:31:30 on the certain day, and the update level is still 1.
It should be noted that the above correspondence is only an example, and the ratio range, the corresponding update level and the corresponding time interval may be determined according to actual needs, which is not limited in the disclosure.
In the method, the first update level and the first update time are determined based on the first ratio of the sum of the second remote total concurrency quantity and the local concurrency quantity to the request total concurrency limit, so that the accuracy of the first update level and the first update time can be improved, the update frequency can be reduced when the total concurrency quantity of the service request is smaller, resources are saved, remote concurrency information is updated in time when the total concurrency quantity is close to the request total concurrency limit, and the current limiting error is reduced.
In the present disclosure, the remote concurrency information may further include a second update level, where the second update level may refer to an update level of the remote concurrency information, and the higher the update level, the closer the total concurrency request number may be considered to be to the request total concurrency limit. When the next update time recorded in the remote concurrency information is earlier than or equal to the current time according to the first update level and the first update time, the remote concurrency information can be directly updated, the first remote total concurrency amount in the remote concurrency information can be updated to the second remote total concurrency amount, the next update time in the remote concurrency information is updated to the first update time, and the second update level in the remote concurrency information is updated to the first update level.
Therefore, when the next update time recorded in the remote concurrency information is earlier than or equal to the current time, the remote total concurrency number, the update level and the update time recorded in the remote concurrency information can be updated based on the current remote total concurrency number and the local concurrency number, so that the accuracy of the remote concurrency information is improved.
For example, in the remote concurrency information, the total first remote concurrency number is 500, the next update time is 16:30:00 on a certain day, the update level is 1, the current time is 16:31:00 on the certain day, the total second remote concurrency number is 600, and the determined first update level is 1 and the first update time is 16:31:30 on the certain day, so that the total first remote concurrency number in the remote concurrency information can be updated to 600, the next update time is updated to 16:31:30 on the certain day, and the update level is still 1.
In this disclosure, step 302 may be performed before step 303 is performed, or step 303 may be performed before step 302 is performed, or step 302 and step 303 may be performed simultaneously, which is not limited in this disclosure.
Optionally, if the sum of the total concurrency number of the first remote end and the local concurrency number is less than or equal to the total concurrency number of the request, the service request may be sent to the corresponding service cluster for processing, and the remote concurrency information is updated.
It should be noted that, the step 303 may be performed after the service request is sent to the corresponding service cluster, or the step 303 may be performed before the service request is sent to the corresponding service cluster, or the step 303 may be performed simultaneously with the step of sending the service request to the corresponding service cluster, which is not limited in this disclosure.
In this embodiment of the present disclosure, the remote concurrency information may further include a next update time, and when the next update time is earlier than or equal to the current time, the current concurrency request number of the target user in the current clothes cluster of other regions may be obtained, and the sum of the current concurrency request numbers determines the total concurrency number of the second remote, and then updates the remote concurrency information according to the total concurrency number of the second remote and the local concurrency number. Therefore, each regional current limiting service cluster can dynamically limit current according to the total concurrency limit of the request, so that a plurality of regional current limiting service clusters can integrally limit current, and the resource utilization rate is improved.
Fig. 4 is a flow chart illustrating a method for limiting a service request according to another embodiment of the disclosure.
As shown in fig. 4, the method for limiting the service request includes:
In the present disclosure, any implementation manner of each embodiment of the present disclosure may be adopted in step 401 to step 402, which will not be described in detail.
In the present disclosure, if the next update time recorded in the remote concurrency information is later than the current time, which indicates that the current update time recorded in the remote concurrency information is not yet reached, then the third update level and the second update time of the remote concurrency information may be determined according to the sum of the total concurrency number of the first remote and the local concurrency number.
In the disclosure, a corresponding relation between a ratio range between a total concurrency number and a requested total concurrency limit and an update level and a time interval may be preset, a second ratio between a sum of the first remote total concurrency number and a local concurrency number and the requested total concurrency limit may be calculated, a ratio range to which the second ratio belongs may be determined, the update level corresponding to the ratio range to which the second ratio belongs may be determined as a third update level, the time interval corresponding to the ratio range to which the second ratio belongs may be determined as a second time interval, and a sum of the current time and the second time interval may be determined as a second update time.
Therefore, based on the second ratio of the sum of the first remote total concurrency quantity and the local concurrency quantity to the request total concurrency limit, the third update level and the second update time are determined, so that the accuracy of the third update level and the second update time can be improved, the update frequency can be reduced when the total concurrency quantity of the service requests is smaller, resources are saved, remote concurrency information is updated in time when the total concurrency quantity is close to the request total concurrency limit, and the current limiting error is reduced.
In the present disclosure, the remote concurrency information may further include a second update level, the third update level may be compared with the second update level, if the third update level is higher than the second update level, the remote concurrency information may be updated, and the next update time in the remote concurrency information may be updated to the second update time and the second update level may be updated to the third update level. Therefore, when the next update time recorded in the remote concurrency information is later than the current time and the determined update level is greater than the update level in the remote concurrency information, the next update time and the update level in the remote concurrency information are updated, and the accuracy and the update timeliness of the remote concurrency information are improved.
For example, the next update time in the remote concurrency information is 17:29:00 on a certain day, the second update level is 1, the current time is 17:28:15 on the certain day, the determined third update level is 2, and the second update time interval is 15 seconds, then the second update time is 17:28:30 on the certain day, and since the third update level is greater than the second update level, the remote concurrency information is updated, so that the next update time in the remote concurrency information can be updated to 17:28:30 on the certain day, and the second update level is updated to 2.
In this disclosure, step 402 may be performed first and then step 403 may be performed, or step 403 may be performed before step 402 is performed, or step 402 and step 403 may be performed simultaneously, which is not limited in this disclosure.
Optionally, if the sum of the total concurrency number of the first remote end and the local concurrency number is less than or equal to the total concurrency number of the request, the service request may be sent to the corresponding service cluster for processing, and the remote concurrency information is updated.
It should be noted that, the step 403 may be performed after the service request is sent to the corresponding service cluster, or the step 403 may be performed before the service request is sent to the corresponding service cluster, or the step 403 may be performed simultaneously with the step of sending the service request to the corresponding service cluster, which is not limited in this disclosure.
In this embodiment of the present disclosure, the remote concurrency information may further include a next update time, and further may determine, when the next update time is later than the previous time, a third update level and a second update time of the remote concurrency information according to a sum of the total concurrency number of the first remote and the local concurrency number, and update the remote concurrency information according to the third update level and the second update time. Therefore, each regional current limiting service cluster can dynamically limit current according to the total concurrency limit of the request, so that a plurality of regional current limiting service clusters can integrally limit current, and the resource utilization rate is improved.
In order to facilitate understanding of the foregoing embodiments, the following description will take the target current limiting service cluster as an example of the a-domain current limiting service cluster, and fig. 5 is a schematic diagram of a current limiting process of a service request provided by an embodiment of the present disclosure.
As shown in fig. 5, the flow limiting process of the service request includes:
in step 501, a service request of a target user arrives at an a-domain current-limiting service cluster. Namely, the A region current limiting service cluster receives the service request of the target user.
In the disclosure, the a-domain current limiting service cluster obtains the total request concurrency limit, remote concurrency information and local concurrency number (i.e., the above local concurrency number) of the target user from the redis.
For example, the structure of the remote concurrency information may include the following information: "distal concurrency total": 555; next update time ": 2022-11-15:59:30; "update level": 1.
In the present disclosure, when the next update time is earlier than or equal to the current time, the remote concurrency information in redis may be updated, and the update process of the remote concurrency information may refer to the above embodiment, so that details are not repeated here.
In the present disclosure, when the next update time is later than the current time, the update level and the update time are determined, and whether to update the remote concurrency information and how to update the remote concurrency information are determined according to the determined update level and the update level in the remote concurrency information, which will not be described herein.
In the disclosure, if the identification of the service request is "normal", the service request is sent to the corresponding service cluster for processing, and if the identification of the service request is "overrun", the service request is limited, and a prompt message is generated and returned.
That is, if the total number of remote concurrency plus the local concurrency in the remote concurrency information is greater than the total concurrency limit of the request, the service request is sent to the corresponding service cluster for processing, and if the total number of remote concurrency plus the local concurrency in the remote concurrency information is less than or equal to the total concurrency limit of the request, the service request is limited, and prompt information is generated and returned.
In this disclosure, the step 508 may be performed first and then the step 512 may be performed first, the step 512 may be performed first and then the step 508 may be performed, or the step 508 and the step 512 may be performed simultaneously, which is not limited in this disclosure.
In addition, in the present disclosure, when the next update time in the remote concurrency information is equal to the current time, the remote concurrency information may be updated by using the current total remote concurrency number and the local concurrency number based on obtaining the current total remote concurrency number, or the remote concurrency information may be updated based on the remote concurrency number and the local concurrency number in the remote concurrency information.
In order to implement the above embodiments, the embodiments of the present disclosure further provide a device for limiting a service request. Fig. 6 is a schematic structural diagram of a current limiting device for service request according to an embodiment of the disclosure.
As shown in fig. 6, the flow limiting apparatus 600 of the service request includes:
the first obtaining module 610 is configured to obtain, when the target regional current limiting service cluster receives a service request of a target user, a total concurrency limit of a request, remote concurrency information, and a local concurrency number corresponding to the target user;
the current limiting processing module 620 is configured to perform current limiting processing on the service request when the sum of the first remote total concurrency number and the local concurrency number in the remote concurrency information is greater than the total concurrency limit of the request;
The first remote concurrency number refers to the sum of the concurrency request numbers of the target users in other regional current limiting service clusters except the target regional current limiting service cluster.
In one possible implementation manner of the embodiment of the present disclosure, the remote concurrency information further includes a next update time, and the apparatus may further include:
the second acquisition module is used for acquiring the current concurrent request quantity of the target user in the current clothes cluster of other regions under the condition that the next updating time is earlier than or equal to the current time;
the first determining module is used for determining the total concurrency quantity of the second far end according to the sum of the current concurrency request quantity;
the first updating module is used for updating the remote concurrency information according to the total concurrency quantity of the second remote ends and the local concurrency quantity.
In one possible implementation manner of the embodiment of the present disclosure, a first updating module is configured to:
determining a first update level and a first update time of the remote concurrency information according to the sum of the second remote total concurrency number and the local concurrency number;
and updating the remote concurrency information according to the first updating grade and the first updating time.
In one possible implementation manner of the embodiment of the present disclosure, a first updating module is configured to:
Determining a first update level and a first time interval according to a first ratio of the sum of the second remote total concurrency quantity and the local concurrency quantity to the request total concurrency limit and a corresponding relation between a ratio range and the update level and the time interval;
a first update time is determined based on a sum of the current time and the first time interval.
In one possible implementation manner of the embodiment of the present disclosure, the remote concurrency information further includes a second update level, and the first update module is configured to:
updating the first remote total concurrency quantity to a second remote total concurrency quantity;
updating the next update time to be a first update time;
the second update level is updated to the first update level.
In one possible implementation manner of the embodiment of the present disclosure, the remote concurrency information further includes a next update time, and the apparatus may further include:
the second determining module is used for determining a third updating level and a second updating time of the remote concurrency information according to the sum of the total concurrency quantity of the first remote and the local concurrency quantity under the condition that the next updating time is later than the current time;
and the second updating module is used for updating the remote concurrency information according to the third updating grade and the second updating time.
In one possible implementation manner of the embodiment of the disclosure, the second determining module is configured to:
determining a third update level and a second time interval according to a second ratio of the sum of the first remote total concurrency quantity and the local concurrency quantity to the request total concurrency limit and the corresponding relation between the ratio range and the update level and the time interval;
and determining a second updating time according to the sum of the current time and the second time interval.
In one possible implementation manner of the embodiment of the present disclosure, the remote concurrency information further includes a second update level, and the second update module is configured to:
updating the next update time to a second update time when the third update level is greater than the second update level;
the second update level is updated to a third update level.
In one possible implementation manner of the embodiment of the disclosure, the apparatus may further include:
and the sending module is used for sending the service request to the corresponding service cluster for processing under the condition that the sum of the total concurrency quantity of the first remote end and the local concurrency quantity is smaller than or equal to the total concurrency quantity of the request.
It should be noted that, the explanation of the foregoing embodiment of the method for limiting a service request is also applicable to the device for limiting a service request of this embodiment, and thus will not be repeated herein.
In the embodiment of the disclosure, when the target region current limiting service cluster receives a service request of a target user, a request total concurrency limit, remote concurrency information and local concurrency quantity corresponding to the target user can be obtained, and when the sum of the first remote total concurrency quantity and the local concurrency quantity in the remote concurrency information is greater than the request total concurrency limit, current limiting processing is performed on the service request. Therefore, each regional current limiting service cluster can limit the current of the service request when the sum of the total concurrency quantity of the remote ends and the local concurrency quantity is larger than the total concurrency limit of the request, so that the cross-regional current limiting of the service request is realized, and the multi-regional current limiting service clusters can limit the current on the whole, thereby effectively utilizing resources on the whole and improving the utilization rate of the resources.
According to embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
Fig. 7 illustrates a schematic block diagram of an example electronic device 700 that may be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 7, the apparatus 700 includes a computing unit 701 that can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 702 or a computer program loaded from a storage unit 708 into a RAM (Random Access Memory ) 703. In the RAM 703, various programs and data required for the operation of the device 700 may also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other through a bus 704. An I/O (Input/Output) interface 705 is also connected to bus 704.
Various components in device 700 are connected to I/O interface 705, including: an input unit 706 such as a keyboard, a mouse, etc.; an output unit 707 such as various types of displays, speakers, and the like; a storage unit 708 such as a magnetic disk, an optical disk, or the like; and a communication unit 709 such as a network card, modem, wireless communication transceiver, etc. The communication unit 709 allows the device 700 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The computing unit 701 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of computing unit 701 include, but are not limited to, a CPU (Central Processing Unit ), a GPU (Graphic Processing Units, graphics processing unit), various dedicated AI (Artificial Intelligence ) computing chips, various computing units running machine learning model algorithms, a DSP (Digital Signal Processor ), and any suitable processor, controller, microcontroller, etc. The computing unit 701 performs the respective methods and processes described above, such as the streaming method of the service request. For example, in some embodiments, the method of throttling a service request may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as storage unit 708. In some embodiments, part or all of the computer program may be loaded and/or installed onto device 700 via ROM 702 and/or communication unit 709. When the computer program is loaded into the RAM 703 and executed by the computing unit 701, one or more steps of the above-described method of throttling a service request may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to perform the throttling method of the service request in any other suitable way (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit System, FPGA (Field Programmable Gate Array ), ASIC (Application-Specific Integrated Circuit, application-specific integrated circuit), ASSP (Application Specific Standard Product, special-purpose standard product), SOC (System On Chip ), CPLD (Complex Programmable Logic Device, complex programmable logic device), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for carrying out methods of the present disclosure may be written in any combination of one or more programming languages. These program code may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus such that the program code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory, erasable programmable read-Only Memory) or flash Memory, an optical fiber, a CD-ROM (Compact Disc Read-Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display ) monitor) for displaying information to a user; and a keyboard and pointing device (e.g., a mouse or trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: LAN (Local Area Network ), WAN (Wide Area Network, wide area network), internet and blockchain networks.
The computer system may include a client and a server. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service (Virtual Private Server, virtual special servers) are overcome. The server may also be a server of a distributed system or a server that incorporates a blockchain.
According to an embodiment of the present disclosure, the present disclosure further provides a computer program product, which when executed by an instruction processor in the computer program product, performs the method for limiting the flow of service requests set forth in the above embodiments of the present disclosure.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps recited in the present disclosure may be performed in parallel, sequentially, or in a different order, provided that the desired results of the disclosed aspects are achieved, and are not limited herein.
The above detailed description should not be taken as limiting the scope of the present disclosure. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present disclosure are intended to be included within the scope of the present disclosure.
Claims (21)
1. A method of throttling a service request, comprising:
under the condition that a target region current limiting service cluster receives a service request of a target user, acquiring a request total concurrency limit, remote concurrency information and local concurrency quantity corresponding to the target user;
Carrying out current limiting processing on the service request under the condition that the sum of the total concurrency quantity of the first far end and the local concurrency quantity in the far end concurrency information is larger than the total concurrency limit of the request;
the first remote concurrency number refers to the sum of the concurrency request numbers of the target user in other regional current limiting service clusters except the target regional current limiting service cluster.
2. The method of claim 1, wherein the remote concurrency information further includes a next update time, the method further comprising:
acquiring the current concurrent request quantity of the target user in the other regional current clothes cluster under the condition that the next updating time is earlier than or equal to the current time;
determining a second remote total concurrency number according to the sum of the current concurrency request numbers;
and updating the remote concurrency information according to the total concurrency quantity of the second remote and the local concurrency quantity.
3. The method of claim 2, wherein the updating the remote concurrency information based on the second total number of remote concurrency and the local concurrency comprises:
determining a first update level and a first update time of the remote concurrency information according to the sum of the second remote total concurrency number and the local concurrency number;
And updating the remote concurrency information according to the first update level and the first update time.
4. The method of claim 3, wherein the determining the first update level and the second update time of the remote concurrency information based on the sum of the second total number of remote concurrency and the local concurrency comprises:
determining a first update level and a first time interval according to a first ratio of the sum of the second remote total concurrency quantity and the local concurrency quantity to the request total concurrency limit and a corresponding relation between a ratio range and the update level and the time interval;
and determining the first updating time according to the sum of the current time and the first time interval.
5. The method of claim 3, wherein the remote concurrency information further includes a second update level, the updating the remote concurrency information according to the first update level and the first update time includes:
updating the first remote total concurrency number to the second remote total concurrency number;
updating the next update time to the first update time;
updating the second update level to the first update level.
6. The method of claim 1, wherein the remote concurrency information further includes a next update time, the method further comprising:
under the condition that the next updating time is later than the current time, determining a third updating level and a second updating time of the remote concurrency information according to the sum of the total concurrency quantity of the first remote and the local concurrency quantity;
and updating the remote concurrency information according to the third updating level and the second updating time.
7. The method of claim 6, wherein the determining the third update level and the second update time of the remote concurrency information based on the sum of the first total number of remote concurrency and the local concurrency comprises:
determining a third update level and a second time interval according to a second ratio of the sum of the first remote total concurrency quantity and the local concurrency quantity to the request total concurrency limit and a corresponding relation between a ratio range and the update level and the time interval;
and determining the second updating time according to the sum of the current time and the second time interval.
8. The method of claim 6, wherein the remote concurrency information further includes a second update level, the updating the remote concurrency information according to the third update level and the second update time includes:
Updating the next update time to the second update time if the third update level is greater than the second update level;
updating the second update level to the third update level.
9. The method of any of claims 1-8, further comprising:
and sending the service request to a corresponding service cluster for processing under the condition that the sum of the total concurrency quantity of the first remote end and the local concurrency quantity is smaller than or equal to the total concurrency quantity of the request.
10. A flow restricting device for servicing a request, comprising:
the first acquisition module is used for acquiring the total concurrency limit, the remote concurrency information and the local concurrency quantity of the request corresponding to the target user under the condition that the target regional current limiting service cluster receives the service request of the target user;
the current limiting processing module is used for carrying out current limiting processing on the service request under the condition that the sum of the first remote total concurrency quantity and the local concurrency quantity in the remote concurrency information is larger than the total concurrency limit of the request;
the first remote concurrency number refers to the sum of the concurrency request numbers of the target user in other regional current limiting service clusters except the target regional current limiting service cluster.
11. The apparatus of claim 10, wherein the remote concurrency information further includes a next update time, the apparatus further comprising:
the second acquisition module is used for acquiring the current concurrent request quantity of the target user in the other regional current clothes clusters under the condition that the next updating time is earlier than or equal to the current time;
the first determining module is used for determining the total concurrency quantity of the second remote end according to the sum of the current concurrency request quantity;
and the first updating module is used for updating the remote concurrency information according to the second remote total concurrency quantity and the local concurrency quantity.
12. The apparatus of claim 11, wherein the first updating module is configured to:
determining a first update level and a first update time of the remote concurrency information according to the sum of the second remote total concurrency number and the local concurrency number;
and updating the remote concurrency information according to the first update level and the first update time.
13. The apparatus of claim 12, wherein the first updating module is configured to:
determining a first update level and a first time interval according to a first ratio of the sum of the second remote total concurrency quantity and the local concurrency quantity to the request total concurrency limit and a corresponding relation between a ratio range and the update level and the time interval;
And determining the first updating time according to the sum of the current time and the first time interval.
14. The apparatus of claim 12, wherein the remote concurrency information further includes a second update level, the first update module to:
updating the first remote total concurrency number to the second remote total concurrency number;
updating the next update time to the first update time;
updating the second update level to the first update level.
15. The apparatus of claim 10, wherein the remote concurrency information further includes a next update time, the apparatus further comprising:
the second determining module is used for determining a third updating level and a second updating time of the remote concurrency information according to the sum of the first remote total concurrency quantity and the local concurrency quantity under the condition that the next updating time is later than the current time;
and the second updating module is used for updating the remote concurrency information according to the third updating grade and the second updating time.
16. The apparatus of claim 15, wherein the second determination module is configured to:
determining a third update level and a second time interval according to a second ratio of the sum of the first remote total concurrency quantity and the local concurrency quantity to the request total concurrency limit and a corresponding relation between a ratio range and the update level and the time interval;
And determining the second updating time according to the sum of the current time and the second time interval.
17. The apparatus of claim 15, wherein the remote concurrency information further includes a second update level, the second update module to:
updating the next update time to the second update time if the third update level is greater than the second update level;
updating the second update level to the third update level.
18. The apparatus of any of claims 10-17, further comprising:
and the sending module is used for sending the service request to a corresponding service cluster for processing when the sum of the total concurrency quantity of the first remote end and the local concurrency quantity is smaller than or equal to the total concurrency quantity of the request.
19. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-9.
20. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of any one of claims 1-9.
21. A computer program product comprising a computer program which, when executed by a processor, implements the steps of the method of any of claims 1-9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310119145.2A CN116112441A (en) | 2023-02-01 | 2023-02-01 | Service request current limiting method, device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310119145.2A CN116112441A (en) | 2023-02-01 | 2023-02-01 | Service request current limiting method, device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116112441A true CN116112441A (en) | 2023-05-12 |
Family
ID=86255890
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310119145.2A Pending CN116112441A (en) | 2023-02-01 | 2023-02-01 | Service request current limiting method, device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116112441A (en) |
-
2023
- 2023-02-01 CN CN202310119145.2A patent/CN116112441A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11861498B2 (en) | Method and apparatus for compressing neural network model | |
CN113568938A (en) | Data stream processing method and device, electronic equipment and storage medium | |
CN116611411A (en) | Business system report generation method, device, equipment and storage medium | |
WO2021012795A1 (en) | Network node scheduling method and apparatus, electronic device and storage medium | |
US20220053335A1 (en) | Method for detecting an abnormal device, device and storage medium | |
CN113037489B (en) | Data processing method, device, equipment and storage medium | |
CN117474091A (en) | Knowledge graph construction method, device, equipment and storage medium | |
CN113935069B (en) | Data verification method, device and equipment based on block chain and storage medium | |
US20230062632A1 (en) | Method and Apparatus for Assigning Task, Electronic Device and Computer Readable Medium | |
CN113691403B (en) | Topology node configuration method, related device and computer program product | |
CN116112441A (en) | Service request current limiting method, device, electronic equipment and storage medium | |
CN114968950A (en) | Task processing method and device, electronic equipment and medium | |
CN113778645A (en) | Task scheduling method, device and equipment based on edge calculation and storage medium | |
CN113900731A (en) | Request processing method, device, equipment and storage medium | |
CN114416414B (en) | Fault information positioning method, device, equipment and storage medium | |
CN112989250B (en) | Web service response method and device and electronic equipment | |
EP3992794A2 (en) | Method and apparatus for acquiring information | |
EP4155969A1 (en) | Query processing method and apparatus, electronic device and storage medium | |
US20230132173A1 (en) | Data reading method, device and storage medium | |
EP4036861A2 (en) | Method and apparatus for processing point cloud data, electronic device, storage medium, computer program product | |
CN117278648A (en) | Protocol dynamic adaptation method, device, electronic equipment and storage medium | |
CN114647634A (en) | Method for creating database, method and device for operating database | |
CN116915711A (en) | Method, device, equipment and storage medium for expanding and protecting downstream service of dispatch service | |
CN112783507A (en) | Data stream guiding playback method and device, electronic equipment and readable storage medium | |
CN114398072A (en) | Installation package generation method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |