Telescopic method, device and equipment for cloud server of browser and medium
Through the combination of NGINX servers, elastic scaling services, message queue services, and function computing services, the number of cloud servers can be dynamically adjusted, solving the problem of cloud server resource waste, reducing costs, and improving system stability.
Patent Information
- Application Number
- CN202510734244.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-04
- Publication Date
- 2025-09-19
AI Technical Summary
In existing technologies, when enterprises use cloud servers, they keep the same number of servers powered on during the day and night, which increases costs and makes it impossible to dynamically adjust according to actual needs, especially during business peak and trough periods, to effectively reduce capacity.
Using a combination of NGINX servers, elastic scaling services, message queue services, and function computing services, it monitors the CPU usage of cloud servers in real time, automatically adjusts the number of cloud servers, achieves capacity expansion and contraction, and dynamically adjusts the number of cloud servers to match business needs.
It can control the number of cloud servers according to real-time demand, reduce enterprise operating costs, respond quickly to sudden traffic changes, and improve system stability and response speed.
Smart Images

Figure CN120676040A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a scaling method, device, equipment and medium for a cloud server of a browser. Background Art
[0002] Existing businesses that provide services through cloud servers typically use the same number of cloud servers as those used during peak demand. Consequently, even during periods of minimal demand, the number of cloud servers used during peak demand remains the same, significantly increasing costs for businesses. For example, the current Purple Bird browser's peak service period is primarily during the day, with virtually no requests at night. Purple Bird's general backend interface service requires multiple cloud servers to operate simultaneously during the day, so multiple cloud servers are always running, regardless of day or night. Summary of the Invention
[0003] The technical problem to be solved by the present invention is to provide a method, device, equipment and medium for scaling a cloud server for a browser, which greatly reduces the cost of the enterprise.
[0004] In a first aspect, the present invention provides a cloud server scaling method for a browser, comprising: an NGINX server, at least one cloud server, an elastic scaling service, a message queue service, and a function computing service; a browser is connected to each cloud server through the NGINX server, specifically comprising the following steps:
[0005] Step 1: Set up a first number of cloud servers, and configure the IP addresses and ports of the cloud servers to the configuration file of the NGINX server, so that the NGINX server can perform reverse proxy.
[0006] Step 2: Configure the trigger conditions for expansion or contraction in the elastic scaling service. When the trigger conditions for expansion or contraction are met, the elastic scaling service sends an expansion event or a contraction event to the message queue service.
[0007] Step 3: When the Message Queue Service receives the capacity expansion event, it triggers the Function Compute Service. The Function Compute Service periodically checks whether the list of healthy instances in the Auto Scaling Service contains the cloud server instance ID in the capacity expansion event. If so, it configures the IP address to the configuration file corresponding to the NGINX server to implement capacity expansion.
[0008] When the Message Queue Service receives a scaling-down event, it triggers the Function Compute Service. The Function Compute Service queries the list of healthy instances in the Auto Scaling Service and removes the instance ID of the cloud server to be scaled down from the configuration file corresponding to the NGINX server in advance to implement the scaling-down.
[0009] In a second aspect, the present invention provides a cloud server scaling device for a browser, comprising: an NGINX server, at least one cloud server, an elastic scaling service, a message queue service, and a function computing service; the browser is connected to each cloud server through the NGINX server, specifically comprising the following steps:
[0010] A configuration module is configured to set a first number of cloud servers, and configure the IP addresses and ports of the cloud servers to a configuration file of the NGINX server, so that the NGINX server performs reverse proxy.
[0011] A trigger module configures the expansion or contraction trigger conditions in the elastic scaling service. When the expansion or contraction trigger conditions are met, the elastic scaling service sends an expansion event or a contraction event to the message queue service.
[0012] The scaling module, when the message queue service receives a scaling event, triggers the function computing service. The function computing service periodically checks whether the list of healthy instances in the elastic scaling service contains the cloud server instance ID in the scaling event. If so, the IP address is configured in the configuration file corresponding to the NGINX server to achieve scaling.
[0013] When the Message Queue Service receives a scaling-down event, it triggers the Function Compute Service. The Function Compute Service queries the list of healthy instances in the Auto Scaling Service and removes the instance ID of the cloud server to be scaled down from the configuration file corresponding to the NGINX server in advance to implement the scaling-down.
[0014] In a third aspect, the present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect when executing the program.
[0015] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which implements the method described in the first aspect when the program is executed by a processor.
[0016] One or more technical solutions provided by the present invention have at least the following technical effects or advantages:
[0017] The present invention can control the number of cloud servers that are turned on according to real-time demand, which greatly reduces the operating costs of the enterprise. Moreover, due to real-time control, in the event of a sudden surge or decrease in traffic, it can respond quickly and adjust the number of cloud servers, which greatly facilitates the daily operation and maintenance of the enterprise.
[0018] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are specifically listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0020] Figure 1 This is a flowchart of the method in Example 1 of the present invention;
[0021] Figure 2 This is a schematic diagram of the structure of the device in Example 2 of the present invention. DETAILED DESCRIPTION
[0022] The technical solutions in the embodiments of this application are specifically implemented as follows:
[0023] Purple Bird Browser is the client used by users;
[0024] NGINX, the unified entry point for ZiNiao Browser Commapi, is responsible for receiving client requests and forwarding them to backend services. It enables transparent access to backend services through configured IP addresses and ports, supporting dynamic configuration and routing.
[0025] Function Compute (FC) is built on Alibaba Cloud's Function Compute service and deploys business logic code to control NGINX configuration. This feature allows dynamic changes to NGINX configuration based on business needs, ensuring flexibility in diverse business scenarios. FC's design precisely controls the timing of configuration changes and processes requests using pre-defined logic, improving server responsiveness and stability.
[0026] Elastic Scaling Service (ESS) automatically adjusts the number of instances based on real-time business load monitoring. Users can set trigger rules (such as CPU usage and memory utilization) based on business scenarios to automatically expand and reduce resources, reducing costs and enhancing system adaptability.
[0027] When auto scaling is triggered, the Message Queuing Service (ESS) generates a message and sends it to the Message Queuing Service (MNS). FC monitors the queue, processes messages from the ESS in real time, and adjusts the NGINX configuration accordingly based on the instructions in the queue, ensuring stability despite instantaneous traffic changes.
[0028] Elastic Cloud Servers (ECS) use Linux servers and have the ZiNiao backend's common services, commapi, built into them through image creation. Building on the legacy architecture, this server architecture supports flexible, configurable elastic scaling, dynamically increasing or decreasing the number of servers based on real-time demand, thereby improving the overall system's load capacity and fault tolerance. This is achieved through the introduction of elastic scaling groups, which automatically scale in and out based on the average CPU usage of the ECS instances within the group.
[0029] 1. When the expansion trigger condition is met, ESS sends an expansion event to MNS. MNS triggers the FC function calculation logic and periodically checks whether the list of healthy instances in ESS contains the ECS instance ID in the event. If so, it automatically configures the IP address to the upstream configuration corresponding to the NGINX server to achieve automatic expansion.
[0030] 2. When the scaling-down trigger condition is met, ESS sends a scaling-down event to MNS. MNS triggers the FC function calculation logic, immediately queries the list of healthy instances in ESS, and removes the ID of the ECS instance to be scaled down from the NGINX upstream configuration in advance, thus achieving automatic scaling-down.
[0031] 3. Scaling conditions are based on the average CPU metrics and time period of instances within the ESS elastic scaling group.
[0032] 3.1. If the average CPU usage exceeds 60% for 1 minute for 5 consecutive times at 8:40 am on weekdays, the system will directly expand the capacity by 30 units.
[0033] 3.2. If the CPU usage is less than 30% for 5 minutes for three consecutive times between 11pm and 8am the next day, the number of servers recycled will be reduced to 10.
[0034] 3.3. Effective all day, if the CPU usage exceeds 75% for 1 minute for 3 consecutive times, 2 more servers will be added;
[0035] 3.4. This setting is effective all day. If the CPU usage is below 50% for 1 minute for 10 consecutive times, the system will scale down by 2 servers, and the minimum number of servers will be 10.
[0036] Example 1
[0037] like Figure 1 As shown, this embodiment provides a cloud server scaling method for a browser, including: an NGINX server, at least one cloud server, an elastic scaling service, a message queue service, and a function computing service; the browser is connected to each cloud server through the NGINX server, specifically including the following steps:
[0038] Step 1: Set up a first number of cloud servers, and configure the IP addresses and ports of the cloud servers to the configuration file of the NGINX server, so that the NGINX server can perform reverse proxy.
[0039] Step 2: Configure the trigger conditions for expansion or contraction in the elastic scaling service. When the trigger conditions for expansion or contraction are met, the elastic scaling service sends an expansion event or a contraction event to the message queue service.
[0040] Step 3: When the Message Queue Service receives the capacity expansion event, it triggers the Function Compute Service. The Function Compute Service periodically checks whether the list of healthy instances in the Auto Scaling Service contains the cloud server instance ID in the capacity expansion event. If so, it configures the IP address to the configuration file corresponding to the NGINX server to implement capacity expansion.
[0041] When the Message Queue Service receives a scaling-down event, it triggers the Function Compute Service. The Function Compute Service queries the list of healthy instances in the Auto Scaling Service and removes the instance ID of the cloud server to be scaled down from the configuration file corresponding to the NGINX server in advance to implement the scaling-down.
[0042] In this embodiment, preferably, step 2 is specifically as follows:
[0043] The trigger condition for the expansion is: the average CPU usage of the cloud servers is obtained for 5 consecutive times for 1 minute each during the first set time period of the working day. If it exceeds 60%, the capacity is directly expanded to 30 servers; otherwise, the capacity is not expanded;
[0044] During the second set time period on weekdays, obtain the average CPU usage of the cloud servers for three consecutive 5-minute intervals. If it is less than 30%, recycle the servers to 10; otherwise, do not scale down.
[0045] The system takes effect all day, and measures the average CPU usage of the cloud servers for three consecutive times, one minute each. If the average CPU usage exceeds 75%, the server capacity is expanded by two; otherwise, no expansion is performed.
[0046] Effective throughout the day, the average CPU usage of the cloud servers is obtained 10 times in a row for 1 minute each time. If it is less than 50%, the server is scaled down by two, otherwise it is not scaled down.
[0047] The elastic scaling service sends expansion events or reduction events to the message queue service.
[0048] In this embodiment, preferably, a healthy instance list is provided in the elastic scaling service. The elastic scaling service obtains the heartbeat of each cloud server through a heartbeat mechanism, and records the IDs of cloud servers that operate normally in the healthy instance list, and removes the IDs of cloud servers that operate abnormally from the healthy instance list.
[0049] In this embodiment, preferably, an image is made for a universal service of a built-in browser, and when capacity expansion is required, the image is installed on a cloud server, and then the cloud server is started.
[0050] Based on the same inventive concept, this application also provides a device corresponding to the method in Example 1, see Example 2 for details.
[0051] Example 2
[0052] like Figure 2 As shown, in this embodiment, a cloud server scaling device for a browser is provided, including: an NGINX server, at least one cloud server, an elastic scaling service, a message queue service, and a function computing service; the browser is connected to each cloud server through the NGINX server, specifically including the following steps:
[0053] A configuration module is configured to set a first number of cloud servers, and configure the IP addresses and ports of the cloud servers to a configuration file of the NGINX server, so that the NGINX server performs reverse proxy.
[0054] A trigger module configures the expansion or contraction trigger conditions in the elastic scaling service. When the expansion or contraction trigger conditions are met, the elastic scaling service sends an expansion event or a contraction event to the message queue service.
[0055] The scaling module, when the message queue service receives a scaling event, triggers the function computing service. The function computing service periodically checks whether the list of healthy instances in the elastic scaling service contains the cloud server instance ID in the scaling event. If so, the IP address is configured in the configuration file corresponding to the NGINX server to achieve scaling.
[0056] When the Message Queue Service receives a scaling-down event, it triggers the Function Compute Service. The Function Compute Service queries the list of healthy instances in the Auto Scaling Service and removes the instance ID of the cloud server to be scaled down from the configuration file corresponding to the NGINX server in advance to implement the scaling-down.
[0057] In this embodiment, preferably, the trigger module is specifically:
[0058] The trigger condition for the expansion is: the average CPU usage of the cloud servers is obtained for 5 consecutive times for 1 minute each during the first set time period of the working day. If it exceeds 60%, the capacity is directly expanded to 30 servers; otherwise, the capacity is not expanded;
[0059] During the second set time period on weekdays, obtain the average CPU usage of the cloud servers for three consecutive 5-minute intervals. If it is less than 30%, recycle the servers to 10; otherwise, do not scale down.
[0060] The system takes effect all day, and measures the average CPU usage of the cloud servers for three consecutive times, one minute each. If the average CPU usage exceeds 75%, the server capacity is expanded by two; otherwise, no expansion is performed.
[0061] Effective throughout the day, the average CPU usage of the cloud servers is obtained 10 times in a row for 1 minute each time. If it is less than 50%, the server is scaled down by two, otherwise it is not scaled down.
[0062] The elastic scaling service sends expansion events or reduction events to the message queue service.
[0063] In this embodiment, preferably, a healthy instance list is provided in the elastic scaling service. The elastic scaling service obtains the heartbeat of each cloud server through a heartbeat mechanism, and records the IDs of cloud servers that operate normally in the healthy instance list, and removes the IDs of cloud servers that operate abnormally from the healthy instance list.
[0064] In this embodiment, preferably, an image is made for a universal service of a built-in browser, and when capacity expansion is required, the image is installed on a cloud server, and then the cloud server is started.
[0065] Since the device described in the second embodiment of the present invention is used to implement the method of the first embodiment of the present invention, those skilled in the art will be able to understand the specific structure and variations of the device based on the method described in the first embodiment of the present invention, and therefore will not be described in detail here. All devices used in the method of the first embodiment of the present invention fall within the scope of protection of the present invention.
[0066] Based on the same inventive concept, this application provides an electronic device embodiment corresponding to the first embodiment, see the third embodiment for details.
[0067] Example 3
[0068] This embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, any implementation method in the first embodiment can be implemented.
[0069] Since the electronic device described in this embodiment is the device used to implement the method in Example 1 of this application, based on the method described in Example 1 of this application, those skilled in the art will be able to understand the specific implementation of the electronic device of this embodiment and its various variations. Therefore, how the electronic device implements the method in the embodiment of this application will not be described in detail here. As long as the device used by those skilled in the art to implement the method in the embodiment of this application falls within the scope of protection to be provided by this application.
[0070] Based on the same inventive concept, this application provides a storage medium corresponding to Example 1, see Example 4 for details.
[0071] Example 4
[0072] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, any implementation method in the first embodiment can be implemented.
[0073] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0074] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0075] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0076] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0077] Although the specific embodiments of the present invention are described above, those skilled in the art should understand that the specific embodiments described are merely illustrative and are not intended to limit the scope of the present invention. Equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present invention should be included within the scope of protection of the claims of the present invention.
Claims
1. A method for scaling a cloud server for a browser, characterized by: include: NGINX server, at least one cloud server, Auto Scaling service, Message Queue service, and Function Compute service. The browser connects to each cloud server through the NGINX server, specifically including the following steps: Step 1: Set up a first number of cloud servers, and configure the IP addresses and ports of the cloud servers to the configuration file of the NGINX server, so that the NGINX server can perform reverse proxy. Step 2: Configure the trigger conditions for expansion or contraction in the elastic scaling service. When the trigger conditions for expansion or contraction are met, the elastic scaling service sends an expansion event or a contraction event to the message queue service. Step 3: When the Message Queue Service receives the capacity expansion event, it triggers the Function Compute Service. The Function Compute Service periodically checks whether the list of healthy instances in the Auto Scaling Service contains the cloud server instance ID in the capacity expansion event. If so, it configures the IP address to the configuration file corresponding to the NGINX server to implement capacity expansion. When the Message Queue Service receives a scaling-down event, it triggers the Function Compute Service. The Function Compute Service queries the list of healthy instances in the Auto Scaling Service and removes the instance ID of the cloud server to be scaled down from the configuration file corresponding to the NGINX server in advance to implement the scaling-down.
2. The method for scaling a cloud server for a browser according to claim 1, wherein: The step 2 is specifically as follows: The trigger condition for the expansion is: the average CPU usage of the cloud servers is obtained for 5 consecutive times for 1 minute each during the first set time period of the working day. If it exceeds 60%, the capacity is directly expanded to 30 servers; otherwise, the capacity is not expanded; During the second set time period on weekdays, obtain the average CPU usage of the cloud servers for three consecutive 5-minute intervals. If it is less than 30%, recycle the servers to 10; otherwise, do not scale down. The system takes effect all day, and measures the average CPU usage of the cloud servers for three consecutive times, one minute each. If the average CPU usage exceeds 75%, the server capacity is expanded by two; otherwise, no expansion is performed. Effective throughout the day, the average CPU usage of the cloud servers is obtained 10 times in a row for 1 minute each time. If it is less than 50%, the server is scaled down by two, otherwise it is not scaled down. The elastic scaling service sends expansion events or reduction events to the message queue service.
3. The method for scaling a cloud server for a browser according to claim 1, wherein: The elastic scaling service is provided with a healthy instance list. The elastic scaling service obtains the heartbeat of each cloud server through the heartbeat mechanism, records the IDs of cloud servers that are operating normally in the healthy instance list, and removes the IDs of cloud servers that are not operating normally from the healthy instance list.
4. The method for scaling a cloud server for a browser according to claim 1, wherein: Create an image for the general service of the built-in browser. When expansion is required, install it to the cloud server according to the image and then start the cloud server.
5. A telescoping device for a cloud server of a browser, characterized in that: include: NGINX server, at least one cloud server, Auto Scaling service, Message Queue service, and Function Compute service. The browser connects to each cloud server through the NGINX server, specifically including the following steps: A configuration module is configured to set a first number of cloud servers, and configure the IP addresses and ports of the cloud servers to a configuration file of the NGINX server, so that the NGINX server performs reverse proxy. A trigger module configures the expansion or contraction trigger conditions in the elastic scaling service. When the expansion or contraction trigger conditions are met, the elastic scaling service sends an expansion event or a contraction event to the message queue service. The scaling module, when the message queue service receives a scaling event, triggers the function computing service. The function computing service periodically checks whether the list of healthy instances in the elastic scaling service contains the cloud server instance ID in the scaling event. If so, the IP address is configured in the configuration file corresponding to the NGINX server to achieve scaling. When the Message Queue Service receives a scaling-down event, it triggers the Function Compute Service. The Function Compute Service queries the list of healthy instances in the Auto Scaling Service and removes the instance ID of the cloud server to be scaled down from the configuration file corresponding to the NGINX server in advance to implement the scaling-down.
6. The telescopic device for a cloud server of a browser according to claim 5, characterized in that: The trigger module is specifically: The trigger condition for the expansion is: the average CPU usage of the cloud servers is obtained for 5 consecutive times for 1 minute each during the first set time period of the working day. If it exceeds 60%, the capacity is directly expanded to 30 servers; otherwise, the capacity is not expanded; During the second set time period on weekdays, obtain the average CPU usage of the cloud servers for three consecutive 5-minute intervals. If it is less than 30%, recycle the servers to 10; otherwise, do not scale down. The system takes effect all day, and measures the average CPU usage of the cloud servers for three consecutive times, one minute each. If the average CPU usage exceeds 75%, the server capacity is expanded by two; otherwise, no expansion is performed. Effective throughout the day, the average CPU usage of the cloud servers is obtained 10 times in a row for 1 minute each time. If it is less than 50%, the server is scaled down by two, otherwise it is not scaled down. The elastic scaling service sends expansion events or reduction events to the message queue service.
7. The telescopic device for a cloud server for a browser according to claim 5, characterized in that: The elastic scaling service is provided with a healthy instance list. The elastic scaling service obtains the heartbeat of each cloud server through the heartbeat mechanism, records the IDs of cloud servers that are operating normally in the healthy instance list, and removes the IDs of cloud servers that are not operating normally from the healthy instance list.
8. The telescopic device for a cloud server of a browser according to claim 5, characterized in that: Create an image for the general service of the built-in browser. When expansion is required, install it to the cloud server according to the image and then start the cloud server.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method according to any one of claims 1 to 4 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.