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 should be understood that the present 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 so that this disclosure will be thorough and complete. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings. Embodiments of the present disclosure and features of embodiments may be combined with each other without conflict.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
The present application will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
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 actual rate 106 of the requests according to the first request 102, the second request 103 and the third request 104. Thereafter, the server 101 may determine the current limit value 105 of the backend system. The server 101 may then determine a first limiting value 107 based on the actual rate 106 and the current limiting value 105. Finally, the server 101 may forward the requests first request 102, second request 103, and third request 104 to the backend system 108 according to the first current limit value 107.
It will be appreciated that the method for forwarding the request may be performed by the terminal device, or may be performed by a server (e.g. the server 101 shown in fig. 1), or may be performed by various software programs. The terminal device may be, among other things, various electronic devices with information processing capabilities including, but not limited to, smartphones, tablet computers, electronic book readers, laptop and desktop computers, and the like. Further, when the execution subject is software, it may be installed in the above-listed electronic device. It may be implemented as a plurality of software or software modules, for example, for providing distributed services, or as a single software or software module. The present invention 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 requests according to the present disclosure is shown. The method for forwarding the request comprises the following steps:
in step 201, the actual rate of the request is obtained.
In some embodiments, the executing body of the method of forwarding the request (e.g., the server shown in fig. 1) may obtain the request and determine the actual rate of the request via a wired connection or a wireless connection. Wherein the request generally refers to a user request. The actual rate mentioned above generally refers to the number of received requests in one cycle.
Step 202, determining a current limiting value of the back-end system.
In some embodiments, the executing entity may determine the current limiting value of the backend system in various ways. As an example, the execution body described above may determine the current limit value of the backend system through a connection with the backend system. Wherein the backend system is configured to respond to a request. Here, the above-mentioned current limit value generally refers to the number of back-end systems that can respond to a request, which is set according to the load capacity of the back-end systems. The backend systems generally refer to servers, super servers, clustered systems, mid-range systems, mainframes, etc. that process requests and provide search and ranking data, provide 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 limit value based on the actual rate obtained in step 201 and the current limit value determined in step 202. As an example, when the above-mentioned actual rate is 5 and the current limiting value is 6, the failure rate of the back-end system in response to the back-end system response request is high, and it may be determined that the first limiting value is 4.
In some embodiments, the execution body may set an expected value of the failure rate of the back-end system in response to the request and observe the failure rate. Specifically, the expected value of the failure rate is usually set to 5%. Then, determining an actual failure rate of the back-end system in response to the request, setting the first current limit value to a predetermined multiple of the current limit value when the following condition is satisfied, including: 1. when the actual failure rate is equal to 0, the first current limit value is set to be twice the current limit value. 2. When the actual failure rate is equal to 100%, the first current limit value is set to be one half of the current limit value. 3. When the actual failure rate is greater than the expected value of the failure rate, the first current limit value is set to be the product of the current limit value and the expected value ratio of 1 minus the actual failure rate and 1 minus the failure rate. 4. And when 0 is smaller than the expected value of the actual failure rate and smaller than the failure rate, setting the first current limiting value as the current limiting value.
As an example, when the above-described actual rate is 1300 and the current limit value is 900, the expected failure rate of the back-end system in response to the request is set to 5% and observation is made: determining that the actual failure rate of the back-end system in response to the request is 31%, wherein the actual failure rate is greater than the expected failure rate, and setting the first current limit value as the product of the current limit 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 above-described actual rate is 2000 and the current limit value is 944, the expected failure rate of the backend system in response to the request is set to 5% and observation is made: determining that the actual failure rate of the back-end system in response to the request is 0%, wherein the actual failure rate is 0, and setting the first current limiting value to be twice the current limiting value: 944 x 2 = 1888.
In some alternative implementations of some embodiments, the execution body may set a desired failure rate of the backend system in response to the request. And then determining the failure rate of the back-end system to respond to the request. The execution body may set the current limit value to a first limit value when it is determined that the failure rate of the back-end system to respond to the request and the failure rate of the desired back-end system to respond to the request satisfy a first predetermined condition. Here, the first predetermined condition may be that a failure rate of the back-end system in response to the request is smaller than a desired failure rate of the back-end system in response to the request.
In some alternative implementations of some embodiments, the execution body may set a desired failure rate of the backend system in response to the request. And then, determining the failure rate of the back-end system to respond to the request. And then, when the difference value between the failure rate of the back-end system response request and the failure rate of the expected back-end system response request is determined to meet a second preset condition, determining a first current limit value according to the failure rate of the expected back-end system response request and the failure rate of the back-end system response request. Here, the second predetermined condition may be that a failure rate of the back-end system to respond to the request is greater than a failure rate of the desired back-end system to respond to the request. As an example, the first current limit value may be determined as a product of the current limit value and a ratio of a failure rate of the back-end system to respond to the request to a failure rate of the desired back-end system to respond to the request.
In some optional implementations of some embodiments, the executing entity may first determine a failure rate of the backend system to respond to the request. And then, when the failure rate of the back-end system response request meets a third preset condition, the first current limiting value is determined to be a preset multiple of the current limiting value. Here, the third predetermined condition may be that the failure rate of the back-end system to respond to the request is 100%, or that the failure rate of the back-end system to respond to the request is 0. As an example, when the failure rate of the back-end system in response to the request is 0, the first current limit value may be determined to be twice the current limit value.
Step 204, forwarding the request according to the first current limit value.
In some embodiments, the executing entity may forward the request according to a first limiting value. As an example, when the actual rate of the request is 8 and the first limiting value of the backend system is 5, 4 requests among the requests may be forwarded to the backend system.
The method provided by some embodiments of the present disclosure determines the first limiting value by acquiring the actual rate of the request and the current limiting value of the back-end system, and then forwards the request according to the first limiting value, thereby shortening the time for determining the first limiting value and improving the accuracy of the first limiting value.
With further reference to fig. 3, a flow 300 of further embodiments of a method for forwarding a request is shown. The flow 300 of the method of forwarding a request includes the steps of:
in step 301, the actual rate of the request is obtained.
Step 302, determining a current limiting 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 of steps 301 to 303 and the technical effects thereof may refer to steps 201 to 203 in those embodiments corresponding to fig. 2, which are not described herein.
In response to determining that the actual rate of the request has not reached the first threshold value, the request is forwarded to the backend system, step 304.
In some embodiments, the executing entity may forward the request to a backend system when it is determined that the actual rate of the request does not reach the first threshold value.
In response to determining that the actual rate of the request exceeds the first threshold value, forwarding a portion of the requests in the request to a backend system according to the first threshold value 305.
In some embodiments, the execution body may forward some of the requests to a backend system when it is determined that the actual rate of the requests exceeds the first threshold value. As an example, when the first current limit value is 50 and the actual rate of the requests is 100, the execution body may forward 50 requests among the requests to the backend system.
As can be seen in fig. 3, flow 300 of the method of forwarding a request in some embodiments corresponding to fig. 3 embodies the steps of forwarding a request, as compared to the description of some embodiments corresponding to fig. 2. Thus, the schemes described in these embodiments can more greatly forward requests to the backend system, thereby more fully exploiting the load capacity of the backend system.
With further reference to fig. 4, as an implementation of the method shown in the above figures, the present disclosure provides some embodiments of an apparatus for forwarding a request, which apparatus embodiments correspond to those method embodiments shown in fig. 2, and which apparatus is particularly applicable in various electronic devices.
As shown in fig. 4, an apparatus 400 for forwarding a request of some embodiments includes: an acquisition unit 401, a first determination unit 402, a second determination 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 limiting value of a back-end system, where the back-end system is configured to respond to a 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 forwarding unit 404 is configured to forward the request according to the first limiting value.
In an alternative implementation of some embodiments, the second determining unit 403 of the apparatus 400 for forwarding the request is further configured to: setting a failure rate of a desired back-end system in response to the request; determining the failure rate of the back-end system in response to the request; and setting the current limiting value to a first limiting value in response to determining that the failure rate of the back-end system to respond to the request and the failure rate of the expected back-end system to respond to the request meet a first preset condition.
In an alternative implementation of some embodiments, the second determining unit 403 of the apparatus 400 for forwarding the request is further configured to: setting a failure rate of a desired back-end system in response to the request; determining the failure rate of the back-end system in response to the request; and in response to determining that the failure rate of the back-end system response request and the failure rate of the expected back-end system response request meet a second predetermined condition, determining a first current limit value according to the failure rate of the expected back-end system response request and the failure rate of the back-end system response request.
In an alternative 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 in response to the request; and in response to determining that the failure rate of the back-end system in response to the request meets a third predetermined condition, determining the first current limit value as a predetermined multiple of the current limit value.
In an alternative implementation of some embodiments, the forwarding unit 404 of the apparatus 400 for forwarding requests is further configured to: forwarding the request to a backend system in response to determining that the actual rate of the request does not reach the first threshold value; and in response to determining that the actual rate of the requests exceeds the first limiting value, forwarding some of the requests to a backend system according to the first limiting value.
It will be appreciated that the elements described in the apparatus 400 correspond to the various steps in the method described with reference to fig. 2. Thus, the operations, features and resulting benefits described above with respect to the method are equally applicable to the apparatus 400 and the units contained therein, and are not described in detail herein.
Referring now to fig. 5, a schematic diagram of an electronic device (e.g., server in fig. 1) 500 suitable for use in implementing some embodiments of the present disclosure is shown. The electronic device shown in fig. 5 is merely an example and should not impose any limitations on the functionality and scope of use of embodiments of the present disclosure.
As shown in fig. 5, the electronic device 500 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 501, which may perform various appropriate actions and processes according to 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 required 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 via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
In general, the following devices may be connected to the I/O interface 505: input devices 506 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 507 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 508 including, for example, magnetic tape, hard disk, etc.; and communication means 509. The communication means 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. While fig. 5 shows an electronic device 500 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead. Each block shown in fig. 5 may represent one device or a plurality of devices as needed.
In particular, according to some embodiments of the present disclosure, the processes described above with reference to flowcharts 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 shown in the flow chart. In such embodiments, the computer program may be downloaded and installed from a network via the communications device 509, or from the storage device 508, or from the ROM 502. The above-described functions defined in the methods of some embodiments of the present disclosure are performed when the computer program is executed by the processing device 501.
It should be noted that, in some embodiments of the present disclosure, the computer readable medium may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples 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 present 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, the computer-readable signal medium may comprise a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. 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, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some implementations, 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 communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("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 contained in the electronic device; or may exist alone without being incorporated 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 limiting value of a back-end system, wherein the back-end system is used for responding to a request; determining a first current limit value according to the actual rate of the request and the current limit value; and forwarding the request according to the first current limiting value.
Computer program code for carrying out operations for some embodiments of the present disclosure may be written in 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 program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts 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 means of software, or may be implemented by means of hardware. The described units may also be provided in a processor, for example, 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 constitute a limitation on the unit itself in some cases, for example, the acquisition unit may also be described as "unit that acquires the actual rate of the request".
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
According to one or more embodiments of the present disclosure, there is provided a method of forwarding a request, comprising: acquiring the actual rate of the request; determining a current limiting value of a back-end system, wherein the back-end system is used for responding to a request; determining a first current limit value according to the actual rate of the request and the current limit value; and forwarding the request according to the first current limiting value.
According to one or more embodiments of the present disclosure, the determining the first limiting value includes: setting a failure rate of a desired back-end system in response to the request; determining the failure rate of the back-end system in response to the request; and setting the current limiting value to a first limiting value in response to determining that the failure rate of the back-end system to respond to the request and the failure rate of the expected back-end system to respond to the request meet a first preset condition.
According to one or more embodiments of the present disclosure, the determining the first limiting value includes: setting a failure rate of a desired back-end system in response to the request; determining the failure rate of the back-end system in response to the request; and in response to determining that the failure rate of the back-end system response request and the failure rate of the expected back-end system response request meet a second predetermined condition, determining a first current limit value according to the failure rate of the expected back-end system response request and the failure rate of the back-end system response request.
According to one or more embodiments of the present disclosure, the determining the first limiting value includes: determining the failure rate of the back-end system in response to the request; and in response to determining that the failure rate of the back-end system in response to the request meets a third predetermined condition, determining the first current limit value as a predetermined multiple of the current limit value.
According to one or more embodiments of the present disclosure, forwarding the request includes: forwarding the request to a backend system in response to determining that the actual rate of the request does not reach the first threshold value; and in response to determining that the actual rate of the requests exceeds the first limiting value, forwarding some of the requests to a backend system according to the first limiting 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 limit value of a back-end system, wherein the back-end system is configured to respond to a request; a second determining unit configured to determine a first limiting value according to the requested actual rate and the current limiting value; and a forwarding unit configured to forward the request according to the first current limit value.
According to one or more embodiments of the present disclosure, there is provided an electronic device including: one or more processors; and a storage device having one or more programs stored thereon, which when executed by the one or more processors, cause the one or more processors to implement the method as described in any of the embodiments above.
According to one or more embodiments of the present disclosure, there is provided a computer readable medium having stored thereon a computer program, wherein the program, when executed by a processor, implements a method as described in any of the embodiments above.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being 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 technical features, but encompasses other technical features formed by any combination of the above technical features or their equivalents without departing from the spirit of the invention. Such as the above-described features, are mutually substituted with (but not limited to) the features having similar functions disclosed in the embodiments of the present disclosure.