Server scaling method, device, equipment and storage medium

By obtaining the number of users in the server cluster for automatic expansion and contraction, container technology is used to solve the problem of manual operation delay in existing technologies, achieving fast and manual-free server expansion and contraction, and avoiding server cluster paralysis and resource waste.

CN115292048BActive Publication Date: 2025-10-17BEIJING XINTANG SICHUANG EDUCATIONAL TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210993475.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-18
Publication Date
2025-10-17
Estimated Expiration
2042-08-18

AI Technical Summary

Technical Problem

In the prior art, due to reasons such as permission settings, users cannot read the performance parameters of the server, resulting in a large time delay in manually operated server expansion and contraction methods, making it difficult to achieve real-time and rapid expansion and contraction.

Method used

By obtaining the number of users currently accessing the server cluster and comparing it with the preset number threshold, the server in the server cluster that responds to the target service is automatically updated, and the server expansion and contraction are achieved using container technology.

Benefits of technology

This enables rapid scaling of servers without manual intervention when server performance parameters are unavailable, thus avoiding server cluster paralysis and resource waste.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115292048B_ABST
    Figure CN115292048B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a server scaling method, device, equipment and storage medium, the method comprising: obtaining a first number of users currently accessing a server cluster; comparing the first number of users with a preset number threshold to obtain a comparison result; and updating the number of servers in the server cluster responding to a target service according to the comparison result. The present disclosure can realize the scaling of the server by comparing the number of users accessing the server cluster with the preset number threshold, without obtaining the performance parameters of the server and without manual operation, which is simple, fast and easy to implement.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of computer, and particularly relates to a server capacity expansion and contraction method, device, equipment and storage medium. BACKGROUND

[0002] In a distributed server cluster service, as the access pressure of the cluster becomes larger and larger, the server cluster needs to be expanded in capacity; when the access pressure decreases, the server cluster needs to be contracted in capacity.

[0003] The commonly used server capacity expansion and contraction method is generally as follows: the performance parameters of each server are obtained, for example, the CPU usage rate, the disk utilization rate, etc., and the server capacity is expanded or contracted according to the performance parameters of each server and the parameter threshold of the server. In the use process of the server, due to various reasons such as permission setting, the user cannot read various performance parameters of the server. At this time, the server capacity expansion and contraction can only be realized through manual operation.

[0004] However, due to the time delay of manual operation, it is more difficult to realize real-time and rapid expansion and contraction. SUMMARY

[0005] In order to solve the above technical problems, the embodiments of the present disclosure provide a server capacity expansion and contraction method, device, equipment and storage medium, which can still realize real-time and rapid expansion and contraction in the case that various performance parameters of the server cannot be read.

[0006] In a first aspect, the embodiments of the present disclosure provide a server capacity expansion and contraction method, comprising:

[0007] obtaining a first user quantity currently accessing a server cluster;

[0008] comparing the first user quantity with a preset quantity threshold to obtain a comparison result;

[0009] updating servers responding to a target service in the server cluster according to the comparison result.

[0010] In a second aspect, the embodiments of the present disclosure provide a server capacity expansion and contraction device, comprising:

[0011] a first user quantity obtaining module, configured to obtain a first user quantity currently accessing a server cluster;

[0012] a user quantity comparison module, configured to compare the first user quantity with a preset quantity threshold to obtain a comparison result;

[0013] a server updating module, configured to update servers responding to a target service in the server cluster according to the comparison result.

[0014] In a third aspect, the embodiments of the present disclosure provide an electronic device, comprising:

[0015] one or more processors;

[0016] a storage device configured to store one or more programs;

[0017] When the one or more programs are executed by the one or more processors, the one or more processors implement the server scaling method according to any one of the first aspect.

[0018] In a fourth aspect, the embodiments of the present disclosure provide a computer readable storage medium, having stored thereon a computer program, which, when executed by a processor, implements the server scaling method according to any one of the first aspect.

[0019] In a fifth aspect, the embodiments of the present disclosure provide a computer program product, comprising a computer program or instructions, which, when executed by a processor, implements the server scaling method according to any one of the first aspect.

[0020] The server scaling method, device, equipment, storage medium and program product provided by the embodiments of the present disclosure can realize the scaling of the server by obtaining the number of users accessing the server cluster and comparing the number of users with the preset number threshold, without obtaining the performance parameters of the server and manual operation, which is simple, fast and easy to implement. BRIEF DESCRIPTION OF DRAWINGS

[0021] The above and other features, advantages, and aspects of the embodiments of the present disclosure will become more apparent by describing in detail the embodiments thereof with reference to the attached drawings. The same or similar components are denoted by the same or similar reference numerals throughout the drawings. It is to be understood that the drawings are schematic, and the original and elements are not necessarily drawn in proportion.

[0022] Figure 1 a flowchart of a server scaling method according to an embodiment of the present disclosure;

[0023] Figure 2 a flowchart of a server scaling method according to an embodiment of the present disclosure;

[0024] Figure 3 a schematic diagram of server scaling according to an embodiment of the present disclosure;

[0025] Figure 4 a schematic diagram of starting an application program using a container according to an embodiment of the present disclosure;

[0026] Figure 5A structural schematic diagram of a server capacity expansion device according to an embodiment of the present disclosure;

[0027] Figure 6 A structural schematic diagram of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0028] Embodiments of the present disclosure will be described in more detail with reference to the drawings. While certain embodiments of the present disclosure will be shown in the drawings and described below, it will be understood that the present disclosure can 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, and fully convey the scope of the present disclosure to those skilled in the art.

[0029] It should be understood that each step recited in the method embodiments of the present disclosure can be executed in different orders and / or in parallel. In addition, the method embodiments can include additional steps and / or omit the execution of the steps shown. The scope of the present disclosure is not limited in this respect.

[0030] The term "comprising" and variations thereof as used herein are used inclusively, i.e., "comprising but not limited to". The term "based on" is "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Related definitions will be given in the description below.

[0031] It should be noted that the terms "first", "second", and the like in the present disclosure are merely used to distinguish different devices, modules or units, and do not imply the order or interdependence of the functions performed by these devices, modules or units.

[0032] It should be noted that the adjectives "one", "more" in the present disclosure are illustrative rather than limiting, and those skilled in the art should understand that "one" or "more" should be understood as "one or more" unless the context clearly indicates otherwise.

[0033] The names of the messages or information exchanged between the devices in the embodiments of the present disclosure are used only for illustrative purposes, and are not intended to limit the scope of the messages or information.

[0034] The current commonly used server scaling method usually obtains performance parameters of each server, such as CPU usage, disk utilization, and the like, and performs scaling according to the performance parameters of each server and the parameter threshold of the server. During the use of the server, due to permission settings and other reasons, the user may not be able to read various performance parameters of the server. At this time, the server scaling can only be realized through manual operation. However, due to the large time delay of manual operation, it is more difficult to realize real-time and rapid scaling.

[0035] The server scaling method, device, equipment and storage medium provided in the embodiments of the present disclosure can realize the scaling of the server by obtaining the number of users accessing the server cluster and comparing the number of users with the set threshold, without obtaining the performance parameters of the server and without manual operation, which is simple, fast and easy to implement. The server scaling method provided in the embodiments of the present disclosure can be applied to the scene of a full online classroom server scaling and the like, in which the number of users is not fixed and the server cannot be scaled in advance.

[0036] The concepts that may be involved in the embodiments of the present disclosure are briefly introduced as follows.

[0037] A server cluster is a loosely coupled computing node set composed of two or more server nodes, which provides a single customer view of network services or application programs (including databases, Web services and file services, etc.) and provides fault recovery capability close to fault-tolerant machines.

[0038] A server cluster system is generally interconnected by two or more node servers through corresponding hardware and software, and each cluster node is an independent server running its own process. These processes can communicate with each other, and to the network client, it seems to form a single system, which cooperates to provide application programs, system resources and data to users. In addition to providing services as a single system, the server cluster system also has the ability to recover server-level faults. The server cluster system can also increase the processing capacity of the server from the inside by continuously adding servers in the cluster, and provide inherent reliability and availability through system-level redundancy.

[0039] A container (Docker) is an engine for implementing container image construction, distribution and running. Based on Docker, developers and administrators can use containers to develop, deploy and run application programs. Docker generally includes a Docker client (Docker Client) and a Docker engine (Docker Engine), and Docker is a daemon process that manages images and containers running on the host.

[0040] A container image is an executable package of a software that includes everything needed to run an application: code, runtime, system tools, system libraries, settings. When a container image runs, it is created as a container.

[0041] Specifically, the content of the container image usually includes a metadata file, a configuration file and at least one image layer file. The metadata file can be a manifest.json file, which records the metadata of all image layer files. The configuration file is used to record the memory size occupied by the image, the instruction type contained in the image, etc. The image layer file can be a layer file.

[0042] The server scaling method proposed by the embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0043] Figure 1 For the flowchart of the server scaling method in the embodiments of the present disclosure, the embodiments can be applicable to the case of scaling up or scaling down the server. The method can be executed by a server scaling device, which can be realized in the form of software and / or hardware, and can be configured in an electronic device.

[0044] As shown in FIG. 1, the server scaling method provided by the embodiments of the present disclosure mainly includes steps S101-S103. Figure 1

[0045] S101, obtaining a first user quantity of a server cluster currently being accessed.

[0046] The first user quantity can be understood as the total number of users currently accessing the server cluster, and can also be referred to as the user access quantity of the server cluster.

[0047] In an embodiment of the present disclosure, obtaining the first user quantity of the server cluster currently being accessed includes: obtaining in real time an access request sent by a client and received by the server cluster, and if the client successfully accesses the server cluster after the server responds to the access request, adding one to the first user quantity as a new first user quantity.

[0048] In an embodiment of the present disclosure, obtaining the first user quantity of the server cluster currently being accessed can also include: monitoring the connection relationship between the client and the server in real time, and after monitoring that the connection between the client and the server is disconnected, subtracting one from the first user quantity as a new first user quantity.

[0049] ​The disconnection of the connection between the client and the server can include that the server cluster receives a disconnection request sent by the client, and then disconnects the connection with the client. The disconnection of the connection between the client and the server can also include that the client periodically sends a heartbeat message to the server cluster, and if the server cluster does not receive the heartbeat message within a period, it is determined that the connection between the client and the server is disconnected.

[0050] In an embodiment of the present disclosure, obtaining the first number of users currently accessing the server cluster can include that if the server cluster includes a function of counting the number of user accesses, a user access quantity obtaining request is sent to the server cluster, and the server returns the first number of users currently accessing the server cluster after responding to the user access quantity obtaining request.

[0051] It should be noted that in the embodiments of the present disclosure, only the method of obtaining the first number of users currently accessing the server cluster is simply described, and other methods of obtaining the number of users accessing the server cluster are also within the protection scope of the present disclosure.

[0052] S102, compare the first number of users with a preset number threshold to obtain a comparison result.

[0053] The preset number threshold can be understood as a value for representing the size of the server access pressure. The preset number threshold can be a single value or multiple values, and the embodiments of the present disclosure do not make specific limitations.

[0054] In an embodiment of the present disclosure, the preset number threshold includes a first number threshold and a second number threshold, wherein the first number threshold is greater than the second number threshold. The first number threshold can be understood as a value for representing that the server access pressure is too large, and the second number threshold can be understood as a value for representing that the server access pressure is too small. At this time, the comparison result can include that the first number of users is greater than or equal to the first number threshold, or the first number of users is less than or equal to the second number threshold, or the first number of users is greater than the second number threshold and less than the first number threshold.

[0055] In an embodiment of the present disclosure, the above-mentioned preset number threshold can be dynamically set according to actual conditions or historical experience. For example, for a server cluster providing online learning services for primary and secondary school students, because the number of primary and secondary school students surfing the Internet to learn is larger during the day, the first number threshold can be set smaller, so that more servers responding to the target service in the server cluster can be added in advance to avoid the server cluster from being paralyzed due to a large number of users pouring in within a short period of time. Because the number of primary and secondary school students surfing the Internet to learn is smaller at night, especially at midnight, the first number threshold can be set larger, so that more servers are not added in advance to avoid resource waste.

[0056] Further, the historical access user quantity corresponding to each course can be obtained, and the historical access user quantity corresponding to each course sets the first quantity threshold. For example, the historical access user quantity of the mathematics course is 100,000, and the historical access user quantity of the biology course is 10,000. The first quantity threshold can be set to be smaller before the mathematics course starts or after the mathematics course starts, so that the servers in the server cluster that respond to the target service can be increased in advance. The first quantity threshold can be set to be larger before the biology course starts or after the biology course starts, so that more servers are not unnecessarily increased in advance, causing resource waste. In addition, the preset quantity threshold can also be set according to the evaluation of students on the teaching teachers and the popularity of the teaching teachers. For example, the first quantity threshold can be set to be smaller in the course time period corresponding to the teaching teacher with high popularity, and the first quantity threshold can be set to be larger in the course time period corresponding to the teaching teacher with low popularity.

[0057] In an embodiment of the present disclosure, the first quantity threshold can be set according to the usage habits and historical experience of the customer group of the service provided by the server cluster. The specific setting method is not described in detail in the embodiments of the present disclosure.

[0058] S103, updating the number of servers in the server cluster that respond to the target service according to the comparison result.

[0059] In an embodiment of the present disclosure, when the comparison result is that the first user quantity is greater than or equal to the first quantity threshold, the number of servers in the server cluster that respond to the target service is increased. When the comparison result is that the first user quantity is less than or equal to the second quantity threshold, the number of servers in the server cluster that respond to the target service is reduced, where the second quantity is less than the first quantity threshold.

[0060] In an embodiment of the present disclosure, when the comparison result is that the first user quantity is greater than or equal to the first quantity threshold, the number of servers in the server cluster that respond to the target service is increased, so that the number of servers in the server cluster that respond to the target service is increased in advance, avoiding a large number of users from pouring in within a short time, causing the server cluster to be paralyzed.

[0061] In an embodiment of the present disclosure, when the comparison result is that the first user quantity is less than the second quantity threshold, the number of servers in the server cluster that respond to the target service is reduced, so as to avoid that too many servers provide services for a small number of clients, causing resource waste. When the comparison result is that the first user quantity is greater than the second quantity threshold and less than the first quantity threshold, the number of servers in the server cluster that respond to the target service is kept unchanged.

[0062] Most of the prior art game server cluster or shopping server cluster adopts an early expansion scheme, which is an expansion scheme before the server cluster provides a target service. For example, the game server cluster is expanded in advance before a game competition, or the shopping server cluster is expanded in advance before a shopping promotion.

[0063] The above early expansion scheme provides a service after expansion is completed, but during the process of providing a service by the server cluster, expansion of the server cannot be performed. Once the number of users is too large, the client access will be too slow, and even the server cluster will be paralyzed. The server expansion and contraction method provided in the embodiments of the present disclosure can adjust the number of servers providing a target service in real time according to the number of users accessing the server cluster during the provision of the target service by the server cluster, and can realize expansion and contraction of the server, thereby avoiding paralysis of the server cluster caused by too many users.

[0064] In an embodiment of the present disclosure, the above server expansion and contraction method is further optimized, as shown in Figure 2 The optimized server expansion and contraction method mainly includes steps S201-S208.

[0065] S201, obtaining a first number of users currently accessing the server cluster.

[0066] The step S201 in the embodiments of the present disclosure has the same execution process as the step S101 in the above embodiments, and the specific description can refer to the description in the above embodiments. The embodiments of the present disclosure will not be described again.

[0067] S202, comparing the first number of users with a first number threshold.

[0068] In the embodiments of the present disclosure, the first number of users is compared with the first number threshold, and the sizes of the two values are compared. The method of value comparison is not limited in the embodiments of the present disclosure.

[0069] S203, in response to the first number of users being greater than or equal to the first number threshold, increasing the number of servers in the server cluster responding to the target service and executing the target service by using the updated server cluster.

[0070] The first quantity threshold is a value indicating excessive access pressure on the server cluster. The first quantity threshold can be set based on actual conditions. In other words, if the number of first users is greater than the first quantity threshold, i.e., the number of users currently accessing the server cluster is greater than the first quantity threshold, then this indicates that there are too many users currently accessing the server cluster, and the access pressure on the server cluster is too high. In this case, it is necessary to increase the number of servers responding to the target service.

[0071] Furthermore, the first threshold is determined by the total number of user visits when the server cluster is fully loaded. For example, when the server cluster is fully loaded, the number of users that can be received is 100. When the actual number of users reaches 70% of the full load, it is set that the access pressure on the server cluster is too high. In this case, the first threshold is 70.

[0072] Increasing the number of servers in the server cluster that respond to the target service may mean that when the server cluster receives a new user access request, the client corresponding to the user is connected to the newly added server so that the newly added server can provide the target service to the client.

[0073] like Figure 3 As shown, there are originally two servers (server A and server B) in the server cluster 31 for responding to the target service. When the number of first users increases to more than the first number threshold, the increase in access volume cannot avoid server crashes, and a new server (server C) is added to the server cluster 31. The new server (server C) and the two original servers (server A and server B) in the server cluster jointly respond to the target service.

[0074] In one embodiment of the present disclosure, increasing the number of servers in the server cluster that respond to the target service and using the updated server cluster to execute the target service includes: determining a server in the server cluster that is in an idle state as a newly added server; generating a server start instruction; starting the newly added server based on the server start instruction; using container technology to start the target application in the newly added server; and using the server cluster including the newly added server to execute the target service.

[0075] In the embodiments of the present disclosure, the server in the idle state refers to any server in the server cluster that does not respond to the target service. The server can be in a closed state and does not respond to any service, or can be responding to a service with a priority lower than that of the target service, for example, a server that is responding to file management or program management. The new server refers to a server that is about to be started and installed with the target application to respond to the target service. The server start instruction refers to an instruction used to control the start of the new server.

[0076] In one embodiment of the present disclosure, in response to determining that the server in the idle state is the new server, a server start instruction is generated.

[0077] In one embodiment of the present disclosure, the new server is automatically started in response to the server start instruction. Starting the new server at least includes turning on the power supply, loading the input / output system of the new server, reading the master boot record (MBR) of the new server, loading the kernel of the new server, and the like.

[0078] The container technology is a lightweight virtualization technology, and is a lightweight, portable and self-contained software packaging technology, so that the application program can run in the same way almost anywhere. Starting the target application program by using the container technology can be understood as starting and running the target application program in the new server by using the container technology.

[0079] The container technology needs to be pre-installed on the server, and the Docker tool needs to be deployed. When the server code needs to be deployed, the container cluster management tool such as Kubernetes is started first. The server receives a start instruction of the container cluster management tool for managing the Docker container, and the start instruction is obtained after responding to the operation of starting the new server.

[0080] The Docker is an application container engine. Through the Docker, an application program and a dependent package set for running the application program can be collected into a portable container. The Docker is composed of three cores, namely, an image, a container and a repository.

[0081] The target service refers to a service currently provided by the server cluster, for example, an online class and the like.

[0082] In the embodiments of the present disclosure, the container technology is used to expand the server, so that the automatic server cluster automatic expansion can be realized, manual expansion can be avoided, and the expansion efficiency can be improved.

[0083] In one embodiment of the present disclosure, the starting the target application in the added server by using the container technology comprises: creating a first container and a second container in the added server; downloading a module file required by the target application by using the first container and storing the module file in a local disk; downloading a main program file required by the target application by using the second container; obtaining the module file from the local disk through a data volume synchronization mode; and starting the target application based on the main program file and the module file.

[0084] The module file can be a mod file in the target application. Taking a real course module as an example, the real course module is a virtual teaching aid, a virtual table and chair, and a virtual role, for example, a virtual teacher and a virtual student, which can exist in a real course.

[0085] The downloading of the main program file required by the target application by using the second container comprises: pulling a main program image by using the second container. The image is created manually or obtained from an image warehouse, and the main program image is created on the Dockerfile. In one embodiment, the step of pulling the main program image comprises: receiving the creation of the main program image or obtaining the main program image from the image warehouse. Specifically, the image is static and is a mapping of files shared by containers, but cannot be operated. The image is built, that is, the image is built. The main program image is a read-only template for container runtime, and each image is composed of a series of layers.

[0086] The data volume synchronization mode is a mode of synchronizing data between multiple containers. Specifically, the first container is mounted on a certain directory on the second container through the instruction volumes-from, at which time the data synchronization between the two containers is achieved, and the second container is a data volume container.

[0087] The starting of the target application based on the main program file and the module file can be understood as that the container runs the target application based on the main program file and the module file.

[0088] Specifically, as shown in FIG. 1, the module file is downloaded through the first container, the image file of the main program is pulled through the second container, then the module file is obtained through the data volume synchronization mode by the second container, and the target application is started based on the image file and the module file. Figure 4

[0089] ​In the prior art, the module file is stored in the image file, that is, the image file includes both the main program file and the module file, which causes the size of the image file to be large. When the image file is pulled through a container, the acquisition speed of the image file is reduced and the time for pulling the image file is increased under the same network speed. In the embodiment of the present disclosure, the module file is downloaded through the first container and the main program file is pulled through the second container, that is, the module file and the main program file are acquired by two different containers, which can accelerate the acquisition speed of the file and reduce the time for pulling the image file.

[0090] S204, compare the first user quantity with a second quantity threshold.

[0091] In the embodiment of the present disclosure, the manner in which the first user quantity is compared with the second quantity threshold is not specifically limited in the embodiment of the present disclosure.

[0092] S205, in response to the first user quantity being less than or equal to the second quantity threshold, reducing the number of servers in the server cluster that respond to the target service and executing the target service by using the updated server cluster, wherein the second quantity threshold is less than the first quantity threshold.

[0093] If the first user quantity is less than the second quantity threshold, that is, the number of users currently accessing the server cluster is less than the second quantity threshold, it indicates that the number of users currently accessing the server cluster is too small, and at this time, the number of servers responding to the target service needs to be reduced to avoid resource waste.

[0094] It should be noted that the execution sequence between step S202 and step S204 is not limited in the embodiment of the present disclosure. S202 can be executed first and then S204 can be executed. S204 can be executed first and then S202 can be executed, or S202 and S204 can be executed simultaneously.

[0095] In one embodiment of the present disclosure, in response to the first user quantity being less than the second quantity threshold, reducing the number of servers in the server cluster that respond to the target service includes: for each server in the server cluster, acquiring the current access user quantity of each server; monitoring the target access user quantity corresponding to the target server with the smallest current access user quantity in real time; and in response to the target access user quantity being lower than a third quantity threshold, closing the target server.

[0096] In the embodiments of the present disclosure, the number of current access user quantities is the same as the number of servers in the server cluster that are responding to the target service, and one-to-one correspondence. For example, there are three servers in the server cluster responding to the target service, and three current access user quantities are obtained. For example, the current access user quantity m1 corresponding to server A, the current access user quantity m2 corresponding to server B, and the current access user quantity m3 corresponding to server C.

[0097] The three current access user quantities m1, m2 and m3 are compared to obtain the current access user quantity with the smallest value. The server C corresponding to the current access user quantity m3 with the smallest value is determined as the target server.

[0098] In the embodiments of the present disclosure, as the old users disconnect from the server cluster (for example, the old users exit the game client), and as the new users establish connections with the server cluster (for example, the new users log in the game client), the number of users accessing the server cluster changes constantly.

[0099] In the embodiments of the present disclosure, after the target server is determined, if an access request sent by a client is received, the client corresponding to the access request is connected with a non-target server, and the target server no longer receives the access request of the client, that is, no longer establishes a communication connection with a new client. As time goes on, the clients accessing the target server gradually leave, and the number of users accessing the target server gradually decreases.

[0100] The threshold value can be set according to actual conditions, and optionally, the threshold value is 0.

[0101] In one embodiment of the present disclosure, when the target access user quantity accessing the target server decreases to 0, it indicates that no client is accessing the target server, and at this time, the target server is closed, and the target server no longer responds to the target service.

[0102] In the embodiments of the present disclosure, when it is necessary to reduce the servers responding to the target service, according to the number of users accessing the server, the server to be closed is determined, and when the number of users accessing the server decreases to 0, the server is closed, so as to avoid too many servers responding to the target service and causing resource waste.

[0103] Figure 5 FIG. 1 is a structural schematic diagram of a server expansion and contraction device in an embodiment of the present disclosure. The server expansion and contraction device can be used in the case of expanding or contracting the server, and can be realized in the form of software and / or hardware, and can be configured in an electronic device.

[0104] As Figure 5As shown, the server scaling device provided by the embodiment of the present disclosure mainly comprises a first user quantity obtaining module 51, a user quantity comparison module 52 and a server updating module 53.

[0105] The first user quantity obtaining module 51 is configured to obtain a first user quantity currently accessing a server cluster; the user quantity comparison module 52 is configured to compare the first user quantity with a preset quantity threshold to obtain a comparison result; and the server quantity updating module 53 is configured to update servers responding to a target service in the server cluster according to the comparison result.

[0106] The present disclosure relates to a server scaling device for performing the following processes: obtaining a first user quantity currently accessing a server cluster; comparing the first user quantity with a preset quantity threshold to obtain a comparison result; and updating servers responding to a target service in the server cluster according to the comparison result. The embodiment of the present disclosure can realize the scaling of the servers by comparing the user quantity accessing the server cluster with the set quantity threshold, without obtaining the performance parameters of the servers or manual operation, which is simple, fast and easy to implement.

[0107] In one embodiment of the present disclosure, the server updating module comprises: a first comparison unit configured to compare the first user quantity with a first quantity threshold; a server increasing unit configured to, in response to the first user quantity being greater than or equal to the first quantity threshold, increase the number of servers responding to the target service in the server cluster and execute the target service by using the updated server cluster; and / or a first comparison unit configured to compare the first user quantity with a second quantity threshold; a server decreasing unit configured to, in response to the first user quantity being less than or equal to the second quantity threshold, decrease the number of servers responding to the target service in the server cluster and execute the target service by using the updated server cluster, wherein the second quantity threshold is less than the first quantity threshold.

[0108] In one embodiment of the present disclosure, the server increasing unit comprises: a new server determining subunit configured to determine a server in an idle state in the server cluster as a new server; a start instruction generating subunit configured to generate a server start instruction; a new server starting subunit configured to start the new server based on the server start instruction; an application program starting subunit configured to start a target application program in the new server by using a container technology; and a target service executing subunit configured to execute the target service by using the server cluster including the new server.

[0109] In one embodiment of the present disclosure, the application program starting subunit comprises: a container creating unit configured to create a first container and a second container in the new server; a module file downloading unit configured to download module files required by the target application program by using the first container, and store the module files in a local disk; a main program file downloading unit configured to download main program files required by the target application program by using the second container; a module file synchronizing unit configured to acquire the module files from the local disk through a data volume synchronization manner; and an application program starting unit configured to start the target application program based on the main program files and the module files.

[0110] In one embodiment of the present disclosure, the server reducing unit comprises: a current access user amount obtaining subunit configured to obtain a current access user amount of each server in the server cluster; a target access user number monitoring subunit configured to monitor a target access user number corresponding to a target server with the smallest current access user amount in real time; and a target server closing subunit configured to close the target server in response to the target access user number being lower than a third number threshold.

[0111] In one embodiment of the present disclosure, the server reducing unit further comprises: a client accessing subunit configured to monitor a target access user number corresponding to a target server with the smallest current access user amount in real time, and if an access request sent by a client is received before, access the client to a non-target server, wherein the non-target server refers to a server other than the target server with the smallest current access user amount in the server cluster.

[0112] The server expansion and contraction apparatus provided by the embodiments of the present disclosure can perform the steps performed in the server expansion and contraction method provided by the method embodiments of the present disclosure, and the execution steps and advantages are not repeated here.

[0113] Figure 6 FIG. 1 is a structural schematic diagram of an electronic device according to an embodiment of the present disclosure. The following will be specifically described with reference to Figure 6 FIG. 1 is a structural schematic diagram of an electronic device according to an embodiment of the present disclosure. The following will be specifically described with reference to Figure 6 The electronic device shown in the figure is only an example, and should not bring any limitation to the functions and use range of the embodiments of the present disclosure.

[0114] As shown in Figure 6 The electronic device 600 can include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601 that can perform various appropriate actions and processes to implement the server scaling method of embodiments as described in the present disclosure according to programs stored in a read-only memory (ROM) 602 or loaded into a random access memory (RAM) 603 from a storage device 608. Various programs and data required for the operation of the terminal device 600 are also stored in the RAM 603. The processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0115] In general, the following devices can be connected to the I / O interface 605: input devices 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 608 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 609. The communication devices 609 can allow the terminal device 600 to communicate with other devices wirelessly or via wires to exchange data. Although Figure 6 The terminal device 600 is shown with various devices, but it should be understood that all of the shown devices are not required to be implemented or present. More or fewer devices can alternatively be implemented or present.

[0116] In particular, the processes described above with reference to the flowcharts can be implemented as a computer software program according to embodiments of the present disclosure. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods illustrated by the flowcharts to implement the server scaling method as described above. In such embodiments, the computer program can be downloaded and installed from a network through the communication devices 609, or installed from the storage devices 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-described functions defined in the methods of embodiments of the present disclosure are performed.

[0117] It should be noted that the computer-readable medium described above can be a computer-readable signal medium or a computer-readable storage medium or any combination thereof. 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 any suitable combination of the above. More specific examples of the computer-readable storage medium can 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 above. In the present disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program used by or in connection with an instruction execution system, apparatus or device. In the present disclosure, the computer-readable signal medium can include a data signal propagated in baseband or propagated as a carrier wave in a propagated data signal, in which the computer-readable program code is contained. Such a propagated data signal can take any of a variety of forms, including but not limited to electro-magnetic, optical, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium that is not a 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. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wire, cable, optical fiber, RF, etc., or any suitable combination of the above.

[0118] In some embodiments, the client, server, or both can communicate using any current known or future developed network protocol, such as HTTP (Hyper Text Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), the Internet, and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any current known or future developed networks.

[0119] The computer-readable medium described above can be included in the electronic device described above; or can exist separately from the electronic device, and can be accessed via the electronic device.

[0120] The computer readable medium carries one or more programs when the one or more programs are executed by the terminal device, the terminal device: acquires a first quantity of users currently accessing a server cluster; compares the first quantity of users with a preset quantity threshold to obtain a comparison result; and updates a server in the server cluster that responds to a target service according to the comparison result.

[0121] Optionally, when the one or more programs are executed by the terminal device, the terminal device can further perform other steps described in the above embodiments.

[0122] Computer program code for carrying out operations of the present disclosure can be written in one or more programming languages or combinations of languages including object oriented programming languages such as Java, Smalltalk, C++ or conventional procedural programming languages such as the "C" programming language or similar programming languages. The program code can 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 latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).

[0123] The flowcharts and block diagrams in the accompanying drawings 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 flowcharts and block diagrams can represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can 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 can 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 illustrations, and combinations thereof, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or combinations of hardware and software.

[0124] The units described in the embodiments of the present disclosure can be implemented by software or by hardware. In some cases, the names of the units do not constitute a limitation on the units themselves.

[0125] The functionality described above in this document can be performed, at least in part, by one or more hardware logic components. For example, and without limitation, non- transitory machine-readable media can include RAM, ROM, programmable ROM (EPROM, EEPROM or flash memory), or any other storage device(s) through which program instructions can be stored and executed by a processing unit. The above described functions can be implemented as software modules or software functions using object-oriented design methodology, or using any other suitable programming technique.

[0126] In the context of the present disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium will include one or more of: 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.

[0127] The foregoing description merely exemplifies the preferred embodiments of the disclosure and the principles of the technology involved. It is believed that those skilled in the art can accomplish the disclosure with the enclosed claims without any creative work. The scope of the disclosure should not be limited by the technical features of the specific embodiments described above, but should include all the technical solutions falling within the concept of the disclosure, which are obtained by combining the technical features described above or equivalent features thereof in any manner. For example, the technical solutions formed by replacing the above-described features with the technical features disclosed in the disclosure (but not limited to) having similar functions.

[0128] Furthermore, while operations are depicted in a particular, chronological sequence in this disclosure, this should not be understood as requiring that such operations be performed in the order shown or that all illustrated operations be performed, to perform impact. In certain circumstances, multitasking and parallel processing can be advantageous. Likewise, the various embodiments can be implemented in software, hardware, or firmware, or any combination thereof. Moreover, the specific hardware or software modules described in the above discussion are meant to be illustrative of the functions performed, and not meant to limit the scope of the disclosure. Certain features described in the context of separate embodiments can also be implemented together in a single embodiment. Conversely, various features described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable sub-combination.

[0129] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims

1. A server expansion and contraction method, characterized in that: include: Get the number of first users currently accessing the server cluster; Comparing the first number of users with a preset number threshold to obtain a comparison result; According to the comparison result, updating the server in the server cluster that responds to the target service; The comparing the first number of users with a preset number threshold to obtain a comparison result, and updating the server in the server cluster that responds to the target service according to the comparison result, includes: comparing the first number of users with a first number threshold; In response to the number of the first users being greater than or equal to the first number threshold, increasing the number of servers in the server cluster that respond to the target service and executing the target service using the updated server cluster; Executing the target service using the updated server cluster includes: Use container technology to start the target application on the newly added server; executing the target service using the server cluster including the newly added server; The method of starting the target application in the newly added server by using the container technology includes: Creating a first container and a second container in the newly added server; Downloading module files required by the target application using the first container, and storing the module files in a local disk; Downloading the main program file required by the target application using the second container; Obtain the module file from the local disk through data volume synchronization; The target application is started based on the main program file and the module file.

2. The method according to claim 1, characterized in that The step of comparing the first number of users with a preset number threshold to obtain a comparison result, and updating the server in the server cluster that responds to the target service according to the comparison result, further includes: comparing the first number of users with a second number threshold; In response to the first user quantity being less than or equal to the second quantity threshold, the number of servers in the server cluster responding to the target service is reduced and the target service is executed using the updated server cluster, wherein the second quantity threshold is less than the first quantity threshold.

3. The method according to claim 1, characterized in that Increasing the number of servers in the server cluster that respond to the target service includes: Determine a server in an idle state in the server cluster as a newly added server; Generate server start instructions; The newly added server is started based on the server start instruction.

4. The method according to claim 2, characterized in that In response to the number of the first users being less than the second number threshold, reducing the number of servers in the server cluster that respond to the target service includes: For each server in the server cluster, obtain the current number of access users of each server; Real-time monitoring of the target number of access users corresponding to the target server with the smallest number of access users; In response to the number of the target access users being lower than a third threshold, shutting down the target server.

5. The method according to claim 4, characterized in that Real-time monitoring of the target number of access users corresponding to the target server with the smallest number of access users. Previously, this also included: If an access request is received from a client, the client corresponding to the access request is connected to a non-target server, wherein the non-target server refers to other servers in the server cluster except the target server with the smallest number of current access users.

6. A server expansion and contraction device, characterized in that: include: A first user quantity acquisition module, configured to acquire the number of first users currently accessing the server cluster; A user quantity comparison module, configured to compare the first number of users with a preset number threshold to obtain a comparison result; A server updating module, configured to update the server in the server cluster that responds to the target service according to the comparison result; The comparing the first number of users with a preset number threshold to obtain a comparison result, and updating the server in the server cluster that responds to the target service according to the comparison result, includes: comparing the first number of users with a first number threshold; In response to the number of the first users being greater than or equal to the first number threshold, increasing the number of servers in the server cluster that respond to the target service and executing the target service using the updated server cluster; Executing the target service using the updated server cluster includes: Use container technology to start the target application on the newly added server; executing the target service using the server cluster including the newly added server; The method of starting the target application in the newly added server by using the container technology includes: Creating a first container and a second container in the newly added server; Downloading module files required by the target application using the first container, and storing the module files in a local disk; Downloading the main program file required by the target application using the second container; Obtain the module file from the local disk through data volume synchronization; The target application is started based on the main program file and the module file.

7. The device according to claim 6, characterized in that The server update module further includes: a first comparing unit, configured to compare the first number of users with a second number threshold; A server reduction unit is configured to reduce the number of servers in the server cluster that respond to a target service and execute the target service using the updated server cluster in response to the first number of users being less than or equal to the second number threshold, wherein the second number threshold is less than the first number threshold.

8. An electronic device, characterized in that: The electronic device comprises: one or more processors; a storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.

9. 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 5 is implemented.

Citation Information

Patent Citations

  • Within-server group capacity expansion method, device, storage medium and system

    CN107911419A