Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings. The embodiments and features of the embodiments in the present disclosure may be combined with each other without conflict.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 is a schematic diagram of one application scenario of a method for forwarding a request according to some embodiments of the present application.
As shown in fig. 1, in the application scenario of fig. 1, the server 101 may obtain the requested actual rate 106 from the first request 102, the second request 103 and the third request 104. The server 101 may then determine the current choke value 105 for the backend system. The server 101 may then determine a first restriction value 107 based on the actual rate 106 and the current restriction value 105. Finally, the server 101 may forward the request first request 102, second request 103, and third request 104 to the backend system 108 according to the first throttling value 107.
It will be appreciated that the method for forwarding a request may be performed by a terminal device, or may also be performed by a server (such as the server 101 shown in fig. 1), or may also be performed by various software programs. The terminal device may be various electronic devices with information processing capability, including but not limited to a smart phone, a tablet computer, an e-book reader, a laptop portable computer, a desktop computer, and the like. In addition, when the execution subject is software, it can be installed in the electronic devices listed above. It may be implemented, for example, as multiple software or software modules to provide distributed services, or as a single software or software module. And is not particularly limited herein.
It should be understood that the number of servers in fig. 1 is merely illustrative. There may be any number of servers, as desired for implementation.
With continued reference to fig. 2, a flow 200 of some embodiments of a method for forwarding a request according to the present disclosure is shown. The method for forwarding the request comprises the following steps:
step 201, obtaining the actual rate of the request.
In some embodiments, an executing entity of the method of forwarding requests (e.g., the server shown in fig. 1) may obtain the requests and determine the actual rate of the requests by way of a wired connection or a wireless connection. The request is generally referred to as a user request. The actual rate generally refers to the number of requests received in a cycle.
At step 202, a current choke value of the backend system is determined.
In some embodiments, the execution agent may determine the current choke value of the backend system in various ways. By way of example, the execution agent may determine the current choke value of the back-end system through a connection with the back-end system. Wherein the back-end system is configured to respond to requests. The above-mentioned current limit value generally refers to the number of requests that the backend system can respond to, which is set according to the load capacity of the backend system. The above-mentioned back-end system generally refers to a server, a super server, a cluster system, a midrange system, a mainframe, etc. that processes requests and provides search and sort data, files, and other various services.
Step 203, determining a first current limit value according to the requested actual rate and the current limit value.
In some embodiments, the executing entity may determine the first current throttling value based on the actual rate obtained in step 201 and the current throttling value determined in step 202. As an example, when the actual rate is 5 and the current throttling value is 6, the failure rate of the back-end system responding to the request is high, and it may be determined that the first throttling value is 4.
In some embodiments, the execution agent may set a desired value of a response request failure rate of the backend system and perform observation. Specifically, the expected value of the failure rate is usually set to 5%. Thereafter, determining an actual failure rate of the back-end system to respond to the request, and setting the first current throttling value to a predetermined multiple of the current throttling value when: 1. when the actual failure rate is equal to 0, the first restriction value is set to twice the current restriction value. 2. And when the actual failure rate is equal to 100%, setting the first current limiting value to be one half of the current limiting value. 3. And when the actual failure rate is greater than the expected value of the failure rate, setting the first restriction value as the product of the current restriction value and the ratio of 1 minus the actual failure rate and 1 minus the expected value of the failure rate. 4. And when 0 is smaller than the actual failure rate and smaller than the expected value of the failure rate, setting the first current restriction value as the current restriction value.
As an example, when the actual rate is 1300 and the current throttling value is 900, the expected failure rate of the back-end system to respond to the request is set to 5% and observed: determining that the actual failure rate of the back-end system responding to the request is 31 percent, the actual failure rate is greater than the expected failure rate, and setting the first current limiting value as the product of the current limiting value and the expected value ratio of 1 minus the actual failure rate and 1 minus the failure rate: 1300 x (1-31%)/(1-5%) ═ 944.
As another example, when the actual rate is 2000 and the current throttling value is 944, the expected failure rate of the backend system to respond to the request is set to 5% and observed: determining that the actual failure rate of the back-end system responding to the request is 0%, the actual failure rate is 0, and setting the first current limiting value to be twice of the current limiting value: 944 x 2 ═ 1888.
In some optional implementations of some embodiments, the execution agent may set a desired failure rate of the backend system to respond to the request. And then determining the failure rate of the back-end system to respond to the request. The execution agent may set the current throttling value to a first throttling value when it is determined that the failure rate of the back-end system to respond to requests and the expected failure rate of the back-end system to respond to requests satisfy a first predetermined condition. Here, the first predetermined condition may be that a failure rate of the backend system to respond to the request is less than a desired failure rate of the backend system to respond to the request.
In some optional implementations of some embodiments, the execution agent may set a desired failure rate of the backend system to respond to the request. And then determining the failure rate of the back-end system to respond to the request. And then, when the difference between the failure rate of the back-end system responding to the request and the expected failure rate of the back-end system responding to the request is determined to meet a second preset condition, determining a first flow limiting value according to the expected failure rate of the back-end system responding to the request and the expected failure rate of the back-end system responding to the request. Here, the second predetermined condition may be that a failure rate of the back-end system responding to the request is greater than the expected failure rate of the back-end system responding to the request. As an example, the first current throttling value may be determined as a product of the current throttling value and a ratio of a rate of failure of the back-end system to respond to requests and a desired rate of failure of the back-end system to respond to requests.
In some optional implementations of some embodiments, the executing entity may determine a failure rate of the backend system to respond to the request. And then, when the failure rate of the back-end system responding to the request is determined to meet a third preset condition, determining the first current limiting value as a preset multiple of the current limiting value. Here, the third predetermined condition may be that the failure rate of the back-end system responding to the request is 100%, or that the failure rate of the back-end system responding to the request is 0. As an example, when the failure rate of the backend system to respond to the request is 0, the first current throttling value may be determined to be twice the current throttling value.
And step 204, forwarding the request according to the first flow limiting value.
In some embodiments, the execution agent may forward the request according to the first current limit value. As an example, when the actual rate of the requests is 8 and the first throttling value of the backend system is 5, 4 of the requests may be forwarded to the backend system.
According to the method provided by some embodiments of the disclosure, the first current limiting value is determined by obtaining the actual rate of the request and the current limiting value of the back-end system, and then the request is forwarded according to the first current limiting value, so that the time for determining the first current limiting value is shortened, and the accuracy of the first current limiting value is improved.
With further reference to fig. 3, a flow 300 of further embodiments of a method for forwarding a request is illustrated. The process 300 of the method for forwarding a request includes the following steps:
step 301, obtain the actual rate of the request.
Step 302, determining a current throttling value of the back-end system.
Step 303, determining a first current limit value according to the requested actual rate and the current limit value.
In some embodiments, the specific implementation and technical effects of steps 301 and 303 can refer to steps 201 and 203 in the embodiments corresponding to fig. 2, which are not described herein again.
In response to determining that the actual rate of the request does not reach the first current limit value, the request is forwarded to the back-end system, step 304.
In some embodiments, the execution agent may forward the request to the backend system when it is determined that the actual rate of the request does not reach the first throttling value.
Step 305, in response to determining that the actual rate of the request exceeds the first current limit value, forwarding a portion of the request to the backend system according to the first current limit value.
In some embodiments, the execution agent may forward some of the requests to a backend system upon determining that the actual rate of the requests exceeds the first throttling value. As an example, when the first throttling value is 50 and the actual rate of the requests is 100, the executing entity may forward 50 of the requests to the backend system.
As can be seen from fig. 3, compared with the description of some embodiments corresponding to fig. 2, the flow 300 of the method for forwarding a request in some embodiments corresponding to fig. 3 embodies the step of forwarding the request. Thus, the solutions described in the embodiments can make greater use of the load capacity of the backend system by forwarding requests to the backend system.
With further reference to fig. 4, as an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of an apparatus for forwarding a request, which correspond to those shown in fig. 2, and which may be specifically applied in various electronic devices.
As shown in fig. 4, the apparatus 400 for forwarding a request of some embodiments includes: an obtaining unit 401, a first determining unit 402, a second determining unit 403 and a forwarding unit 404. Wherein, the obtaining unit 401 is configured to obtain an actual rate of the request; the first determining unit 402 is configured to determine a current restriction value of a back-end system, wherein the back-end system is configured to respond to the request; the second determining unit 403 is configured to determine a first current limit value according to the requested actual rate and the current limit value; and the forwarding unit 404 is configured to forward the request according to the first current limit value.
In an optional implementation of some embodiments, the second determining unit 403 of the apparatus 400 for forwarding the request is further configured to: setting a desired failure rate of the back-end system to respond to the request; determining the failure rate of the back-end system to respond to the request; in response to determining that the failure rate of the back-end system to respond to requests and the expected failure rate of the back-end system to respond to requests satisfy a first predetermined condition, setting the current throttling value to a first throttling value.
In an optional implementation of some embodiments, the second determining unit 403 of the apparatus 400 for forwarding the request is further configured to: setting a desired failure rate of the back-end system to respond to the request; determining the failure rate of the back-end system to respond to the request; and in response to determining that the failure rate of the back-end system responding to the request and the expected failure rate of the back-end system responding to the request meet a second predetermined condition, determining a first flow limiting value according to the expected failure rate of the back-end system responding to the request and the expected failure rate of the back-end system responding to the request.
In an optional implementation of some embodiments, the second determining unit 403 of the apparatus 400 for forwarding the request is further configured to: determining the failure rate of the back-end system to respond to the request; and in response to determining that the failure rate of the back-end system to respond to the request meets a third predetermined condition, determining the first current throttling value as a predetermined multiple of the current throttling value.
In an optional implementation of some embodiments, the forwarding unit 404 of the apparatus 400 for forwarding the request is further configured to: in response to determining that the actual rate of the request does not reach the first current limit value, forwarding the request to a backend system; in response to determining that the actual rate of the requests exceeds the first current limit value, forwarding a portion of the requests to the backend system according to the first current limit value.
It will be understood that the elements described in the apparatus 400 correspond to various steps in the method described with reference to fig. 2. Thus, the operations, features and resulting advantages described above with respect to the method are also applicable to the apparatus 400 and the units included therein, and will not be described herein again.
Referring now to fig. 5, a schematic diagram of an electronic device (e.g., the server of fig. 1) 500 suitable for use in implementing some embodiments of the present disclosure is shown. The electronic device shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 5, electronic device 500 may include a processing means (e.g., central processing unit, graphics processor, etc.) 501 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage means 508 into a Random Access Memory (RAM) 503. In the RAM503, various programs and data necessary for the operation of the electronic apparatus 500 are also stored. The processing device 501, the ROM502, and the RAM503 are connected to each other through a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
In general, input devices 506 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc., output devices 507 including, for example, a liquid crystal display (L CD), speaker, vibrator, etc., storage devices 508 including, for example, magnetic tape, hard disk, etc., and communication devices 509. the communication devices 509 may allow the electronic device 500 to communicate wirelessly or wiredly with other devices to exchange data.
In particular, according to some embodiments of the present disclosure, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, some embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In some such embodiments, the computer program may be downloaded and installed from a network via the communication means 509, or installed from the storage means 508, or installed from the ROM 502. The computer program, when executed by the processing device 501, performs the above-described functions defined in the methods of some embodiments of the present disclosure.
It should be noted that the computer readable medium described above in some embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In some embodiments of the disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In some embodiments of the present disclosure, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText transfer protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communications network). examples of communications networks include local area networks ("L AN"), wide area networks ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring the actual rate of the request; determining a current flow limit value of a back-end system, wherein the back-end system is used for responding to the request; determining a first current limit value according to the requested actual rate and the current limit value; and forwarding the request according to the first flow limiting value.
Computer program code for carrying out operations for embodiments of the present disclosure may be written in any combination of one or more programming languages, including AN object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language, or similar programming languages.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in some embodiments of the present disclosure may be implemented by software, and may also be implemented by hardware. The described units may also be provided in a processor, and may be described as: a processor includes an acquisition unit, a first determination unit, a second determination unit, and a forwarding unit. Where the names of these units do not in some cases constitute a limitation of the unit itself, for example, the retrieving unit may also be described as a "unit that retrieves the actual rate of requests".
For example, without limitation, exemplary types of hardware logic that may be used include Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), complex programmable logic devices (CP L D), and so forth.
According to one or more embodiments of the present disclosure, there is provided a method of forwarding a request, including: acquiring the actual rate of the request; determining a current flow limit value of a back-end system, wherein the back-end system is used for responding to the request; determining a first current limit value according to the requested actual rate and the current limit value; and forwarding the request according to the first flow limiting value.
According to one or more embodiments of the present disclosure, the determining the first restriction value includes: setting a desired failure rate of the back-end system to respond to the request; determining the failure rate of the back-end system to respond to the request; in response to determining that the failure rate of the back-end system to respond to requests and the expected failure rate of the back-end system to respond to requests satisfy a first predetermined condition, setting the current throttling value to a first throttling value.
According to one or more embodiments of the present disclosure, the determining the first restriction value includes: setting a desired failure rate of the back-end system to respond to the request; determining the failure rate of the back-end system to respond to the request; and in response to determining that the failure rate of the back-end system responding to the request and the expected failure rate of the back-end system responding to the request meet a second predetermined condition, determining a first flow limiting value according to the expected failure rate of the back-end system responding to the request and the expected failure rate of the back-end system responding to the request.
According to one or more embodiments of the present disclosure, the determining the first restriction value includes: determining the failure rate of the back-end system to respond to the request; and in response to determining that the failure rate of the back-end system to respond to the request meets a third predetermined condition, determining the first current throttling value as a predetermined multiple of the current throttling value.
According to one or more embodiments of the present disclosure, the forwarding the request includes: in response to determining that the actual rate of the request does not reach the first current limit value, forwarding the request to a backend system; in response to determining that the actual rate of the requests exceeds the first current limit value, forwarding a portion of the requests to the backend system according to the first current limit value.
According to one or more embodiments of the present disclosure, the apparatus includes: an acquisition unit configured to acquire an actual rate of the request; a first determining unit configured to determine a current restriction value of a back-end system, wherein the back-end system is used for responding to a request; a second determining unit configured to determine a first current limit value according to the requested actual rate and the current limit value; and the forwarding unit is configured to forward the request according to the first flow limiting value.
According to one or more embodiments of the present disclosure, there is provided an electronic device including: one or more processors; a storage device having one or more programs stored thereon which, when executed by one or more processors, cause the one or more processors to implement a method as described in any of the embodiments above.
According to one or more embodiments of the present disclosure, a computer-readable medium is provided, on which a computer program is stored, wherein the program, when executed by a processor, implements the method as described in any of the embodiments above.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is made without departing from the inventive concept as defined above. For example, the above features and (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure are mutually replaced to form the technical solution.