WO2018121334A1 - 一种提供网页应用服务的方法、装置、电子设备及系统 - Google Patents
一种提供网页应用服务的方法、装置、电子设备及系统 Download PDFInfo
- Publication number
- WO2018121334A1 WO2018121334A1 PCT/CN2017/117081 CN2017117081W WO2018121334A1 WO 2018121334 A1 WO2018121334 A1 WO 2018121334A1 CN 2017117081 W CN2017117081 W CN 2017117081W WO 2018121334 A1 WO2018121334 A1 WO 2018121334A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- web
- container unit
- web container
- web application
- application
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 70
- 238000012544 monitoring process Methods 0.000 claims description 144
- 230000008569 process Effects 0.000 claims description 35
- 230000008602 contraction Effects 0.000 claims description 18
- 238000013500 data storage Methods 0.000 claims 1
- 238000012545 processing Methods 0.000 abstract description 5
- 238000005516 engineering process Methods 0.000 description 8
- 230000009467 reduction Effects 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 230000005012 migration Effects 0.000 description 4
- 238000013508 migration Methods 0.000 description 4
- 230000003247 decreasing effect Effects 0.000 description 3
- 238000002955 isolation Methods 0.000 description 3
- 101150005267 Add1 gene Proteins 0.000 description 2
- 101150060298 add2 gene Proteins 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 1
- 230000000593 degrading effect Effects 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000002085 persistent effect Effects 0.000 description 1
- 238000004886 process control Methods 0.000 description 1
- 239000000047 product Substances 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 239000013589 supplement Substances 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
- H04L67/025—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/4557—Distribution of virtual machine instances; Migration and load balancing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45595—Network integration; Enabling network access in virtual machine instances
Definitions
- the present invention relates to the field of networks, and in particular, to a method, device, electronic device and system for providing a webpage application service.
- the traditional scheme of using web hosting to provide web (Web) applications is: a virtual host server, which starts the web (web) server (apache, tomcat or IIS, etc.) software, and places dozens or even hundreds of virtual sites, virtual System resources and namespaces are shared between sites.
- web server apache, tomcat or IIS, etc.
- the program mainly has the following types of common problems:
- Container technology can improve application availability and security isolation; container technology is deployed in the virtual machine (Virtual Machines, VM) application environment, deployed to Linux containers (Linux Container, LXC), Docker and other containers, so It can enhance the reliability of a single server system, but there are still many problems such as the server where the container is located, resulting in single point of failure, low resource utilization, long data migration time, and limited storage disk space.
- VM Virtual Machines
- LXC Linux Container
- Docker Docker and other containers
- the present application provides an access method, device, electronic device and system for providing a web application service, which can improve the reliability of a web application service.
- a method of providing a web application service comprising:
- the forwarding the access request to the selected web container unit includes:
- the access request is forwarded according to the address of the host where the selected web container unit is located, and the port to which the selected web container unit is bound on the host.
- the host machine is a virtual machine.
- the plurality of web container units run on different hosts.
- the web container unit corresponding to the same web application stores data in a directory corresponding to the web application in the network attached storage device.
- the method further includes:
- the monitoring data includes one or more of the following parameters of the web container unit:
- the usage of the CPU of the CPU the usage of the memory, the maximum number of concurrent requests for access per unit time, and the number of access requests that exceed the preset threshold.
- the adjusting the number of web container units corresponding to the web application according to the acquired monitoring data includes at least one of the following:
- the number of web container units corresponding to the web application is reduced.
- a method of providing a web application service comprising:
- the monitoring data includes one or more of the following parameters of the web container unit:
- the usage of the CPU of the CPU the usage of the memory, the maximum number of concurrent requests for access per unit time, and the number of access requests that exceed the preset threshold.
- the adjusting the number of web container units corresponding to the web application according to the acquired monitoring data includes at least one of the following:
- the number of web container units corresponding to the web application is reduced.
- the increasing the number of web container units corresponding to the web application comprises:
- Determining a host from a host in which the remaining resources are capable of creating at least one web container instructing the determined host to create a web container unit corresponding to the web application.
- the reducing the number of web container units corresponding to the web application comprises:
- Determining a web container unit from the web container unit corresponding to the web application, indicating that the host device where the determined web container unit is located deletes the web container unit corresponding to the web application.
- a device for providing a web application service comprising:
- a selection module configured to: after receiving a user access request for the webpage web application, select a web container unit from the web container unit corresponding to the web application; wherein the web container unit is configured to process the received access request ;
- a forwarding module configured to forward the access request to the selected web container unit.
- forwarding, by the forwarding module, the access request to the selected web container unit includes:
- the forwarding module forwards the access request according to the address of the host where the selected web container unit is located, and the port to which the selected web container unit is bound on the host.
- the plurality of web container units run on different hosts.
- the storage directory of the web container unit corresponding to each web application is a directory corresponding to the web application in the network attached storage device.
- the device further includes:
- An obtaining module configured to acquire monitoring data of a web container unit corresponding to each webpage web application
- the adjustment module is configured to adjust the number of web container units corresponding to the web application according to the acquired monitoring data.
- the monitoring data includes one or more of the following parameters of the web container unit:
- the usage of the CPU of the CPU the usage of the memory, the maximum number of concurrent requests for access per unit time, and the number of access requests that exceed the preset threshold.
- the adjusting module adjusts, according to the acquired monitoring data, the number of web container units corresponding to the web application, including at least one of the following:
- the adjustment module increases the number of the web container unit corresponding to the web application
- the adjustment module reduces the number of web container units corresponding to the web application.
- a device for providing a web application service comprising:
- An obtaining module configured to acquire monitoring data of a web container unit corresponding to each webpage web application; wherein, one web application corresponds to one or more web container units, and the web container unit is configured to process an access request for the corresponding web application ;
- the adjustment module is configured to adjust the number of web container units corresponding to the web application according to the acquired monitoring data.
- the monitoring data includes one or more of the following parameters of the web container unit:
- the usage of the CPU of the CPU the usage of the memory, the maximum number of concurrent requests for access per unit time, and the number of access requests that exceed the preset threshold.
- the adjusting module adjusts, according to the acquired monitoring data, the number of web container units corresponding to the web application, including at least one of the following:
- the adjustment module increases the number of the web container unit corresponding to the web application
- the adjustment module reduces the number of web container units corresponding to the web application.
- the adjusting module increases the number of web container units corresponding to the web application, including:
- the adjustment module determines a host from a host in which the remaining resources are capable of creating the at least one web container, and instructs the determined host to create a web container unit corresponding to the web application.
- the adjusting module reduces the number of web container units corresponding to the web application, including:
- the adjustment module determines a web container unit from the web container unit corresponding to the web application, and indicates that the host device where the determined web container unit is located deletes the web container unit corresponding to the web application.
- An electronic device for providing a webpage application service comprising: a first memory and a first processor;
- the first memory is configured to save a program for providing a webpage application service, and the program for providing a webpage service, when being read and executed by the first processor, performs the following operations:
- An electronic device for providing a web application service comprising: a second memory and a second processor;
- the second memory is configured to save a program for providing a webpage application service, and the program for providing a webpage service, when being read and executed by the second processor, performs the following operations:
- a system for providing web application services including:
- One or more web container units are run on each of the host machines; the web container unit is configured to process an access request for the corresponding web application.
- system further includes:
- the access module is configured to: after receiving the user's access request for the webpage web application, select a web container unit from the web container unit corresponding to the web application; according to the address of the host where the selected web container unit is located, And the port to which the selected web container unit is bound on the host, forwarding the access request.
- the host machine is a virtual machine.
- the plurality of web container units correspond to different web applications.
- system further includes:
- the network attachment storage device is configured to store data of each web application in a directory corresponding to the web application, wherein the directory corresponding to each web application is respectively used as a storage directory of the web container unit corresponding to the web application.
- system further includes:
- a monitoring module configured to acquire monitoring data of a web container unit running in the host machine by using a monitoring agent in each host, and obtain monitoring data for each web container unit by using the access module;
- the flexible scheduling module is configured to adjust the number of web container units corresponding to the web application according to the monitoring data of each web container unit.
- the monitoring data includes one or more of the following parameters of the web container unit:
- the usage of the CPU of the CPU the usage of the memory, the maximum number of concurrent requests for access per unit time, and the number of access requests that exceed the preset threshold.
- the elastic scheduling module adjusts the number of web container units corresponding to the web application according to the acquired monitoring data, including at least one of the following:
- the elastic scheduling module determines a host from the host where the remaining resources can create the at least one web container, and indicates the container agent on the determined host machine. Creating a web container unit corresponding to the web application on the host machine;
- the elastic scheduling module determines a web container unit from the web container unit corresponding to the web application when the monitoring data of the web container unit corresponding to the web application meets the contraction condition, and indicates the host where the determined web container unit is located.
- the container proxy on the host deletes the web container unit corresponding to the web application on the host.
- At least one embodiment of the present application provides a service for each web application with multiple web container units, which can implement resource control and isolation between web servers, and does not affect each other, thereby improving the reliability of the web application service.
- multiple web container units corresponding to one web application are distributed on different hosts, so that a single point of failure can be avoided.
- the usage of the web container unit is monitored, and the number of web container units is automatically increased or decreased according to the monitoring data, thereby improving resource utilization.
- the storage space and the performance expansion capability provided by the Network Attached Storage (NAS) technology can ensure high availability of user data and avoid the limitation of storage disk space. And no migration is required.
- NAS Network Attached Storage
- FIG. 1 is a flowchart of a method for providing a webpage application service according to Embodiment 1;
- FIG. 2 is a flowchart of a method for providing a webpage application service according to Embodiment 2;
- FIG. 3 is a schematic diagram of an apparatus for providing a webpage application service according to Embodiment 3;
- FIG. 4 is a schematic diagram of an apparatus for providing a webpage application service according to Embodiment 4.
- Figure 5 is a schematic diagram of the system in the example of the seventh embodiment.
- Fig. 6 is a schematic diagram showing the operation of the application manager in the example of the seventh embodiment.
- a computing device providing a web application service can include one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
- processors CPUs
- input/output interfaces network interfaces
- memory volatile and non-volatile memory
- the memory may include non-persistent memory, random access memory (RAM), and/or non-volatile memory in a computer readable medium, such as read only memory (ROM) or flash memory.
- RAM random access memory
- ROM read only memory
- Memory is an example of a computer readable medium.
- the memory may include module 1, module 2, ..., module N (N is an integer greater than 2).
- Computer readable media includes both permanent and non-permanent, removable and non-removable storage media, and information storage can be implemented by any method or technology.
- the information can be computer readable instructions, data structures, modules of programs, or other data.
- Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory. (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, compact disk read only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, Magnetic tape cartridges, disk storage or other magnetic storage devices or any other non-transportable media that can be used to store information that can be accessed by computing devices.
- Computer-readable media does not include non-transitory computer readable media, such as modulated data signals and carrier waves.
- Web application An application that can be accessed through the Web. Users only need to have a browser, no need to install other software.
- Web container unit A container service process that allocates resources (such as CPU, memory, etc.) for processing user access requests to web applications; may be, but is not limited to, LXC, Docker and other container technologies; a web container unit Can be considered an instance of a web container.
- a web application corresponds to one or more web container units, ie the one or more web container units process access requests for the web application.
- Embodiment 1 A method for providing a webpage application service, as shown in FIG. 1, includes steps S110-S120:
- each web application can be provided with multiple web container units to provide services, thereby achieving
- Web server process control and isolation between processes does not affect each other, improving the reliability of Web application services.
- the plurality of web container units when a web application corresponds to multiple web container units, when forwarding an access request for the web application, the plurality of web container units may be selected according to a predetermined load balancing policy.
- each web container unit may be of a standard specification, that is, the resources (model, size, etc.) assigned to each web container unit may be the same.
- steps S110-S120 may be performed by an access module of a web service connected to each host.
- the forwarding the access request to the selected web container unit may include:
- the access request is forwarded according to the address of the host where the selected web container unit is located, and the port to which the selected web container unit is bound on the host.
- one or more web container units can be run on one host, and the web container unit can be bound to a port on the host.
- each web container unit can be bound to a different port.
- the domain name of each web application may be pre-stored, the address of the host where the corresponding web container unit is located, and the routing rule of the bound port, for example, the web application X corresponds to two web containers X1 and X2, wherein The address of the host where X1 is located is Add1, the port bound is PORT1, the address of the host where X2 is located is Add2, and the port bound is PORT2. If the domain name of Web application X is XDN, two files can be saved for Web application X. Routing rules:
- Selecting a web container unit in step S110 can be regarded as selecting a routing rule that includes the domain name of the web application.
- the address may be, but is not limited to, an IP address.
- the forwarding may be performed by using other methods, such as saving the correspondence between the identifier of the web application and the access path of the web container unit, and forwarding the access request according to the access path of the selected web container unit.
- the host may be, but is not limited to, a virtual machine.
- the host machine can also be implemented using actual hardware, such as each host machine being a real server.
- the plurality of web container units can run on different hosts.
- the multiple web container units correspond to different web applications.
- multiple web container units corresponding to one web application may be randomly distributed in the host machine; or, an upper limit of a web container unit corresponding to a web application on a host, such as two.
- the web container unit corresponding to the same web application stores data in a directory corresponding to the web application in the NAS device.
- the web container units corresponding to the same web application are all read and/or written in the same storage directory, so no data synchronization is required; since the NAS device can provide sufficient storage space, the storage disk is avoided. Space has limitations and no migration is required.
- a storage directory may be set for each web application in the NAS device, and after creating a web container unit, the storage directory of the corresponding web application in the NAS device is mounted to the container storage directory; if a web container unit is deleted , deletes the storage directory of the web application mounted in the container storage directory.
- the NAS device may be, but is not limited to, a cloud storage module, or a cloud disk.
- system local disk or other external storage device may also be used for storage.
- the method may further include:
- the monitoring data may be acquired in real time, or the monitoring data may be acquired periodically.
- the monitoring data can be monitored in real time, and the number of the web container units can be adjusted as soon as the monitoring data meets the predetermined conditions; the monitoring data can be periodically determined according to the monitoring data, and the number of the web container units can be adjusted accordingly.
- acquiring the monitoring data may refer to a process of collecting monitoring data, or a process of receiving or reading the collected monitoring data.
- the upper and lower limits of the number of Web container units corresponding to the web application may be preset, for example, at least one and at most five, and the upper limit or lower limit may not be exceeded during the adjustment.
- the number of web container units corresponding to the web application may be set by the user; or the user may set whether to automatically adjust the number of web container units according to the monitoring data.
- the monitoring data may include one or more of the following parameters of the web container unit:
- the usage rate of the CPU the usage rate of the memory, the maximum number of concurrent access requests per unit time (that is, the number of access requests sent to the Web container unit per unit time), and the access request whose processing time exceeds a preset threshold (hereinafter referred to as The number of slow requests).
- the usage rate of the CPU refers to the proportion of the CPU resources used by the Web container unit in the CPU resources allocated to the Web container unit; the memory usage rate refers to the memory resources used by the Web container unit, and is allocated. The proportion of memory resources given to the web container unit.
- the usage rate of the CPU and the usage rate of the memory can be collected by the monitoring agent in each host, and the monitoring agent is used to collect the monitoring data of each web container unit running in the host machine.
- the usage rate of the CPU and the usage rate of the memory may be real-time acquisition, or may be collected periodically, or monitored in real time, and then the average or highest usage rate in the cycle is used as the monitoring data.
- the maximum number of concurrent access requests per unit time can be counted when the access request is forwarded.
- the number of slow requests can also be counted by the part that forwards the access request.
- the load of the web container unit is large, that is, the web corresponding to the web container unit is The application has insufficient processing power and needs to supplement the web container unit.
- the usage rate of the CPU and the memory is low, or the maximum number of concurrent access requests per unit time is small, or the number of slow requests is small, the load of the web container unit is small, indicating that the web container unit corresponds to the web.
- the application's processing power is excessive, and some resources are wasted, which can reduce the Web container unit.
- the adjusting the number of Web container units corresponding to the web application according to the acquired monitoring data may include at least one of the following:
- the number of web container units corresponding to the web application is reduced.
- the expansion condition may be, but is not limited to, one or more of the monitoring data reaching the expansion threshold; the reduction condition may be, but is not limited to, one or more of the monitoring data reaching the reduction threshold.
- different expansion thresholds and reduction thresholds can be adopted.
- the monitoring data of each web container should be similar, and can be set to satisfy the expansion of any web container corresponding to a web application.
- the condition is reduced, the number of web container units corresponding to the web application is increased/decreased.
- it may be configured to increase/decrease the number of web container units corresponding to the web application when all web containers corresponding to one web application or monitoring data of a predetermined number of web containers satisfy the expansion/contraction condition.
- the increasing the number of web container units corresponding to the web application may include:
- Determining a host from a host in which the remaining resources are capable of creating at least one web container instructing the determined host to create a web container unit corresponding to the web application.
- the web container unit is also added.
- the reducing the number of web container units corresponding to the web application may include:
- Determining a web container unit from the web container unit corresponding to the web application, indicating that the host device where the determined web container unit is located deletes the web container unit corresponding to the web application.
- the web container unit is deleted, and the web container unit is deleted.
- the web container unit can be created or deleted through the container proxy on the host machine.
- Embodiment 2 A method for providing a webpage application service, as shown in FIG. 2, includes steps S210-S220:
- S210 Obtain monitoring data of a web container unit corresponding to each web application, where one web application corresponds to one or more web container units, and the web container unit is configured to process an access request for the corresponding web application;
- the usage of the web container unit is monitored, and the number of web container units is automatically increased or decreased according to the monitoring data, thereby improving resource utilization.
- the storage directory of the web container unit corresponding to each web application may be a directory corresponding to the web application in the network attached storage device.
- one web application may correspond to one or more web container units; when one web application corresponds to multiple web container units, the plurality of web container units may run on different hosts.
- One host can run one or more web container units, each web container unit is bound to a port on the host machine, and the port bound to the different web container unit is different on the same host.
- the monitoring data may include one or more of the following parameters of the web container unit:
- the usage of the CPU of the CPU the usage of the memory, the maximum number of concurrent requests for access per unit time, and the number of access requests that exceed the preset threshold.
- the adjusting the number of web container units corresponding to the web application according to the acquired monitoring data may include at least one of the following:
- the number of web container units corresponding to the web application is reduced.
- the increasing the number of web container units corresponding to the web application may include:
- Determining a host from a host in which the remaining resources are capable of creating at least one web container instructing the determined host to create a web container unit corresponding to the web application.
- the reducing the number of web container units corresponding to the web application may include:
- Determining a web container unit from the web container unit corresponding to the web application, indicating that the host device where the determined web container unit is located deletes the web container unit corresponding to the web application.
- the host machine can be, but is not limited to, a virtual machine.
- Embodiment 1 For other implementation details in this embodiment, reference may be made to Embodiment 1.
- Embodiment 3 A device for providing a webpage application service, as shown in FIG. 3, includes:
- the selecting module 31 is configured to: after receiving the user's access request for the web application, select a web container unit from the web container unit corresponding to the web application; wherein the web container unit is configured to process the received access request ;
- the forwarding module 32 is configured to forward the access request to the selected web container unit.
- the selection module 31 is a part of the above device responsible for selecting a web container unit, and may be software, hardware, or a combination of the two.
- the forwarding module 32 is the part of the above device that is responsible for forwarding the access request, and may be software, hardware, or a combination of the two.
- the forwarding module forwarding the access request to the selected web container unit may include:
- the forwarding module forwards the access request according to the address of the host where the selected web container unit is located, and the port to which the selected web container unit is bound on the host.
- the host machine can be, but is not limited to, a virtual machine.
- the plurality of web container units can run on different hosts.
- the storage directory of the web container unit corresponding to each web application may be a directory corresponding to the web application in the network attached storage device.
- the device may further include:
- An obtaining module configured to acquire monitoring data of a web container unit corresponding to each webpage web application
- the adjustment module is configured to adjust the number of web container units corresponding to the web application according to the acquired monitoring data.
- the monitoring data may include one or more of the following parameters of the web container unit:
- the usage of the CPU of the CPU the usage of the memory, the maximum number of concurrent requests for access per unit time, and the number of access requests that exceed the preset threshold.
- the adjusting module may adjust the number of the web container units corresponding to the web application according to the acquired monitoring data, and may include at least one of the following:
- the adjustment module increases the number of the web container unit corresponding to the web application
- the adjustment module reduces the number of web container units corresponding to the web application.
- Embodiment 4 A device for providing a webpage application service, as shown in FIG. 4, includes:
- the obtaining module 41 is configured to acquire monitoring data of a web container unit corresponding to each webpage web application, where one web application corresponds to one or more web container units, and the web container unit is configured to process access to the corresponding web application. request;
- the adjusting module 42 is configured to adjust the number of web container units corresponding to the web application according to the acquired monitoring data.
- the obtaining module 41 is a part of the above device responsible for acquiring monitoring data, and may be software, hardware, or a combination of the two.
- the adjustment module 42 is a part of the above device responsible for adjusting the number of web container units, and may be software, hardware, or a combination of the two.
- the monitoring data may include one or more of the following parameters of the web container unit:
- the usage of the CPU of the CPU the usage of the memory, the maximum number of concurrent requests for access per unit time, and the number of access requests that exceed the preset threshold.
- the adjusting module according to the acquired monitoring data, adjusting the number of web container units corresponding to the web application may include at least one of the following:
- the adjustment module increases the number of the web container unit corresponding to the web application
- the adjustment module reduces the number of web container units corresponding to the web application.
- the adjusting module increases the number of web container units corresponding to the web application, and the method includes:
- the adjustment module determines a host from a host in which the remaining resources are capable of creating the at least one web container, and instructs the determined host to create a web container unit corresponding to the web application.
- the adjusting module reduces the number of web container units corresponding to the web application, and the method includes:
- the adjustment module determines a web container unit from the web container unit corresponding to the web application, and indicates that the host device where the determined web container unit is located deletes the web container unit corresponding to the web application.
- Embodiment 5 An electronic device for providing a webpage application service, comprising: a first memory and a first processor;
- the first memory is configured to save a program for providing a webpage application service, and the program for providing a webpage service, when being read and executed by the first processor, performs the following operations:
- the operations performed correspond to steps S110-S120 in the first embodiment; other details of the operations performed by the program may be See example one.
- Embodiment 6 The electronic device for providing a webpage application service, comprising: a second memory and a second processor;
- the second memory is configured to save a program for providing a webpage application service, and the program for providing a webpage service, when being read and executed by the second processor, performs the following operations:
- the operations performed correspond to steps S210 to S220 in the second embodiment; other details of the operations performed by the program may be See example two.
- Embodiment 7 A system for providing a web application service, comprising:
- One or more web container units are run on each of the host machines; the web container unit is configured to process an access request for the corresponding web application.
- system may further include:
- the access module is configured to: after receiving the user's access request for the webpage web application, select a web container unit from the web container unit corresponding to the web application; according to the address of the host where the selected web container unit is located, And the port to which the selected web container unit is bound on the host, forwarding the access request.
- the host machine may be a virtual machine.
- the plurality of web container units may correspond to different web applications.
- system may further include:
- the network attachment storage device is configured to store data of each web application in a directory corresponding to the web application, wherein the directory corresponding to each web application is respectively used as a storage directory of the web container unit corresponding to the web application.
- system may further include:
- a monitoring module configured to collect monitoring data of a web container unit running in the host machine by using a monitoring agent in each host, and obtain monitoring data for each web container unit by using the access module;
- the flexible scheduling module is configured to adjust the number of web container units corresponding to the web application according to the monitoring data of each web container unit.
- the monitoring data may include one or more of the following parameters of the web container unit:
- the usage of the CPU of the CPU the usage of the memory, the maximum number of concurrent requests for access per unit time, and the number of access requests that exceed the preset threshold.
- the elastic scheduling module adjusts the number of web container units corresponding to the web application according to the collected monitoring data, and may include at least one of the following:
- the elastic scheduling module determines a host from the host where the remaining resources can create the at least one web container, and indicates the container agent on the determined host machine. Creating a web container unit corresponding to the web application on the host machine;
- the elastic scheduling module determines a web container unit from the web container unit corresponding to the web application when the monitoring data of the web container unit corresponding to the web application meets the contraction condition, and indicates the host where the determined web container unit is located.
- the container proxy on the host deletes the web container unit corresponding to the web application on the host.
- the system of this embodiment may be used to implement the method of Embodiment 1 or 2.
- each web application has a globally unique identifier APP_ID and a globally unique domain name: APP_DOMAIN_NAME; the user can access the corresponding web application through the domain name.
- each web container unit can be the same, ie the web container unit is of standard specifications.
- Each web container unit has a globally unique identifier: CONTAINER_ID.
- Each web container unit is bound to at least one port on the VM that is the host of the web container unit: CONTAINER_PORT; which port of the web container unit is specifically bound to the VM can be set by itself. That is, the Web container unit runs separate Web service processes (such as apache, nginx, tomcat, etc.) and binds to independent ports (ie, CONTAINER_PORT, which is unique on the VM).
- the scaling threshold is used to determine whether the resources in the Web container unit need to be adjusted, including the expansion threshold and the reduction threshold. Users can define different scaling thresholds for different web applications.
- the VM is used as a host for running the web container unit, and has a certain computing resource CPU and storage resources (memory, disk).
- One or more web container units can be run on each VM, the specific number being related to the resources of the VM itself and the resources allocated for the web container unit.
- Each VM has a globally unique identifier VM_ID and an intranet IP address: VM_INNER_IP.
- system running the method of this embodiment is as shown in FIG. 5, and may include:
- Access module flexible scheduling module, monitoring module, and resource module of the web service
- each virtual machine includes the following components:
- Container Agent used to receive the expansion command and the shrink command from the flexible scheduling module, and start or stop the web container unit accordingly;
- the usage rate of each resource (including at least CPU and memory in this example) provided by the Web container unit is counted and sent to the monitoring module as monitoring data.
- One or more web container units are run in each virtual machine. For example, two web container units are running in the virtual machine 1 in FIG. 5, corresponding to the web application 1 and the web application 2 respectively; and two web container units are running in the virtual machine 2. Corresponding to Web Application 1 and Web Application 3, respectively.
- each web container unit uses apache to provide a web service process.
- the access module of the web service is configured to select a route according to a pre-configured load balancing policy in multiple web container units corresponding to the web application according to the domain name of the accessed web application after receiving the access request for the web application.
- the rule forwards the access request; periodically counts the maximum number of concurrent and slow requests of each web container unit in a unit time, and reports the monitoring data to the monitoring module.
- the monitoring module is configured to receive monitoring data from the access module and the monitoring agent of the web service, and store the monitoring data according to the web application, that is, the monitoring data of the web container unit corresponding to the same web application is summarized and saved as the web. Application monitoring data.
- the flexible scheduling module is configured to traverse the monitoring data of each web application from the monitoring module, and send a capacity expansion or contraction instruction to the container agent of the corresponding VM according to the predetermined elastic scaling policy; and configure a routing rule for the WEB service access module.
- the resource module is used to store resource information of each VM (such as the number of remaining resources, running several web container units, etc.), and information about the web container unit corresponding to each web application (such as the corresponding web application, the VM, and the bound port). Etc.) In this example, the VM resource information table and the Web container unit information table are respectively saved.
- system may further include a cloud storage module (or cloud disk) adopting NAS technology for providing greater space storage capacity and performance expansion capability.
- a cloud storage module or cloud disk
- NAS technology for providing greater space storage capacity and performance expansion capability.
- the elastic scaling policy may be determined according to the resource usage rate, the number of concurrent requests, and the number of slow requests (including not limited to the above three types of resources) of the Web container unit to determine whether the capacity expansion threshold or the shrinkage threshold is met. How to implement a scaling policy:
- the capacity expansion threshold can be any of the following:
- the number of slow requests is >100.
- the shrinkage threshold can be any of the following:
- the number of slow requests is ⁇ 10.
- the flexible scheduling module can periodically check the web container unit corresponding to each web application, and determine whether the web container unit uses the resource expansion threshold or the capacity reduction, and correspondingly expands or shrinks the process.
- Expansion process If the resource usage of a web container unit reaches the capacity expansion threshold, apply for the container resource from the resource module, obtain a new web container unit, allocate the VM's IP address and port (Port) for the web container unit, and then call the location.
- the Container Agent on the assigned VM starts a new Web container unit, and mounts the storage directory of the corresponding Web application in the cloud storage module to the container storage directory, and then adds a new routing rule in the Web service access module.
- the new routing rule is Route the domain name of the corresponding web application to the IP address and port of the VM where the new web container unit is located.
- the sending process of the expansion instruction includes:
- VM_INNER_IP may be found according to the VM_ID of the determined VM, and the expansion instruction is sent to the VM_INNER_IP.
- the correspondence between the CONTAINER_ID and the VM_ID of the Web container unit is stored in the resource module.
- the process of shrinking the volume If a web container unit reaches the shrinkage threshold, the routing rule for routing the domain name of the corresponding web application to the IP address and port of the VM where the web container unit is located is deleted from the web service access module (for the web) The application's new access request will no longer be routed to this web container unit. Then polling to determine that there is no running php process in this web container unit, stop the web container unit, release the related resources, and uninstall the web container unit. The container stores the directory where the web application is mounted. Finally, the IP address and port of the VM assigned to this web container unit are returned to the resource module.
- the sending process of the contraction instruction includes:
- the web container unit that reaches the shrinkage threshold is determined, and a shrinkage instruction is sent to the Container Agent of the VM where the web container unit is located.
- the corresponding VM_ID may be found according to the determined CONTAINER_ID of the web container unit, the corresponding VM_INNER_IP is found according to the VM_ID, and the shrinking instruction is sent to the VM_INNER_IP.
- the correspondence between the CONTAINER_ID and the VM_ID of the indented Web container unit is deleted in the resource module.
- the application administrator first completes the website program by using the File Transfer Protocol (FTP) method or the flexible virtual host system in this example is opened to the application administrator's service or client. Upload the process and launch the website through the console.
- Application visitors can enter the domain name of the web application (or click on the app on the mobile terminal) through the browser to access various services provided by the corresponding web application.
- FTP File Transfer Protocol
- the application administrator is generally the owner of the website, and has a website program, such as: source code (*.php file) or compiled file (*.class, *.jar, etc.) that can be run directly.
- App visitors are generally web browsers and are people who can access the web through devices such as terminals.
- the application administrator can monitor and set the system shown in Figure 5 through the web console, the application on the mobile terminal, and the desktop application.
- the elastic policy is used to set the elastic policy, such as setting:
- the application administrator can also configure the scheduling policy, which can be, but is not limited to, the following three types:
- Normal mode You can specify a fixed number of web container units corresponding to the web application.
- Real-time scheduling mode According to the monitoring data of each web container, it automatically expands and shrinks according to the predefined configuration policy without human intervention.
- Scheduled scheduling mode The subscription configuration threshold is expanded and reduced during the scheduled time period to improve the reliability of the Web service. Revert to the default number of web container units outside of the appointment period.
- the application administrator can also view the monitoring data of each web container unit according to the web container monitoring interface. For example but not limited to:
- the total number of web containers allocated, monitoring data for each web container (such as resource usage, number of concurrent, slow requests, etc.).
- the web container resources in the background can be dynamically expanded or reduced in time according to the actual website access volume, so that the website access is smooth, no human operation is required, and the website service can be guaranteed when the number of visits increases sharply.
- High availability and economy you can shrink the number of Web container units when you have insufficient traffic to save money.
- the application administrator can also receive the alarm message when the website runs abnormally in a timely manner through a predefined alarm policy, so that the emergency event can be handled in time.
- the configurable attributes in the alarm policy can include: whether to enable alarm when expanding, whether to enable alarm when shrinking, alarm mode (mail, SMS, web console, etc.), web container resource usage alarm threshold (CPU range, memory range, concurrent number) Range, slow request range).
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Transfer Between Computers (AREA)
- Debugging And Monitoring (AREA)
Abstract
本申请提供一种提供网页应用服务的方法、装置、电子设备及系统。所述提供网页应用服务的方法包括:当收到用户对于网页Web应用的访问请求后,从所述Web应用对应的Web容器单元中选择一个Web容器单元;其中,所述Web容器单元用于处理接收到的访问请求;将所述访问请求转发给所选择的Web容器单元。本申请可以提高Web应用服务的可靠性。
Description
本申请要求2016年12月27日递交的申请号为201611228664.9、发明名称为“一种提供网页应用服务的方法、装置、电子设备及系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本发明涉及网络领域,尤其涉及一种提供网页应用服务的方法、装置、电子设备及系统。
传统的采用虚拟主机提供网页(Web)应用的方案是:一台虚拟主机服务器,启动Web(网页)服务器(apache、tomcat或者IIS等)软件,同时放置几十个甚至上百个虚拟站点,虚拟站点之间共享系统资源和命名空间。
该方案主要存在以下几类常见问题:
(1)很容易出现耗资源的站点抢占系统资源而导致系统资源耗尽、应用服务可用性降低或权限控制不当出现安全隐患等各种问题。
(2)共享的Web容器能够支持的并发大小和总体性能有限,无法根据实际需求进行动态扩容或缩容。
(3)当单服务器存储资源受限制或计算资源(CPU,内存)等利用率达到上限时,往往需要采用数据同步技术实现用户站点数据的迁移动作,影响用户业务的连续性。
(4)服务器资源利用率问题始终存在,有的服务器活跃站点多,有的服务器非活跃站点多,总体资源利用率较低。
采用容器技术可以提高应用程序的可用性和安全隔离;容器技术是将原先部署在虚拟机(Virtual Machines,VM)上的应用环境,部署到Linux容器(Linux Container,LXC)、Docker等容器内部,这样可以增强单服务器系统的可靠性,但还是存在容器所在的服务器宕机会导致单点故障、资源利用率低、数据迁移时间长、存储磁盘空间有限制等诸多问题。
发明内容
本申请提供一种提供网页应用服务的访问方法、装置、电子设备及系统,可以提高 Web应用服务的可靠性。
采用如下技术方案。
一种提供网页应用服务的方法,包括:
当收到用户对于网页Web应用的访问请求后,从所述Web应用对应的Web容器单元中选择一个Web容器单元;其中,所述Web容器单元用于处理接收到的访问请求;
将所述访问请求转发给所选择的Web容器单元。
可选地,所述将访问请求转发给所选择的Web容器单元包括:
根据所选择的Web容器单元所在的宿主机的地址,以及所选择的Web容器单元在该宿主机上绑定的端口,转发所述访问请求。
可选地,所述宿主机为虚拟机。
可选地,当一个Web应用对应于多个Web容器单元时,所述多个Web容器单元运行在不同的宿主机上。
可选地,对应于同一个Web应用的Web容器单元,在网络附属存储装置中该Web应用对应的目录中进行数据存储。
可选地,所述的方法还包括:
获取各Web应用对应的Web容器单元的监控数据;
根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。
可选地,所述监控数据包括Web容器单元的以下一项或多项参数:
中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。
可选地,所述根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量包括以下至少一项:
当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,增加该Web应用对应的Web容器单元的数量;
当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,减少该Web应用对应的Web容器单元的数量。
一种提供网页应用服务的方法,包括:
获取各网页Web应用对应的Web容器单元的监控数据;其中,一个Web应用对应一个或多个Web容器单元,所述Web容器单元用于处理对于所对应的Web应用的访问 请求;
根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。
可选地,所述监控数据包括Web容器单元的以下一项或多项参数:
中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。
可选地,所述根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量包括以下至少一项:
当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,增加该Web应用对应的Web容器单元的数量;
当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,减少该Web应用对应的Web容器单元的数量。
可选地,所述增加该Web应用对应的Web容器单元的数量包括:
从剩余资源能够创建至少一个Web容器的宿主机中确定一个宿主机,指示所确定的宿主机创建该Web应用对应的Web容器单元。
可选地,所述减少该Web应用对应的Web容器单元的数量包括:
从该Web应用对应的Web容器单元中确定一个Web容器单元,指示所确定的Web容器单元所在的宿主机删除该Web应用对应的Web容器单元。
一种提供网页应用服务的装置,包括:
选择模块,用于当收到用户对于网页Web应用的访问请求后,从所述Web应用对应的Web容器单元中选择一个Web容器单元;其中,所述Web容器单元用于处理接收到的访问请求;
转发模块,用于将所述访问请求转发给所选择的Web容器单元。
可选地,所述转发模块将访问请求转发给所选择的Web容器单元包括:
所述转发模块根据所选择的Web容器单元所在的宿主机的地址,以及所选择的Web容器单元在该宿主机上绑定的端口,转发所述访问请求。
可选地,当一个Web应用对应于多个Web容器单元时,所述多个Web容器单元运行在不同的宿主机上。
可选地,各Web应用对应的Web容器单元的存储目录分别是网络附属存储装置中,该Web应用对应的目录。
可选地,所述的装置还包括:
获取模块,用于获取各网页Web应用对应的Web容器单元的监控数据;
调整模块,用于根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。
可选地,所述监控数据包括Web容器单元的以下一项或多项参数:
中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。
可选地,所述调整模块根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量包括以下至少一项:
当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,所述调整模块增加该Web应用对应的Web容器单元的数量;
当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,所述调整模块减少该Web应用对应的Web容器单元的数量。
一种提供网页应用服务的装置,包括:
获取模块,用于获取各网页Web应用对应的Web容器单元的监控数据;其中,一个Web应用对应一个或多个Web容器单元,所述Web容器单元用于处理对于所对应的Web应用的访问请求;
调整模块,用于根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。
可选地,所述监控数据包括Web容器单元的以下一项或多项参数:
中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。
可选地,所述调整模块根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量包括以下至少一项:
当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,所述调整模块增加该Web应用对应的Web容器单元的数量;
当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,所述调整模块减少该Web应用对应的Web容器单元的数量。
可选地,所述调整模块增加该Web应用对应的Web容器单元的数量包括:
所述调整模块从剩余资源能够创建至少一个Web容器的宿主机中确定一个宿主机,指示所确定的宿主机创建该Web应用对应的Web容器单元。
可选地,所述调整模块减少该Web应用对应的Web容器单元的数量包括:
所述调整模块从该Web应用对应的Web容器单元中确定一个Web容器单元,指示所确定的Web容器单元所在的宿主机删除该Web应用对应的Web容器单元。
一种提供网页应用服务的电子设备,包括:第一存储器和第一处理器;
所述第一存储器用于保存用于提供网页应用服务的程序,所述用于提供网页服务的程序在被所述第一处理器读取执行时,执行以下操作:
当收到用户对于网页Web应用的访问请求后,从所述Web应用对应的Web容器单元中选择一个Web容器单元;其中,所述Web容器单元用于处理接收到的访问请求;
将所述访问请求转发给所选择的Web容器单元。
一种提供网页应用服务的电子设备,包括:第二存储器和第二处理器;
所述第二存储器用于保存用于提供网页应用服务的程序,所述用于提供网页服务的程序在被所述第二处理器读取执行时,执行以下操作:
获取各网页Web应用对应的Web容器单元的监控数据;其中,一个Web应用对应一个或多个Web容器单元,所述Web容器单元用于处理对于所对应的Web应用的访问请求;
根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。
一种提供网页应用服务的系统,包括:
多个宿主机;
每个所述宿主机上运行一个或多个Web容器单元;所述Web容器单元用于处理对于所对应的Web应用的访问请求。
可选地,所述的系统还包括:
接入模块,用于当收到用户对于网页Web应用的访问请求后,从所述Web应用对应的Web容器单元中选择一个Web容器单元;根据所选择的Web容器单元所在的宿主机的地址,以及所选择的Web容器单元在该宿主机上绑定的端口,转发所述访问请求。
可选地,所述宿主机为虚拟机。
可选地,当一个宿主机上运行多个Web容器单元时,所述多个Web容器单元对应于不同的Web应用。
可选地,所述的系统还包括:
网络附属存储装置,用于将各Web应用的数据分别保存在该Web应用对应的目录中;其中,各Web应用对应的目录分别作为该Web应用对应的Web容器单元的存储目录。
可选地,所述的系统还包括:
监控模块,用于分别通过各宿主机中的监控代理获取该宿主机中运行的Web容器单元的监控数据,通过所述接入模块获得对于各Web容器单元的监控数据;
弹性调度模块,用于根据各Web容器单元的监控数据,调整Web应用所对应的Web容器单元的数量。
可选地,所述监控数据包括Web容器单元的以下一项或多项参数:
中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。
可选地,所述弹性调度模块根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量包括以下至少一项:
所述弹性调度模块当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,从剩余资源能够创建至少一个Web容器的宿主机中确定一个宿主机,指示所确定的宿主机上的容器代理在该宿主机上创建该Web应用对应的Web容器单元;
所述弹性调度模块当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,从该Web应用对应的Web容器单元中确定一个Web容器单元,指示所确定的Web容器单元所在的宿主机上的容器代理删除该宿主机上该Web应用对应的Web容器单元。
本申请包括以下优点:
本申请至少一个实施例为每个Web应用配备多个Web容器单元提供服务,可以实现Web服务器进程间资源控制和隔离,相互不影响,从而提高Web应用服务的可靠性。
本申请实施例的一种实现方式中,一个Web应用对应的多个Web容器单元分布在不同宿主机上,可以避免单点故障。
本申请实施例的一种实现方式中,对Web容器单元的使用情况进行监控,根据监控数据自动增加或减少Web容器单元的数量,从而提高资源利用率。
本申请实施例的一种实现方式中,利用网络附属存储(Network Attached Storage, NAS)技术提供的存储空间和性能扩展能力,可以保证用户数据的高可用性,避免了存储磁盘空间有限制的问题,且无需迁移。
当然,实施本申请的任一产品并不一定需要同时达到以上所述的所有优点。
图1是实施例一的提供网页应用服务的方法的流程图;
图2是实施例二的提供网页应用服务的方法的流程图;
图3是实施例三的提供网页应用服务的装置的示意图;
图4是实施例四的提供网页应用服务的装置的示意图;
图5是实施例七的例子中的系统示意图;
图6是实施例七的例子中应用管理员的操作示意图。
下面将结合附图及实施例对本申请的技术方案进行更详细的说明。
需要说明的是,如果不冲突,本申请实施例以及实施例中的各个特征可以相互结合,均在本申请的保护范围之内。另外,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。
在一种配置中,提供网页应用服务的计算设备可包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存(memory)。
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。内存可能包括模块1,模块2,……,模块N(N为大于2的整数)。
计算机可读介质包括永久性和非永久性、可移动和非可移动存储介质,可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM),快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括非暂存电脑可读媒体 (transitory media),如调制的数据信号和载波。
首先,对本文中的以下概念进行说明:
(1)Web应用(App):是一种可以通过Web访问的应用程序。用户只需要有浏览器即可,不需要再安装其他软件。
(2)Web容器单元:已分配资源(如CPU、内存等)的容器服务进程,用于处理用户对于Web应用的访问请求;可以但不限于采用LXC,Docker等容器技术创建;一个Web容器单元可视为Web容器的一个实例。
一个Web应用对应于一个或多个Web容器单元,即:该一个或多个Web容器单元为该Web应用处理访问请求。
实施例一、一种提供网页应用服务的方法,如图1所示,包括步骤S110~S120:
S110、当收到对于网页Web应用的访问请求后,从所述Web应用对应的Web容器单元中选择一个Web容器单元;其中,所述Web容器单元用于处理接收到的访问请求;
S120、将所述访问请求转发给所选择的Web容器单元。
本实施例中,每个Web应用可以配备多个Web容器单元提供服务,从而可以实现
Web服务器进程间资源控制和隔离,相互不影响,提高Web应用服务的可靠性。
本实施例中,当一个Web应用对应多个Web容器单元时,在转发对于该Web应用的访问请求时,可以依据预定的负载均衡策略从多个Web容器单元中进行选择。
本实施例中,各Web容器单元可以是标准规格的,即:分配给每个Web容器单元的资源(型号、大小等)可以是相同的。
本实施例中,可以通过一个与各宿主机相连的Web服务的接入模块来执行步骤S110~S120。
一种实现方式中,所述将访问请求转发给所选择的Web容器单元可以包括:
根据所选择的Web容器单元所在的宿主机的地址,以及所选择的Web容器单元在该宿主机上绑定的端口,转发所述访问请求。
本实现方式中,一个宿主机上可以运行一个或多个Web容器单元,Web容器单元可以绑定所在宿主机上的一个端口。当宿主机上运行多个Web容器单元时,各Web容器单元可以绑定不同端口。
本实现方式中,可以预先保存各Web应用的域名,到所对应的各Web容器单元所在宿主机的地址和绑定的端口的路由规则,比如Web应用X对应两个Web容器X1和X2,其中X1所在宿主机的地址为Add1,绑定的端口为PORT1,X2所在宿主机的地址 为Add2,绑定的端口为PORT2;假设Web应用X的域名为XDN,则对于Web应用X可以保存两条路由规则:
XDN→(Add1,PORT1)
XDN→(Add2,PORT2)
步骤S110中选择一个Web容器单元,可以看成是选择采用包含Web应用的域名的一个路由规则。
本实现方式中,所述地址可以但不限于为IP地址。
其它实现方式中,也可以采用其它方式转发,比如保存Web应用的标识和Web容器单元的访问路径之间的对应关系,根据所选择的Web容器单元的访问路径进行访问请求的转发。
一种实现方式中,所述宿主机可以但不限于为虚拟机。其它实现方式中,宿主机也可以采用实际硬件来实现,比如每个宿主机是一个真实服务器。
一种实现方式中,当一个Web应用对应于多个Web容器单元时,所述多个Web容器单元可以运行在不同的宿主机上。
即:对于任一个宿主机,如果运行了多个Web容器单元,则这多个Web容器单元对应于不同的Web应用。或者说,一个宿主机上对应于一个Web应用的Web容器单元最多只有一个。
这样相当于一个Web应用对应的Web容器单元分布在不同的宿主机上,可以防止宿主机故障时造成Web应用性能大幅度下降。
其它实现方式中,一个Web应用对应的多个Web容器单元也可以随意分布在宿主机中;或者,规定一个宿主机上对应于某个Web应用的Web容器单元的上限,比如2个。
一种实现方式中,对应于同一个Web应用的Web容器单元,在NAS装置中该Web应用对应的目录中进行数据存储。
本实现方式中,相当于同一个Web应用对应的Web容器单元都是在同一个存储目录中进行读和/或写,因此无需数据同步;由于NAS装置能够提供足够的存储空间,避免了存储磁盘空间有限制的问题,且无需迁移。
本实现方式中,可以在NAS装置中为每个Web应用设置一个存储目录,创建一个Web容器单元后,挂载NAS装置中对应的Web应用的存储目录到容器存储目录;如果删除一个Web容器单元,则删除容器存储目录中挂载的Web应用的存储目录。
本实现方式中,NAS装置可以但不限于为云存储模块,或称为云磁盘。
其它实现方式中,也可以采用系统本地的磁盘或其它的外部存储设备进行存储。
一种实现方式中,所述的方法还可以包括:
获取各网页Web应用对应的Web容器单元的监控数据;
根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。
本实现方式中,可以实时获取监控数据,也可以周期性获取监控数据。可以实时监视监控数据,一旦监控数据满足预定条件就立即调整Web容器单元的数量;也可以周期性根据监控数据判断是否需要调整,需要则相应调整Web容器单元的数量。
本实现方式中,获取监控数据可以是指采集监控数据的过程,也可以是指接收或读取已经采集好的监控数据的过程。
本实现方式中,可以预先设置Web应用所对应的Web容器单元的数量的上下限,比如最少1个,最多5个,在调整时不得超过上限或低于下限。
其它实现方式中,可以由用户自行设置Web应用所对应的Web容器单元的数量;或者可以由用户设置是否自动根据监控数据调整Web容器单元的数量。
本实现方式中,所述监控数据可以包括Web容器单元的以下一项或多项参数:
CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数(即单位时间内发送给Web容器单元的访问请求的数量)、处理时间超过预设阈值的访问请求(后文称为慢请求)的数量。
其中,CPU的使用率是指Web容器单元所使用的CPU资源,在分配给该Web容器单元的CPU资源中所占的比例;内存的使用率是指Web容器单元所使用的内存资源,在分配给该Web容器单元的内存资源中所占的比例。
其中,CPU的使用率和内存的使用率可以通过各宿主机中的监控代理采集,监控代理用于采集所在宿主机中运行的各Web容器单元的监控数据。
其中,CPU的使用率和内存的使用率可以是实时采集,也可以周期性采集,或者实时监控,然后将周期中平均或最高的使用率作为监控数据。
其中,单位时间内访问请求的最大并发数可以在进行访问请求转发时统计,慢请求的数量也可以由进行访问请求转发的部分统计。
当CPU、内存的使用率较高,或单位时间内访问请求的最大并发数较大,或慢请求数较多,则说明该Web容器单元负载较大,也就说明该Web容器单元对应的Web应用的处理能力不足,需要补充Web容器单元。当CPU、内存的使用率较低,或单位时间内 访问请求的最大并发数较小,或慢请求数较少,则说明该Web容器单元负载较小,也就说明该Web容器单元对应的Web应用的处理能力过剩,部分资源存在浪费,可以减少Web容器单元。
本实现方式中,所述根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量可以包括以下至少一项:
当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,增加该Web应用对应的Web容器单元的数量;
当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,减少该Web应用对应的Web容器单元的数量。
其中,扩容条件可以但不限于是监控数据中的一项或多项达到扩容阈值;缩容条件可以但不限于监控数据中的一项或多项达到缩容阈值。对于不同Web应用所对应的Web容器单元,可以采用不同的扩容阈值和缩容阈值。
其中,当一个Web应用对应多个Web容器时,如果采用负载均衡策略转发访问请求,则各Web容器的监控数据应该相差不大,可以设置成当一个Web应用对应的任一个Web容器满足扩容/缩容条件时,就增加/减少该Web应用对应的Web容器单元的数量。当然,也可以设置成,当一个Web应用对应的全部Web容器,或预定数量的Web容器的监控数据都满足扩容/缩容条件时,才增加/减少该Web应用对应的Web容器单元的数量。
其中,所述增加该Web应用对应的Web容器单元的数量可以包括:
从剩余资源能够创建至少一个Web容器的宿主机中确定一个宿主机,指示所确定的宿主机创建该Web应用对应的Web容器单元。
其中,在预先保存各Web应用的域名,到所对应的各Web容器单元所在宿主机的地址和绑定的端口的路由规则的情况下,创建Web容器单元后,还要增加该Web容器单元对应的Web应用的域名,到所确定的宿主机的地址、以及所创建的Web容器单元在该宿主机上绑定的端口的路由规则。
其中,所述减少该Web应用对应的Web容器单元的数量可以包括:
从该Web应用对应的Web容器单元中确定一个Web容器单元,指示所确定的Web容器单元所在的宿主机删除该Web应用对应的Web容器单元。
其中,在预先保存各Web应用的域名,到所对应的各Web容器单元所在宿主机的地址和绑定的端口的路由规则的情况下,删除Web容器单元后,还要删除该Web容器 单元对应的Web应用的域名,到所确定的宿主机的地址、以及所创建的Web容器单元在该宿主机上绑定的端口的路由规则。
其中,可以通过宿主机上的容器代理来创建或删除Web容器单元。
实施例二、一种提供网页应用服务的方法,如图2所示,包括步骤S210~S220:
S210、获取各Web应用对应的Web容器单元的监控数据;其中,一个Web应用对应一个或多个Web容器单元,所述Web容器单元用于处理对于所对应的Web应用的访问请求;
S220、根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。
本实施例中,对Web容器单元的使用情况进行监控,根据监控数据自动增加或减少Web容器单元的数量,从而提高资源利用率。
本实施例中,各Web应用对应的Web容器单元的存储目录可以分别是网络附属存储装置中,该Web应用对应的目录。
本实施例中,一个Web应用可以对应一个或多个Web容器单元;当一个Web应用对应于多个Web容器单元时,所述多个Web容器单元可以运行在不同的宿主机上。一个宿主机上可以运行一个或多个Web容器单元,各Web容器单元绑定所在宿主机上的一个端口,同一个宿主机上,不同Web容器单元所绑定的端口不同。
一种实现方式中,所述监控数据可以包括Web容器单元的以下一项或多项参数:
中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。
一种实现方式中,所述根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量可以包括以下至少一项:
当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,增加该Web应用对应的Web容器单元的数量;
当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,减少该Web应用对应的Web容器单元的数量。
其中,所述增加该Web应用对应的Web容器单元的数量可以包括:
从剩余资源能够创建至少一个Web容器的宿主机中确定一个宿主机,指示所确定的宿主机创建该Web应用对应的Web容器单元。
其中,所述减少该Web应用对应的Web容器单元的数量可以包括:
从该Web应用对应的Web容器单元中确定一个Web容器单元,指示所确定的Web容器单元所在的宿主机删除该Web应用对应的Web容器单元。
其中,所述宿主机可以但不限于为虚拟机。
本实施例中的其它实现细节可以参考实施例一。
实施例三、一种提供网页应用服务的装置,如图3所示,包括:
选择模块31,用于当收到用户对于Web应用的访问请求后,从所述Web应用对应的Web容器单元中选择一个Web容器单元;其中,所述Web容器单元用于处理接收到的访问请求;
转发模块32,用于将所述访问请求转发给所选择的Web容器单元。
本实施例中,选择模块31是上述装置中负责选择Web容器单元的部分,可以是软件、硬件或两者的结合。
本实施例中,转发模块32是上述装置中负责转发访问请求的部分,可以是软件、硬件或两者的结合。
一种实现方式中,所述转发模块将访问请求转发给所选择的Web容器单元可以包括:
所述转发模块根据所选择的Web容器单元所在的宿主机的地址,以及所选择的Web容器单元在该宿主机上绑定的端口,转发所述访问请求。
其中,所述宿主机可以但不限于是虚拟机。
一种实现方式中,当一个Web应用对应于多个Web容器单元时,所述多个Web容器单元可以运行在不同的宿主机上。
一种实现方式中,各Web应用对应的Web容器单元的存储目录可以分别是网络附属存储装置中,该Web应用对应的目录。
一种实现方式中,所述的装置还可以包括:
获取模块,用于获取各网页Web应用对应的Web容器单元的监控数据;
调整模块,用于根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。
本实现方式中,所述监控数据可以包括Web容器单元的以下一项或多项参数:
中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。
本实现方式中,所述调整模块根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量可以包括以下至少一项:
当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,所述调整模块增加该Web应用对应的Web容器单元的数量;
当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,所述调整模块减少该Web应用对应的Web容器单元的数量。
本实施例的装置的各模块的操作分别对应于实施例一中的步骤S110~S120,各模块操作的其它实现细节可参见实施例一。
实施例四、一种提供网页应用服务的装置,如图4所示,包括:
获取模块41,用于获取各网页Web应用对应的Web容器单元的监控数据;其中,一个Web应用对应一个或多个Web容器单元,所述Web容器单元用于处理对于所对应的Web应用的访问请求;
调整模块42,用于根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。
本实施例中,获取模块41是上述装置中负责获取监控数据的部分,可以是软件、硬件或两者的结合。
本实施例中,调整模块42是上述装置中负责调整Web容器单元的数量的部分,可以是软件、硬件或两者的结合。
一种实现方式中,所述监控数据可以包括Web容器单元的以下一项或多项参数:
中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。
一种实现方式中,所述调整模块根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量可以包括以下至少一项:
当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,所述调整模块增加该Web应用对应的Web容器单元的数量;
当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,所述调整模块减少该Web应用对应的Web容器单元的数量。
本实现方式中,所述调整模块增加该Web应用对应的Web容器单元的数量可以包括:
所述调整模块从剩余资源能够创建至少一个Web容器的宿主机中确定一个宿主机,指示所确定的宿主机创建该Web应用对应的Web容器单元。
本实现方式中,所述调整模块减少该Web应用对应的Web容器单元的数量可以包 括:
所述调整模块从该Web应用对应的Web容器单元中确定一个Web容器单元,指示所确定的Web容器单元所在的宿主机删除该Web应用对应的Web容器单元。
本实施例的装置的各模块的操作分别对应于实施例二中的步骤S210~S220,各模块操作的其它实现细节可参见实施例二。
实施例五、一种提供网页应用服务的电子设备,包括:第一存储器和第一处理器;
所述第一存储器用于保存用于提供网页应用服务的程序,所述用于提供网页服务的程序在被所述第一处理器读取执行时,执行以下操作:
当收到用户对于网页Web应用的访问请求后,从所述Web应用对应的Web容器单元中选择一个Web容器单元;其中,所述Web容器单元用于处理接收到的访问请求;
将所述访问请求转发给所选择的Web容器单元。
本实施例中,用于提供网页应用服务的程序在被第一处理器读取执行时,所执行的操作对应于实施例一中的步骤S110~S120;该程序所执行的操作的其它细节可参见实施例一。
实施例六、一种提供网页应用服务的电子设备,包括:第二存储器和第二处理器;
所述第二存储器用于保存用于提供网页应用服务的程序,所述用于提供网页服务的程序在被所述第二处理器读取执行时,执行以下操作:
获取各网页Web应用对应的Web容器单元的监控数据;其中,一个Web应用对应一个或多个Web容器单元,所述Web容器单元用于处理对于所对应的Web应用的访问请求;
根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。
本实施例中,用于提供网页应用服务的程序在被第二处理器读取执行时,所执行的操作对应于实施例二中的步骤S210~S220;该程序所执行的操作的其它细节可参见实施例二。
实施例七、一种提供网页应用服务的系统,包括:
多个宿主机;
每个所述宿主机上运行一个或多个Web容器单元;所述Web容器单元用于处理对于所对应的Web应用的访问请求。
一种实现方式中,所述的系统还可以包括:
接入模块,用于当收到用户对于网页Web应用的访问请求后,从所述Web应用对 应的Web容器单元中选择一个Web容器单元;根据所选择的Web容器单元所在的宿主机的地址,以及所选择的Web容器单元在该宿主机上绑定的端口,转发所述访问请求。
一种实现方式中,所述宿主机可以为虚拟机。
一种实现方式中,当一个宿主机上运行多个Web容器单元时,所述多个Web容器单元可以对应于不同的Web应用。
一种实现方式中,所述的系统还可以包括:
网络附属存储装置,用于将各Web应用的数据分别保存在该Web应用对应的目录中;其中,各Web应用对应的目录分别作为该Web应用对应的Web容器单元的存储目录。
一种实现方式中,所述的系统还可以包括:
监控模块,用于分别通过各宿主机中的监控代理采集该宿主机中运行的Web容器单元的监控数据,通过所述接入模块获得对于各Web容器单元的监控数据;
弹性调度模块,用于根据各Web容器单元的监控数据,调整Web应用所对应的Web容器单元的数量。
本实现方式中,所述监控数据可以包括Web容器单元的以下一项或多项参数:
中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。
本实现方式中,所述弹性调度模块根据所采集的监控数据,调整Web应用所对应的Web容器单元的数量可以包括以下至少一项:
所述弹性调度模块当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,从剩余资源能够创建至少一个Web容器的宿主机中确定一个宿主机,指示所确定的宿主机上的容器代理在该宿主机上创建该Web应用对应的Web容器单元;
所述弹性调度模块当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,从该Web应用对应的Web容器单元中确定一个Web容器单元,指示所确定的Web容器单元所在的宿主机上的容器代理删除该宿主机上该Web应用对应的Web容器单元。
本实施例的系统可以用于实现实施例一或二的方法,其它实现细节可参考实施例一。
下面用一个例子说明本实施例的系统。本例子中,每个Web应用有全局唯一的标识APP_ID,以及全局唯一的域名:APP_DOMAIN_NAME;用户通过域名即可访问相应的Web应用。
本例子中,分配给每个Web容器单元的资源(型号、大小等)可以是相同的,即 Web容器单元是标准规格的。每个Web容器单元有全局唯一的标识:CONTAINER_ID。每个Web容器单元在作为本Web容器单元宿主机的VM上至少绑定一个端口:CONTAINER_PORT;Web容器单元具体绑定VM的哪个端口可以自行设置。也就是说,Web容器单元内部运行独立的Web服务进程(如apache、nginx、tomcat等)并绑定独立端口(即CONTAINER_PORT,在VM上唯一)。
本例子中,伸缩阈值是判断Web容器单元中的资源是否需要进行调整时的依据,包括扩容阈值和缩容阈值。用户可以为不同的Web应用定义不同的伸缩阈值。
本例子中,以VM作为运行Web容器单元的宿主机,具有一定计算资源CPU和存储资源(内存,磁盘)。每个VM上可以运行一个或多个Web容器单元,具体数量和VM本身的资源以及为Web容器单元分配的资源有关。本例子中,对于一个Web应用,一个VM上只能有一个对应的Web容器单元。每台VM具有全局唯一的标识VM_ID,和内网IP地址:VM_INNER_IP。
本例子中,运行本实施例的方法的系统如图5所示,可以包括:
Web服务的接入模块、弹性调度模块、监控模块、资源模块;
一个或多个虚拟机,比如图5中的虚拟机1、虚拟机2……;每个虚拟机中分别包括以下组件:
容器代理(Container Agent):用于从弹性调度模块接收扩容指令和缩容指令,并相应启动或停止Web容器单元;
监控代理(Moniter Agent):统计Web容器单元提供的各项资源(本例子中至少包括CPU和内存)的使用率并作为监控数据发送到监控模块。
每个虚拟机中运行一个或多个Web容器单元,比如图5中虚拟机1中运行两个Web容器单元,分别对应于Web应用1和Web应用2;虚拟机2中运行两个Web容器单元,分别对应于Web应用1和Web应用3。
本例中,每个Web容器单元采用apache提供Web服务进程。
Web服务的接入模块用于在收到对于Web应用的访问请求后,根据所访问的Web应用的域名,在Web应用对应的多个Web容器单元中,根据预先配置的负载均衡策略选择一个路由规则转发所述访问请求;周期性统计各Web容器单元在单位时间内的最大并发数和慢请求数,作为监控数据上报给监控模块。
监控模块用于从Web服务的接入模块和监控代理接收监控数据,并将监控数据按照Web应用进行存储,即,将对应于同一个Web应用的Web容器单元的监控数据汇总后 保存为该Web应用的监控数据。
弹性调度模块用于从监控模块遍历每个Web应用的监控数据,并根据预定的弹性伸缩策略,对相应VM的容器代理发送扩容或缩容指令;还可以为WEB服务接入模块配置路由规则。
资源模块用于保存各VM的资源信息(比如剩余资源多少、运行几个Web容器单元等),以及各Web应用对应的Web容器单元的信息(比如对应的Web应用、所在VM、绑定的端口等),本例子中,分别以VM资源信息表和Web容器单元信息表的形式保存。
本例子中,所述系统还可以包括采用NAS技术的云存储模块(或称为云磁盘),用于提供更大的空间存储能力和性能扩展能力。
本例子中,弹性伸缩策略可以是依据Web容器单元在单位时间内的资源使用率,并发数,慢请求数(包含不限于以上3类资源)等判断是否满足扩容阈值或缩容阈值,从而决定如何执行伸缩策略:
扩容阈值可以是满足以下任一项:
CPU使用率>90%;
内存(memory)使用率>90%;
并发数>1000;
慢请求数>100。
缩容阈值可以是满足以下任一项:
CPU使用率<30%;
内存(memory)使用率<30%;
并发数<100;
慢请求数<10。
本例子中,弹性调度模块可以定时检查每个Web应用对应的Web容器单元,判断Web容器单元对于资源的使用是否达到扩容阈值或缩容,并相应进行扩容或缩容流程。
扩容流程:如果某个Web容器单元的资源使用情况达到扩容阈值则从资源模块申请容器资源,得到新的Web容器单元,为该Web容器单元分配VM的IP地址和端口(Port),然后调用所分配的VM上的Container Agent启动新的Web容器单元,同时挂载云存储模块中相应Web应用的存储目录到容器存储目录,然后在Web服务接入模块增加新的路由规则,新的路由规则是将相应Web应用的域名路由到新的Web容器单元所在VM的IP地址和Port。
本例子中,扩容指令的发送流程包括:
从VM资源池中,确定一个具有创建新Web容器单元所需的空闲资源的VM;对所找到的VM上的Container Agent发送扩容指令,所述扩容指令用于指示创建指定的应用的Web容器单元。其中,可以根据所确定VM的VM_ID找到对应的VM_INNER_IP,向该VM_INNER_IP发送扩容指令。
扩容成功后将此Web容器单元的CONTAINER_ID和VM_ID的对应关系存入资源模块。
缩容流程:如果某个Web容器单元达到缩容阈值,则先从Web服务接入模块删除将对应Web应用的域名路由到该Web容器单元所在VM的IP地址和端口的路由规则(对于该Web应用的新的访问请求将不会再路由到此Web容器单元),然后轮询判断此Web容器单元中没有运行中的php进程后,停止Web容器单元,释放相关资源,同时卸载该Web容器单元的容器存储目录所挂载的Web应用的存储目录。最后向资源模块归还分配给此Web容器单元的VM的IP地址和端口。
本例子中,缩容指令的发送流程包括:
确定达到缩容阈值的Web容器单元,对该Web容器单元所在VM的Container Agent发送缩容指令。其中,可以根据所确定的Web容器单元的CONTAINER_ID找到对应的VM_ID,根据该VM_ID找到对应的VM_INNER_IP,向该VM_INNER_IP发送缩容指令。
缩容成功后在资源模块里删除缩容的Web容器单元的CONTAINER_ID和VM_ID的对应关系。
本例子的一种应用场景中,应用管理员首先通过文件传输协议(File Transfer Protocol,FTP)的方式,或本例子中的弹性虚拟主机系统开放给应用管理员的服务或客户端,完成网站程序上传的过程,然后通过控制台启动网站。应用访问者可以通过浏览器输入Web应用的域名(或点击移动终端上的App)访问相应Web应用提供的各种服务。
其中,应用管理员一般是网站的所有者,拥有网站程序,如:可以直接运行的源代码(*.php文件)或编译后的文件(*.class、*.jar等文件)。应用访问者一般是网站的浏览者,是可以通过终端等设备访问网络的人。
如图6所示,应用管理员可以通过Web控制台、移动终端上的App、桌面应用程序等方式对图5所示系统进行监控和设置,比如通过弹性策略界面设置弹性策略,比如设 置:
全局可分配最大和最小web容器数设置、伸缩阈值、单位时间的大小(如60秒)、单位时间内CPU的使用范围,单位时间内存的使用范围、单Web容器单元单位时间内最大请求并发数阈值、单Web容器单位时间最大慢请求数阈值等。
应用管理员还可以配置调度策略,可以但不限于以下3种:
普通模式:可以指定Web应用对应的Web容器单元的固定数量。
实时调度模式:根据每个Web容器的监控数据,依据预定义配置策略自动进行扩容和缩容,无需人为干预。
预约调度模式:使预约配置阈值在预约时间段到达时进行扩容和缩容动作,提高Web服务可靠性。预约时间段以外恢复成默认的Web容器单元的数量。
应用管理员还可以根据Web容器监控界面查看各Web容器单元的监控数据。比如但不限于:
分配的web容器总数、每个Web容器的监控数据(比如资源使用率,并发数,慢请求数等)。
这样便于应用管理员了解Web应用当前实际资源消耗情况,也可以判断Web容器单元是否健康,也便于根据Web容器单元增减时间准确了解网站实际运行情况,为网站运营报告提供数据依据。
根据监控数据还可以更深入了解网站运行状况是否正常,如作为攻击事件时间判断依据等。
本应用场景中,当采用实时调度模式时,可以根据网站实际访问量动态扩容或及时缩容后台的Web容器资源,保证网站访问流畅,不需要人为进行操作,在访问量激增时能保证网站服务的高可用性和经济性,在访问量不足时可以收缩Web容器单元的个数以节省开支。
本应用场景中,还可以通过预定义的报警策略,使应用管理员能够及时接收网站运行异常状态时的报警消息,便于及时处理突发事件。
报警策略中可配置属性可以包含:是否启用扩容时报警、是否启用缩容时报警、报警方式(邮件、短信、Web控制台等)、Web容器资源使用报警阈值(CPU范围,内存范围,并发数范围,慢请求数范围)。
本领域普通技术人员可以理解上述方法中的全部或部分步骤可通过程序来指令相关 硬件完成,所述程序可以存储于计算机可读存储介质中,如只读存储器、磁盘或光盘等。可选地,上述实施例的全部或部分步骤也可以使用一个或多个集成电路来实现。相应地,上述实施例中的各模块/单元可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。本申请不限制于任何特定形式的硬件和软件的结合。
当然,本申请还可有其他多种实施例,在不背离本申请精神及其实质的情况下,熟悉本领域的技术人员当可根据本申请作出各种相应的改变和变形,但这些相应的改变和变形都应属于本申请的权利要求的保护范围。
Claims (35)
- 一种提供网页应用服务的方法,包括:当收到用户对于网页Web应用的访问请求后,从所述Web应用对应的Web容器单元中选择一个Web容器单元;其中,所述Web容器单元用于处理接收到的访问请求;将所述访问请求转发给所选择的Web容器单元。
- 如权利要求1所述的方法,其特征在于,所述将所述访问请求转发给所选择的Web容器单元包括:根据所选择的Web容器单元所在的宿主机的地址,以及所选择的Web容器单元在该宿主机上绑定的端口,转发所述访问请求。
- 如权利要求2所述的方法,其特征在于:所述宿主机为虚拟机。
- 如权利要求2所述的方法,其特征在于:当一个Web应用对应于多个Web容器单元时,所述多个Web容器单元运行在不同的宿主机上。
- 如权利要求1所述的方法,其特征在于:对应于同一个Web应用的Web容器单元,在网络附属存储装置中该Web应用对应的目录中进行数据存储。
- 如权利要求1~5中任一项所述的方法,其特征在于,还包括:获取各Web应用对应的Web容器单元的监控数据;根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。
- 如权利要求6所述的方法,其特征在于,所述监控数据包括Web容器单元的以下一项或多项参数:中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。
- 如权利要求6所述的方法,其特征在于,所述根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量包括以下至少一项:当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,增加该Web应用对应的Web容器单元的数量;当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,减少该Web应用对应的Web容器单元的数量。
- 一种提供网页应用服务的方法,包括:获取各网页Web应用对应的Web容器单元的监控数据;其中,一个Web应用对应一个或多个Web容器单元,所述Web容器单元用于处理对于所对应的Web应用的访问请求;根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。
- 如权利要求9所述的方法,其特征在于,所述监控数据包括Web容器单元的以下一项或多项参数:中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。
- 如权利要求9所述的方法,其特征在于,所述根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量包括以下至少一项:当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,增加该Web应用对应的Web容器单元的数量;当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,减少该Web应用对应的Web容器单元的数量。
- 如权利要求11所述的方法,其特征在于,所述增加该Web应用对应的Web容器单元的数量包括:从剩余资源能够创建至少一个Web容器的宿主机中确定一个宿主机,指示所确定的宿主机创建该Web应用对应的Web容器单元。
- 如权利要求11所述的方法,其特征在于,所述减少该Web应用对应的Web容器单元的数量包括:从该Web应用对应的Web容器单元中确定一个Web容器单元,指示所确定的Web容器单元所在的宿主机删除该Web应用对应的Web容器单元。
- 一种提供网页应用服务的装置,其特征在于,包括:选择模块,用于当收到用户对于网页Web应用的访问请求后,从所述Web应用对应的Web容器单元中选择一个Web容器单元;其中,所述Web容器单元用于处理接收到的访问请求;转发模块,用于将所述访问请求转发给所选择的Web容器单元。
- 如权利要求14所述的装置,其特征在于,所述转发模块将访问请求转发给所选择的Web容器单元包括:所述转发模块根据所选择的Web容器单元所在的宿主机的地址,以及所选择的Web容器单元在该宿主机上绑定的端口,转发所述访问请求。
- 如权利要求15所述的装置,其特征在于:当一个Web应用对应于多个Web容器单元时,所述多个Web容器单元运行在不同的宿主机上。
- 如权利要求15所述的装置,其特征在于:各Web应用对应的Web容器单元的存储目录分别是网络附属存储装置中,该Web应用对应的目录。
- 如权利要求14~17中任一项所述的装置,其特征在于,还包括:获取模块,用于获取各网页Web应用对应的Web容器单元的监控数据;调整模块,用于根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。
- 如权利要求18所述的装置,其特征在于,所述监控数据包括Web容器单元的以下一项或多项参数:中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。
- 如权利要求18所述的装置,其特征在于,所述调整模块根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量包括以下至少一项:当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,所述调整模块增加该Web应用对应的Web容器单元的数量;当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,所述调整模块减少该Web应用对应的Web容器单元的数量。
- 一种提供网页应用服务的装置,其特征在于,包括:获取模块,用于获取各网页Web应用对应的Web容器单元的监控数据;其中,一个Web应用对应一个或多个Web容器单元,所述Web容器单元用于处理对于所对应的Web应用的访问请求;调整模块,用于根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。
- 如权利要求21所述的装置,其特征在于,所述监控数据包括Web容器单元的以下一项或多项参数:中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。
- 如权利要求21所述的装置,其特征在于,所述调整模块根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量包括以下至少一项:当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,所述调整模块增加该Web应用对应的Web容器单元的数量;当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,所述调整模块减少该Web应用对应的Web容器单元的数量。
- 如权利要求23所述的装置,其特征在于,所述调整模块增加该Web应用对应的Web容器单元的数量包括:所述调整模块从剩余资源能够创建至少一个Web容器的宿主机中确定一个宿主机,指示所确定的宿主机创建该Web应用对应的Web容器单元。
- 如权利要求23所述的装置,其特征在于,所述调整模块减少该Web应用对应的Web容器单元的数量包括:所述调整模块从该Web应用对应的Web容器单元中确定一个Web容器单元,指示所确定的Web容器单元所在的宿主机删除该Web应用对应的Web容器单元。
- 一种提供网页应用服务的电子设备,包括:第一存储器和第一处理器;其特征在于:所述第一存储器用于保存用于提供网页应用服务的程序,所述用于提供网页服务的程序在被所述第一处理器读取执行时,执行以下操作:当收到用户对于网页Web应用的访问请求后,从所述Web应用对应的Web容器单元中选择一个Web容器单元;其中,所述Web容器单元用于处理接收到的访问请求;将所述访问请求转发给所选择的Web容器单元。
- 一种提供网页应用服务的电子设备,包括:第二存储器和第二处理器;其特征在于:所述第二存储器用于保存用于提供网页应用服务的程序,所述用于提供网页服务的程序在被所述第二处理器读取执行时,执行以下操作:获取各网页Web应用对应的Web容器单元的监控数据;其中,一个Web应用对应一个或多个Web容器单元,所述Web容器单元用于处理对于所对应的Web应用的访问请求;根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。
- 一种提供网页应用服务的系统,其特征在于,包括:多个宿主机;每个所述宿主机上运行一个或多个Web容器单元;所述Web容器单元用于处理对于所对应的Web应用的访问请求。
- 如权利要求28所述的系统,其特征在于,还包括:接入模块,用于当收到用户对于网页Web应用的访问请求后,从所述Web应用对应的Web容器单元中选择一个Web容器单元;根据所选择的Web容器单元所在的宿主机的地址,以及所选择的Web容器单元在该宿主机上绑定的端口,转发所述访问请求。
- 如权利要求28所述的系统,其特征在于:所述宿主机为虚拟机。
- 如权利要求28所述的系统,其特征在于:当一个宿主机上运行多个Web容器单元时,所述多个Web容器单元对应于不同的Web应用。
- 如权利要求28所述的系统,其特征在于,还包括:网络附属存储装置,用于将各Web应用的数据分别保存在该Web应用对应的目录中;其中,各Web应用对应的目录分别作为该Web应用对应的Web容器单元的存储目录。
- 如权利要求29所述的系统,其特征在于,还包括:监控模块,用于分别通过各宿主机中的监控代理获取该宿主机中运行的Web容器单元的监控数据,通过所述接入模块获得对于各Web容器单元的监控数据;弹性调度模块,用于根据各Web容器单元的监控数据,调整Web应用所对应的Web容器单元的数量。
- 如权利要求33所述的系统,其特征在于,所述监控数据包括Web容器单元的以下一项或多项参数:中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。
- 如权利要求33所述的系统,其特征在于,所述弹性调度模块根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量包括以下至少一项:所述弹性调度模块当一个Web应用对应的Web容器单元的监控数据满足扩容条件 时,从剩余资源能够创建至少一个Web容器的宿主机中确定一个宿主机,指示所确定的宿主机上的容器代理在该宿主机上创建该Web应用对应的Web容器单元;所述弹性调度模块当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,从该Web应用对应的Web容器单元中确定一个Web容器单元,指示所确定的Web容器单元所在的宿主机上的容器代理删除该宿主机上该Web应用对应的Web容器单元。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611228664.9A CN108243239A (zh) | 2016-12-27 | 2016-12-27 | 一种提供网页应用服务的方法、装置、电子设备及系统 |
CN201611228664.9 | 2016-12-27 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2018121334A1 true WO2018121334A1 (zh) | 2018-07-05 |
Family
ID=62702845
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2017/117081 WO2018121334A1 (zh) | 2016-12-27 | 2017-12-19 | 一种提供网页应用服务的方法、装置、电子设备及系统 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN108243239A (zh) |
WO (1) | WO2018121334A1 (zh) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109981615A (zh) * | 2019-03-12 | 2019-07-05 | 上海纽盾科技股份有限公司 | 基于区块链的防攻击系统及方法 |
CN111367678A (zh) * | 2020-03-31 | 2020-07-03 | 中国工商银行股份有限公司 | 集群资源管理方法及系统 |
CN111831447A (zh) * | 2020-07-16 | 2020-10-27 | 中国民航信息网络股份有限公司 | 一种基于性能监控的应用弹性扩容方法及装置 |
CN112306640A (zh) * | 2020-11-12 | 2021-02-02 | 广州方硅信息技术有限公司 | 容器分配方法及其装置、设备、介质 |
CN112532669A (zh) * | 2019-09-19 | 2021-03-19 | 贵州白山云科技股份有限公司 | 一种网络边缘计算方法、装置及介质 |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109117149A (zh) * | 2018-07-13 | 2019-01-01 | 下代互联网重大应用技术(北京)工程研究中心有限公司 | 一种行为分析系统部署方法及电子设备 |
CN109240799B (zh) * | 2018-09-06 | 2022-04-15 | 福建星瑞格软件有限公司 | 大数据平台集群容灾方法、系统及计算机可读存储介质 |
CN109284275B (zh) * | 2018-09-28 | 2021-03-09 | 苏州浪潮智能科技有限公司 | 一种云平台虚拟机文件系统监控方法和装置 |
CN110888780A (zh) * | 2019-11-19 | 2020-03-17 | 泰康保险集团股份有限公司 | 应用监控方法、装置、设备及存储介质 |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104580226A (zh) * | 2015-01-15 | 2015-04-29 | 上海瀚之友信息技术服务有限公司 | 一种共享会话数据的系统和方法 |
CN106201819A (zh) * | 2016-06-28 | 2016-12-07 | 乐视控股(北京)有限公司 | 应用容器引擎的系统资源占用量监控方法和装置 |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6823331B1 (en) * | 2000-08-28 | 2004-11-23 | Entrust Limited | Concept identification system and method for use in reducing and/or representing text content of an electronic document |
CN101465866B (zh) * | 2007-12-20 | 2013-01-02 | 上海盛娱网络科技有限公司 | 基于Web终端访问WAP网络的方法及转换模块 |
CN102681899B (zh) * | 2011-03-14 | 2015-06-10 | 金剑 | 云计算服务平台的虚拟计算资源动态管理方法 |
CN103139183A (zh) * | 2011-12-02 | 2013-06-05 | 电子科技大学 | 一种基于云平台的应用虚拟化技术 |
US10218633B2 (en) * | 2014-03-28 | 2019-02-26 | Amazon Technologies, Inc. | Implementation of a service that coordinates the placement and execution of containers |
CN105979009B (zh) * | 2016-07-06 | 2019-05-17 | 乾云数创(山东)信息技术研究院有限公司 | 一种针对云应用容器的增加负载自动均衡方法 |
-
2016
- 2016-12-27 CN CN201611228664.9A patent/CN108243239A/zh active Pending
-
2017
- 2017-12-19 WO PCT/CN2017/117081 patent/WO2018121334A1/zh active Application Filing
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104580226A (zh) * | 2015-01-15 | 2015-04-29 | 上海瀚之友信息技术服务有限公司 | 一种共享会话数据的系统和方法 |
CN106201819A (zh) * | 2016-06-28 | 2016-12-07 | 乐视控股(北京)有限公司 | 应用容器引擎的系统资源占用量监控方法和装置 |
Non-Patent Citations (1)
Title |
---|
SIJIN HE ET AL.: "Elastic Application Container: A Lightweight Approach for Cloud Resource Provisioning", 2012 26TH IEEE INTERNATIONAL CONFERENCE ON ADVANCED INFORMATION NETWORKING AND APPLICATIONS, 19 April 2012 (2012-04-19), XP032169603 * |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109981615A (zh) * | 2019-03-12 | 2019-07-05 | 上海纽盾科技股份有限公司 | 基于区块链的防攻击系统及方法 |
CN109981615B (zh) * | 2019-03-12 | 2023-11-14 | 上海纽盾科技股份有限公司 | 基于区块链的防攻击系统及方法 |
CN112532669A (zh) * | 2019-09-19 | 2021-03-19 | 贵州白山云科技股份有限公司 | 一种网络边缘计算方法、装置及介质 |
CN111367678A (zh) * | 2020-03-31 | 2020-07-03 | 中国工商银行股份有限公司 | 集群资源管理方法及系统 |
CN111367678B (zh) * | 2020-03-31 | 2023-08-22 | 中国工商银行股份有限公司 | 集群资源管理方法及系统 |
CN111831447A (zh) * | 2020-07-16 | 2020-10-27 | 中国民航信息网络股份有限公司 | 一种基于性能监控的应用弹性扩容方法及装置 |
CN111831447B (zh) * | 2020-07-16 | 2024-04-30 | 中国民航信息网络股份有限公司 | 一种基于性能监控的应用弹性扩容方法及装置 |
CN112306640A (zh) * | 2020-11-12 | 2021-02-02 | 广州方硅信息技术有限公司 | 容器分配方法及其装置、设备、介质 |
Also Published As
Publication number | Publication date |
---|---|
CN108243239A (zh) | 2018-07-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2018121334A1 (zh) | 一种提供网页应用服务的方法、装置、电子设备及系统 | |
JP6669682B2 (ja) | クラウドサーバスケジューリング方法及び装置 | |
US10402231B2 (en) | Adjusting variable limit on concurrent code executions | |
CN111796908B (zh) | 一种资源自动弹性伸缩的系统、方法及云平台 | |
US9959188B1 (en) | Managing processor usage of a physical host configured for hosting computing instances | |
JP6495010B2 (ja) | トラフィックディレクタ環境におけるトラフィックのアクティブ−パッシブルーティングおよび制御のためのシステムおよび方法 | |
US10104037B2 (en) | Method and system for network access request control | |
EP2871553B1 (en) | Systems and methods for protecting virtualized assets | |
US7587492B2 (en) | Dynamic performance management for virtual servers | |
US20180375726A1 (en) | Resource Configuration Method, Virtualized Network Function Manager, and Element Management System | |
US9600319B2 (en) | Computer-readable medium, apparatus, and method for offloading processing from a virtual switch to a physical switch | |
US20180004556A1 (en) | Adjusting variable limit on concurrent code executions based on communication between frontends | |
US20200326876A1 (en) | Object Migration Method, Device, and System | |
CN113010818A (zh) | 访问限流方法、装置、电子设备及存储介质 | |
CN109213571B (zh) | 一种内存共享方法、容器管理平台及计算机可读存储介质 | |
US20170329390A1 (en) | System and method for selectively hibernating and restarting a node of an application instance | |
CN111258627A (zh) | 一种接口文档生成方法和装置 | |
CN106713378B (zh) | 实现多个应用服务器提供服务的方法和系统 | |
CN106911741B (zh) | 一种虚拟化网管文件下载负载均衡的方法及网管服务器 | |
WO2017185615A1 (zh) | 一种业务处理设备的业务状态确定方法及调度设备 | |
CN105592134B (zh) | 一种负载分担的方法和装置 | |
US20170111240A1 (en) | Service Elastic Method and Apparatus in Cloud Computing | |
US20200272526A1 (en) | Methods and systems for automated scaling of computing clusters | |
WO2020252724A1 (zh) | 日志处理方法、设备及计算机可读存储介质 | |
US9720670B2 (en) | Deploying software in a computer network |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 17888115 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 17888115 Country of ref document: EP Kind code of ref document: A1 |