Active flow control method and system based on Nginx server
By adding active flow control identification and backup server processing mechanisms to the Nginx server, the problem of response delay in back-end services during performance bottlenecks in the existing technology is solved, and real-time response and load balancing of services are achieved.
Patent Information
- Application Number
- CN202110256929.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-09
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2041-03-09
AI Technical Summary
When the existing Nginx server is load balancing, the backend service continues to receive and process requests even if it reaches the performance bottleneck, resulting in response delays, and lacks an active flow control mechanism to reduce pressure.
When the Nginx server receives a request, it adds an active flow control identifier to the http header, and determines whether the performance bottleneck has been reached on the back-end server. If so, it returns a 503 status code and forwards the request to the backup server to reduce the load and ensure that the service cannot be interrupted. Interrupt.
It realizes active flow control of back-end services when they reach performance bottlenecks, reduces service pressure, and ensures that requests receive real-time responses through backup servers to avoid service crashes.
Smart Images

Figure CN112769960B
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to an active flow control method and system based on an Nginx server. Background Art
[0002] Nginx is a high-performance HTTP server / reverse proxy server and email (IMAP / POP3) proxy server developed in C. Load balancing is a commonly used feature of Nginx. When the number of accesses to a server per unit of time increases, the server pressure becomes greater. If this pressure exceeds the server's capacity, the server response will become abnormally slow, or even crash. To provide a better user experience, load balancing is used to distribute the server load.
[0003] Currently, Nginx offers various load balancing methods for traffic control of backend services. However, these measures are all actions taken by Nginx itself based on collected information; they are initiated by Nginx, while the backend services, which have the clearest understanding of the load situation, do not actively participate. Even if the backend service has reached its performance bottleneck, it still has to continue receiving and processing requests, resulting in significant latency in response to requests. Summary of the Invention
[0004] This invention proposes an active traffic control method and system based on an Nginx server to address the shortcomings of the prior art mentioned above.
[0005] In one aspect, the present invention proposes a proactive traffic control method based on an Nginx server, the method comprising the following steps:
[0006] S1: Pre-configure the backup server. Based on the IP address of the backup server, add relevant configurations for calling the backup server to the relevant code of each load balancing method on the Nginx server to obtain the corresponding new configuration file.
[0007] S2: When the Nginx server receives the first request initiated by the client, the Nginx server adds an active flow control identifier to the HTTP header of the first request to obtain the second request, and forwards the second request to the backend server according to the load balancing method set by the Nginx server at this time and the corresponding new configuration file;
[0008] S3: After receiving the second request, the backend server parses the HTTP header of the second request. If the active flow control flag exists and its status is ON, the backend server determines whether the number of accesses it receives has reached the performance bottleneck. If not, the backend server processes the second request and responds to the client. If yes, the backend server returns a response with a status code of 503 to the Nginx server.
[0009] S4: After the Nginx server receives the response from the backend server, it adds a judgment on the status code of the received response in the response processing. When the Nginx server receives the response with the status code 503, it forwards the second request to the backup server.
[0010] S5: The backup server responds to the client after processing the second request.
[0011] The above method provides a proactive flow control mechanism for backend services. When the backend service reaches a performance bottleneck, the backend server will proactively return a 503 error to reject new requests, thereby reducing the pressure on the service. At the same time, it provides a backup service channel in the Nginx server, so that after receiving a 503 response, the Nginx server can immediately send a service request to the backup channel to ensure uninterrupted service and that every request receives a real-time response.
[0012] In a specific embodiment, the active flow control identifier is an extended field including Traffic-Control, specifically meaning that when the specific field of the active flow control identifier is 'Traffic-Control: ON', the state of the active flow control identifier is ON. Traditional Nginx does not have active flow control functionality. This invention adds an active flow control identifier by extending the HTTP header with a Traffic-Control field. By modifying the Nginx configuration parsing-related code, the protocol of the server and Nginx is extended. Based on existing load balancing methods and the scheduling of backup servers, more stable traffic control is achieved.
[0013] In a specific embodiment, after the backend server returns a 503 status code response to the Nginx server, the Nginx server will no longer send new requests to the backend server.
[0014] In specific embodiments, the various load balancing methods include round-robin, weight, ip_hash, and fair.
[0015] In a specific embodiment, when the load balancing method set in step S2 is round-robin, the standard for the backend server to determine that the access volume it receives has reached the performance bottleneck in step S3 is: all the backend servers are unable to access the server.
[0016] In a specific embodiment, when the load balancing method set in step S2 is weight, the standard for the backend server to determine that the access volume it receives has reached the performance bottleneck in step S3 is: all the backend servers are unable to access the server.
[0017] In a specific embodiment, when the load balancing method set in step S2 is ip_hash, the standard for the backend server to determine that the access volume it receives has reached the performance bottleneck in step S3 is: any one of the backend servers cannot be accessed.
[0018] In a specific embodiment, when the load balancing mode set in step S2 is fair, the standard for the backend server to determine that the access volume it receives has reached the performance bottleneck in step S3 is that any one of the backend servers cannot be accessed.
[0019] In a specific embodiment, adding the relevant configuration for calling the backup server to the relevant code of each load balancing method of the Nginx server according to the backup server's IP address includes: adding the mapping of the backup server's IP address and hostname to the configuration file of each load balancing method of the Nginx server to obtain a new configuration file corresponding to each load balancing method.
[0020] In a specific embodiment, if the active flow control flag is not present or the active flow control flag is not ON in step S3, the backend server does not determine whether the number of accesses it receives has reached a performance bottleneck.
[0021] According to a second aspect of the invention, a computer-readable storage medium is provided on which a computer program is stored, which, when executed by a computer processor, performs the above-described method.
[0022] According to a third aspect of the present invention, an active traffic control system based on an Nginx server is proposed, the system comprising:
[0023] Nginx server configuration modification module: The configuration is used to pre-configure the backup server. Based on the IP of the backup server, it adds the relevant configuration for calling the backup server to the relevant code of each load balancing method of the Nginx server, and obtains the corresponding new configuration file.
[0024] Nginx Active Flow Control Extension Module: Configured to add an active flow control identifier to the HTTP header of the first request when the Nginx server receives the first request initiated by the client, obtain the second request, and forward the second request to the backend server according to the load balancing method set by the Nginx server at this time and the corresponding new configuration file;
[0025] Backend load judgment module: Configured for the backend server to parse the HTTP header of the second request after receiving the second request. If the active flow control flag exists and its status is ON, the backend server determines whether the number of accesses it receives has reached the performance bottleneck. If not, the backend server processes the second request and responds to the client. If yes, the backend server returns a response with a status code of 503 to the Nginx server.
[0026] Overload request judgment and forwarding module: configured to add judgment on the status code of the received response in the response processing after the Nginx server receives the response from the backend server. When the Nginx server receives the response with the status code 503, it forwards the second request to the backup server.
[0027] Backup server processing module: Configured for the backup server to respond to the client after processing the second request.
[0028] This invention provides a proactive flow control method for backend services by adding relevant configurations for calling the backup server to the relevant code of each load balancing method on the Nginx server, and adding an active flow control flag to the HTTP header of the requests received by the Nginx server. When the backend service reaches a performance bottleneck, the backend server will proactively return a 503 to reject new requests, thereby reducing the pressure on the service. At the same time, a backup service channel is provided in the Nginx server, so that after the Nginx server receives a 503 response, it can immediately initiate a service request to the backup channel to ensure uninterrupted service and that each request receives a real-time response. Attached Figure Description
[0029] The accompanying drawings are included to provide a further understanding of the embodiments and are incorporated in and constitute a part of this specification. The drawings illustrate embodiments and, together with the description, serve to explain the principles of the invention. Other embodiments and many anticipated advantages of the embodiments will be readily recognized as they become better understood through reference to the following detailed description. Other features, objects, and advantages of this application will become more apparent from reading the following detailed description of non-limiting embodiments with reference to the accompanying drawings:
[0030] Figure 1 This is a flowchart of an active traffic control method based on an Nginx server, according to an embodiment of the present invention.
[0031] Figure 2 This is a framework diagram of an active traffic control system based on an Nginx server, according to an embodiment of the present invention.
[0032] Figure 3 This is an exemplary system architecture diagram in which the present invention can be applied;
[0033] Figure 4 This is a schematic diagram of the structure of a computer system suitable for implementing the electronic devices of the present application embodiments. Detailed Implementation
[0034] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.
[0035] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0036] Figure 3 An exemplary system architecture for applying the active traffic control method based on an Nginx server, according to embodiments of the present invention, is shown.
[0037] like Figure 3 As shown, the system architecture may include terminal devices 301, 302, and 303, a network 304, and a server 305. Network 304 serves as the medium for providing communication links between terminal devices 301, 302, and 303 and server 305. Network 304 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0038] Users can use terminal devices 301, 302, and 303 to interact with server 305 via network 304 to receive or send messages, etc. Various applications can be installed on terminal devices 301, 302, and 303, such as data processing applications, data visualization applications, and web browser applications.
[0039] Terminal devices 301, 302, and 303 can be either hardware or software. When terminal devices 301, 302, and 303 are hardware, they can be various electronic devices, including but not limited to smartphones, tablets, laptops, and desktop computers. When terminal devices 301, 302, and 303 are software, they can be installed in the aforementioned electronic devices. They can be implemented as multiple software programs or software modules (e.g., software programs or software modules used to provide distributed services) or as a single software program or software module. No specific limitations are imposed here.
[0040] Server 305 can be a server providing various services, such as a background information processing server based on Nginx server for active traffic control displayed on terminal devices 301, 302, and 303. The background information processing server can process the acquired traffic and generate processing results.
[0041] It should be noted that the method provided in this application embodiment can be executed by server 305 or by terminal devices 301, 302, and 303. The corresponding device is generally set in server 305 or can be set in terminal devices 301, 302, and 303.
[0042] It should be noted that the server can be either hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When the server is software, it can be implemented as multiple software or software modules (e.g., software or software modules for providing distributed services), or as a single software or software module. No specific limitations are given here.
[0043] It should be understood that Figure 3 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.
[0044] According to an embodiment of the present invention, an active traffic control method based on an Nginx server is provided. Figure 1 A flowchart illustrating an active traffic control method based on an Nginx server according to an embodiment of the present invention is shown. Figure 1 As shown, the method includes the following steps: S101-S105.
[0045] In S101, a backup server is pre-configured. Based on the IP address of the backup server, relevant configurations for calling the backup server are added to the relevant code of each load balancing method on the Nginx server, resulting in a corresponding new configuration file.
[0046] In specific embodiments, the various load balancing methods include round-robin, weight, ip_hash, and fair.
[0047] In a specific embodiment, adding the relevant configuration for calling the backup server to the relevant code of each load balancing method of the Nginx server according to the backup server's IP address includes: adding the mapping of the backup server's IP address and hostname to the configuration file of each load balancing method of the Nginx server to obtain a new configuration file corresponding to each load balancing method.
[0048] Based on the above, in this embodiment, the relevant configurations of the backup server are modified as follows for different load balancing methods:
[0049] (1) Change the load balancing configuration of the round-robin mode to:
[0050]
[0051] (2) Change the load balancing configuration of weight mode to:
[0052]
[0053] (3) Change the load balancing configuration of ip_hash mode to:
[0054]
[0055] (4) Change the load balancing configuration in fair mode to:
[0056]
[0057] In S102: When the Nginx server receives the first request initiated by the client, the Nginx server adds an active flow control identifier to the HTTP header of the first request to obtain the second request, and forwards the second request to the backend server according to the load balancing method set by the Nginx server at this time and the corresponding new configuration file.
[0058] In a specific embodiment, the active flow control identifier is an extended field including Traffic-Control, specifically meaning that when the specific field of the active flow control identifier is 'Traffic-Control: ON', the state of the active flow control identifier is ON.
[0059] S103: After receiving the second request, the backend server parses the HTTP header of the second request. If the active flow control flag exists and its status is ON, the backend server determines whether the number of accesses it receives has reached the performance bottleneck. If not, the backend server processes the second request and responds to the client. If yes, the backend server returns a response with a status code of 503 to the Nginx server.
[0060] In a specific embodiment, if the active flow control flag is not present or the active flow control flag is not ON in step S103, the backend server does not determine whether the access volume it receives has reached the performance bottleneck.
[0061] In a preferred embodiment, when the load balancing method set in step S102 is round-robin, the standard for the backend server to determine that the access volume it receives has reached the performance bottleneck in step S103 is: all the backend servers are unable to access the server.
[0062] In a preferred embodiment, when the load balancing method set in step S102 is weight, the standard for the backend server to determine that the access volume it receives has reached the performance bottleneck in step S103 is: all the backend servers are unable to access the server.
[0063] In a preferred embodiment, when the load balancing method set in step S102 is ip_hash, the standard for the backend server to determine that the access volume it receives has reached the performance bottleneck in step S103 is that any one of the backend servers cannot be accessed.
[0064] In a preferred embodiment, when the load balancing mode set in step S102 is fair, the standard for the backend server to determine that the access volume it receives has reached the performance bottleneck in step S103 is that any one of the backend servers cannot be accessed.
[0065] In a specific embodiment, after the backend server returns a response with a status code of 503 to the Nginx server in step S103, the Nginx server no longer sends new requests to the backend server.
[0066] S104: After the Nginx server receives the response from the backend server, it adds a judgment on the status code of the received response in the response processing. When the Nginx server receives the response with the status code 503, it forwards the second request to the backup server.
[0067] S105: The backup server responds to the client after processing the second request.
[0068] Figure 2 This diagram illustrates a framework of an active flow control system based on an Nginx server, according to an embodiment of the present invention. The system includes an Nginx server configuration modification module 201, an Nginx active flow control extension module 202, a backend load judgment module 203, an overload request judgment and forwarding module 204, and a backup server processing module 205.
[0069] In a specific embodiment, the Nginx server configuration modification module 201 is configured to pre-configure a backup server, and add relevant configurations for calling the backup server to the relevant code of each load balancing method of the Nginx server according to the IP of the backup server, so as to obtain the corresponding new configuration file.
[0070] The Nginx active flow control extension module 202 is configured to, when the Nginx server receives a first request initiated by the client, add an active flow control identifier to the HTTP header of the first request to obtain a second request, and forward the second request to the backend server according to the load balancing method set by the Nginx server at this time and the corresponding new configuration file.
[0071] The backend load judgment module 203 is configured to, after the backend server receives the second request, parse the HTTP header of the second request. If the active flow control flag exists and its status is ON, the backend server determines whether the number of accesses it receives has reached the performance bottleneck. If not, the backend server processes the second request and responds to the client. If yes, the backend server returns a response with a status code of 503 to the Nginx server.
[0072] The overload request judgment and forwarding module 204 is configured to add a judgment on the status code of the received response in the response processing after the Nginx server receives the response from the backend server. When the Nginx server receives the response with the status code 503, it forwards the second request to the backup server.
[0073] The backup server processing module 205 is configured to respond to the client after the backup server processes the second request.
[0074] Through the combined action of the above modules, configurations for calling the backup server are added to the relevant code of each load balancing method on the Nginx server. An active flow control flag is added to the HTTP header of requests received by the Nginx server, providing the backend service with a proactive flow control method. When the backend service reaches a performance bottleneck, the backend server proactively returns a 503 error to reject new requests, thus reducing service pressure. Simultaneously, a backup service channel is provided within the Nginx server, enabling it to immediately initiate service requests to the backup channel upon receiving a 503 response, ensuring uninterrupted service and guaranteeing real-time responses to every request.
[0075] Reference below Figure 4 It shows a schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application. Figure 4 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0076] like Figure 4 As shown, the computer system includes a central processing unit (CPU) 401, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 402 or programs loaded from storage section 408 into random access memory (RAM) 403. RAM 403 also stores various programs and data required for the operation of the computer system. The CPU 401, ROM 402, and RAM 403 are interconnected via bus 404. Input / output (I / O) interface 405 is also connected to bus 404.
[0077] The following components are connected to I / O interface 405: an input section 406 including a keyboard, mouse, etc.; an output section 407 including a liquid crystal display (LCD) and speakers, etc.; a storage section 408 including a hard disk, etc.; and a communication section 409 including a network interface card such as a LAN card and a modem, etc. The communication section 409 performs communication processing via a network such as the Internet. A drive 410 is also connected to I / O interface 405 as needed. A removable medium 411, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 410 as needed so that computer programs read from it can be installed into storage section 408 as needed.
[0078] Specifically, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable storage medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 409, and / or installed from removable medium 411. When the computer program is executed by central processing unit (CPU) 401, it performs the functions defined in the methods of this application. It should be noted that the computer-readable storage medium described in this application can 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 electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can also be any computer-readable storage medium other than a computer-readable storage medium that can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. Program code contained on a computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0079] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0080] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, program segment or a part of code, and the module, program segment or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.
[0081] The modules described in the embodiments of this application can be implemented in software or hardware. The described units can also be located in a processor. For example, a processor can be described as including an Nginx server configuration modification module, an Nginx active flow control extension module, a backend load judgment module, an overload request judgment and forwarding module, and a backup server processing module.
[0082] Embodiments of the present invention also relate to a computer-readable storage medium storing a computer program that, when executed by a computer processor, performs the methods described above. The computer program includes program code for performing the methods shown in the flowchart. It should be noted that the computer-readable medium of this application may be a computer-readable signal medium, a computer-readable medium, or any combination of the two.
[0083] This invention provides a proactive flow control mechanism for backend services by adding configurations for calling the backup server to the relevant code of each load balancing method on the Nginx server, and by adding an active flow control flag to the HTTP header of requests received by the Nginx server. When the backend service reaches a performance bottleneck, the backend server proactively returns a 503 error to reject new requests, thus alleviating service pressure. Simultaneously, a backup service channel is provided within the Nginx server, enabling it to immediately initiate service requests to the backup channel upon receiving a 503 response, ensuring uninterrupted service and guaranteeing real-time responses to every request. This invention can be applied to high-concurrency and real-time-critical scenarios such as online video and live streaming.
[0084] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described inventive concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.
Claims
1. An active traffic control method based on Nginx server, characterized in that: The following steps are involved: S1: pre-set a backup server, and add relevant configurations for calling the backup server in the relevant codes of each load balancing mode of the Nginx server according to the IP address of the backup server to obtain a corresponding new configuration file; Specifically, a mapping of the IP address and host name of the backup server is added to the configuration files of each load balancing mode of the Nginx server to obtain a new configuration file corresponding to each load balancing mode; S2: When the Nginx server receives the first request initiated by the client, the Nginx server adds an active flow control identifier to the http header of the first request to obtain a second request, and forwards the second request to the backend server according to the load balancing mode set by the Nginx server at this time and the corresponding new configuration file; S3: After receiving the second request, the backend server parses the http header of the second request. If the active flow control flag exists and the status is ON, the backend server determines whether the access volume received by itself reaches the performance bottleneck. If not, the backend server processes the second request and responds to the client. If yes, the backend server returns a response with a status code of 503 to the Nginx server. S4: After the Nginx server receives the response from the backend server, a judgment on the status code of the received response is added in the response processing. When the Nginx server receives the response with the status code of 503, the second request is forwarded to the backup server; S5: The backup server processes the second request and responds to the client.
2. The method according to claim 1, characterized in that: The active flow control flag is an extended field including Traffic-Control, which is specifically represented as follows: when the specific field of the active flow control flag is 'Traffic-Control: ON', the state of the active flow control flag is ON.
3. The method according to claim 1, characterized in that After the back-end server returns a response with a status code of 503 to the Nginx server, the Nginx server no longer sends new requests to the back-end server.
4. The method according to claim 1, characterized in that: The load balancing methods include polling, weight, ip_hash and fair.
5. The method according to claim 4, characterized in that When the load balancing mode set in step S2 is polling, the standard for the back-end server in step S3 to determine that the access volume received by itself reaches the performance bottleneck is: all the back-end servers are inaccessible.
6. The method according to claim 4, characterized in that When the load balancing mode set in step S2 is weight, the standard for the back-end server in step S3 to determine whether the access volume received by itself reaches the performance bottleneck is: all the back-end servers are inaccessible.
7. The method according to claim 4, characterized in that When the load balancing mode set in step S2 is ip_hash, the standard for the back-end server in step S3 to determine that the access volume received by itself reaches the performance bottleneck is: any one of the back-end servers is inaccessible.
8. The method according to claim 4, characterized in that When the load balancing mode set in step S2 is fair, the criterion for the back-end server in step S3 to determine that the access volume received by itself reaches the performance bottleneck is: any one of the back-end servers is inaccessible.
9. The method according to claim 1, characterized in that: If the active flow control flag does not exist or the active flow control flag is not in the ON state in step S3, the backend server does not judge whether the access volume received by itself reaches the performance bottleneck.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a computer processor, the method according to any one of claims 1 to 9 is implemented.
11. An active traffic control system based on Nginx server, characterized in that: include: Nginx server configuration modification module: configured to pre-set a backup server, add relevant configurations for calling the backup server in the relevant codes of each load balancing mode of the Nginx server according to the IP of the backup server, and obtain a corresponding new configuration file; Specifically, a mapping of the IP address and host name of the backup server is added to the configuration files of each load balancing mode of the Nginx server to obtain a new configuration file corresponding to each load balancing mode; Nginx active flow control extension module: configured to, when the Nginx server receives a first request initiated by a client, add an active flow control identifier to the http header of the first request to obtain a second request, and forward the second request to the backend server according to the load balancing mode set by the Nginx server at this time and the corresponding new configuration file; Back-end load judgment module: configured to parse the http header of the second request after the back-end server receives the second request. If the active flow control flag exists and the state is ON, the back-end server judges whether the access volume received by itself reaches the performance bottleneck. If not, the back-end server responds to the client after processing the second request. If yes, the back-end server returns a response with a status code of 503 to the Nginx server. An overload request judgment and forwarding module: configured to add a judgment on the status code of the received response in the response processing after the Nginx server receives the response from the backend server, and forward the second request to the backup server when the Nginx server receives the response with the status code of 503; The backup server processing module is configured to respond to the client after the backup server processes the second request.
Citation Information
Cited By
Handling overload control information (OCI) in a telecommunications network
WO2026126212A1
