WO2018121334A1 - Web application service providing method, apparatus, electronic device and system - Google Patents

Web application service providing method, apparatus, electronic device and system Download PDF

Info

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
Application number
PCT/CN2017/117081
Other languages
French (fr)
Chinese (zh)
Inventor
付红波
Original Assignee
阿里巴巴集团控股有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 阿里巴巴集团控股有限公司 filed Critical 阿里巴巴集团控股有限公司
Publication of WO2018121334A1 publication Critical patent/WO2018121334A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • H04L67/025Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/4557Distribution of virtual machine instances; Migration and load balancing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45595Network 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

The present application provides a web application service providing method, apparatus, electronic device and system. The web application service providing method comprises: when an access request for a web page (Web) application by a user is received, selecting a Web container unit from Web container units corresponding to the Web application; the Web container unit being used for processing the received access request; and forwarding the access request to the selected Web container unit. The present application can improve the reliability of the web application services.

Description

一种提供网页应用服务的方法、装置、电子设备及***Method, device, electronic device and system for providing webpage application service
本申请要求2016年12月27日递交的申请号为201611228664.9、发明名称为“一种提供网页应用服务的方法、装置、电子设备及***”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority to Chinese Patent Application No. 201611228664.9, entitled "A Method, Apparatus, Electronic Apparatus and System for Providing Web Application Services", filed on December 27, 2016, the entire contents of In this application.
技术领域Technical field
本发明涉及网络领域,尤其涉及一种提供网页应用服务的方法、装置、电子设备及***。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.
背景技术Background technique
传统的采用虚拟主机提供网页(Web)应用的方案是:一台虚拟主机服务器,启动Web(网页)服务器(apache、tomcat或者IIS等)软件,同时放置几十个甚至上百个虚拟站点,虚拟站点之间共享***资源和命名空间。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.
该方案主要存在以下几类常见问题:The program mainly has the following types of common problems:
(1)很容易出现耗资源的站点抢占***资源而导致***资源耗尽、应用服务可用性降低或权限控制不当出现安全隐患等各种问题。(1) It is easy for a resource-consuming site to seize system resources and cause various problems such as exhausted system resources, reduced application service availability, or improper security control.
(2)共享的Web容器能够支持的并发大小和总体性能有限,无法根据实际需求进行动态扩容或缩容。(2) The concurrent size and overall performance that the shared web container can support is limited, and cannot be dynamically expanded or reduced according to actual needs.
(3)当单服务器存储资源受限制或计算资源(CPU,内存)等利用率达到上限时,往往需要采用数据同步技术实现用户站点数据的迁移动作,影响用户业务的连续性。(3) When the single-server storage resource is restricted or the utilization of computing resources (CPU, memory) reaches the upper limit, data synchronization technology is often used to implement the migration of user site data, which affects the continuity of user services.
(4)服务器资源利用率问题始终存在,有的服务器活跃站点多,有的服务器非活跃站点多,总体资源利用率较低。(4) Server resource utilization problems always exist. Some servers have more active sites, some have more inactive sites, and the overall resource utilization is lower.
采用容器技术可以提高应用程序的可用性和安全隔离;容器技术是将原先部署在虚拟机(Virtual Machines,VM)上的应用环境,部署到Linux容器(Linux Container,LXC)、Docker等容器内部,这样可以增强单服务器***的可靠性,但还是存在容器所在的服务器宕机会导致单点故障、资源利用率低、数据迁移时间长、存储磁盘空间有限制等诸多问题。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.
发明内容Summary of the invention
本申请提供一种提供网页应用服务的访问方法、装置、电子设备及***,可以提高 Web应用服务的可靠性。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.
采用如下技术方案。The following technical solutions are adopted.
一种提供网页应用服务的方法,包括:A method of providing a web application service, comprising:
当收到用户对于网页Web应用的访问请求后,从所述Web应用对应的Web容器单元中选择一个Web容器单元;其中,所述Web容器单元用于处理接收到的访问请求;After receiving the user's access request for the webpage web application, selecting 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;
将所述访问请求转发给所选择的Web容器单元。Forwarding the access request to the selected web container unit.
可选地,所述将访问请求转发给所选择的Web容器单元包括:Optionally, the forwarding the access request to the selected web container unit includes:
根据所选择的Web容器单元所在的宿主机的地址,以及所选择的Web容器单元在该宿主机上绑定的端口,转发所述访问请求。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.
可选地,所述宿主机为虚拟机。Optionally, the host machine is a virtual machine.
可选地,当一个Web应用对应于多个Web容器单元时,所述多个Web容器单元运行在不同的宿主机上。Optionally, when a web application corresponds to a plurality of web container units, the plurality of web container units run on different hosts.
可选地,对应于同一个Web应用的Web容器单元,在网络附属存储装置中该Web应用对应的目录中进行数据存储。Optionally, 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.
可选地,所述的方法还包括:Optionally, the method further includes:
获取各Web应用对应的Web容器单元的监控数据;Obtaining monitoring data of a web container unit corresponding to each web application;
根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。Adjust the number of web container units corresponding to the web application according to the acquired monitoring data.
可选地,所述监控数据包括Web容器单元的以下一项或多项参数:Optionally, the monitoring data includes one or more of the following parameters of the web container unit:
中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。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.
可选地,所述根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量包括以下至少一项:Optionally, 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:
当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,增加该Web应用对应的Web容器单元的数量;When the monitoring data of the web container unit corresponding to the web application meets the expansion condition, the number of the web container unit corresponding to the web application is increased;
当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,减少该Web应用对应的Web容器单元的数量。When the monitoring data of the web container unit corresponding to a web application satisfies the contraction condition, the number of web container units corresponding to the web application is reduced.
一种提供网页应用服务的方法,包括:A method of providing a web application service, comprising:
获取各网页Web应用对应的Web容器单元的监控数据;其中,一个Web应用对应一个或多个Web容器单元,所述Web容器单元用于处理对于所对应的Web应用的访问 请求;Obtaining 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;
根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。Adjust the number of web container units corresponding to the web application according to the acquired monitoring data.
可选地,所述监控数据包括Web容器单元的以下一项或多项参数:Optionally, the monitoring data includes one or more of the following parameters of the web container unit:
中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。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.
可选地,所述根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量包括以下至少一项:Optionally, 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:
当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,增加该Web应用对应的Web容器单元的数量;When the monitoring data of the web container unit corresponding to the web application meets the expansion condition, the number of the web container unit corresponding to the web application is increased;
当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,减少该Web应用对应的Web容器单元的数量。When the monitoring data of the web container unit corresponding to a web application satisfies the contraction condition, the number of web container units corresponding to the web application is reduced.
可选地,所述增加该Web应用对应的Web容器单元的数量包括:Optionally, the increasing the number of web container units corresponding to the web application comprises:
从剩余资源能够创建至少一个Web容器的宿主机中确定一个宿主机,指示所确定的宿主机创建该Web应用对应的Web容器单元。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.
可选地,所述减少该Web应用对应的Web容器单元的数量包括:Optionally, the reducing the number of web container units corresponding to the web application comprises:
从该Web应用对应的Web容器单元中确定一个Web容器单元,指示所确定的Web容器单元所在的宿主机删除该Web应用对应的Web容器单元。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:
选择模块,用于当收到用户对于网页Web应用的访问请求后,从所述Web应用对应的Web容器单元中选择一个Web容器单元;其中,所述Web容器单元用于处理接收到的访问请求;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 ;
转发模块,用于将所述访问请求转发给所选择的Web容器单元。And a forwarding module, configured to forward the access request to the selected web container unit.
可选地,所述转发模块将访问请求转发给所选择的Web容器单元包括:Optionally, forwarding, by the forwarding module, the access request to the selected web container unit includes:
所述转发模块根据所选择的Web容器单元所在的宿主机的地址,以及所选择的Web容器单元在该宿主机上绑定的端口,转发所述访问请求。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.
可选地,当一个Web应用对应于多个Web容器单元时,所述多个Web容器单元运行在不同的宿主机上。Optionally, when a web application corresponds to a plurality of web container units, the plurality of web container units run on different hosts.
可选地,各Web应用对应的Web容器单元的存储目录分别是网络附属存储装置中,该Web应用对应的目录。Optionally, 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.
可选地,所述的装置还包括:Optionally, the device further includes:
获取模块,用于获取各网页Web应用对应的Web容器单元的监控数据;An obtaining module, configured to acquire monitoring data of a web container unit corresponding to each webpage web application;
调整模块,用于根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。The adjustment module is configured to adjust the number of web container units corresponding to the web application according to the acquired monitoring data.
可选地,所述监控数据包括Web容器单元的以下一项或多项参数:Optionally, the monitoring data includes one or more of the following parameters of the web container unit:
中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。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.
可选地,所述调整模块根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量包括以下至少一项:Optionally, 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:
当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,所述调整模块增加该Web应用对应的Web容器单元的数量;When the monitoring data of the web container unit corresponding to the web application meets the expansion condition, the adjustment module increases the number of the web container unit corresponding to the web application;
当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,所述调整模块减少该Web应用对应的Web容器单元的数量。When the monitoring data of the web container unit corresponding to the web application satisfies the contraction condition, the adjustment module reduces the number of web container units corresponding to the web application.
一种提供网页应用服务的装置,包括:A device for providing a web application service, comprising:
获取模块,用于获取各网页Web应用对应的Web容器单元的监控数据;其中,一个Web应用对应一个或多个Web容器单元,所述Web容器单元用于处理对于所对应的Web应用的访问请求;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 ;
调整模块,用于根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。The adjustment module is configured to adjust the number of web container units corresponding to the web application according to the acquired monitoring data.
可选地,所述监控数据包括Web容器单元的以下一项或多项参数:Optionally, the monitoring data includes one or more of the following parameters of the web container unit:
中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。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.
可选地,所述调整模块根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量包括以下至少一项:Optionally, 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:
当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,所述调整模块增加该Web应用对应的Web容器单元的数量;When the monitoring data of the web container unit corresponding to the web application meets the expansion condition, the adjustment module increases the number of the web container unit corresponding to the web application;
当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,所述调整模块减少该Web应用对应的Web容器单元的数量。When the monitoring data of the web container unit corresponding to the web application satisfies the contraction condition, the adjustment module reduces the number of web container units corresponding to the web application.
可选地,所述调整模块增加该Web应用对应的Web容器单元的数量包括:Optionally, the adjusting module increases the number of web container units corresponding to the web application, including:
所述调整模块从剩余资源能够创建至少一个Web容器的宿主机中确定一个宿主机,指示所确定的宿主机创建该Web应用对应的Web容器单元。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.
可选地,所述调整模块减少该Web应用对应的Web容器单元的数量包括:Optionally, the adjusting module reduces the number of web container units corresponding to the web application, including:
所述调整模块从该Web应用对应的Web容器单元中确定一个Web容器单元,指示所确定的Web容器单元所在的宿主机删除该Web应用对应的Web容器单元。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:
当收到用户对于网页Web应用的访问请求后,从所述Web应用对应的Web容器单元中选择一个Web容器单元;其中,所述Web容器单元用于处理接收到的访问请求;After receiving the user's access request for the webpage web application, selecting 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;
将所述访问请求转发给所选择的Web容器单元。Forwarding the access request to the selected web container unit.
一种提供网页应用服务的电子设备,包括:第二存储器和第二处理器;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:
获取各网页Web应用对应的Web容器单元的监控数据;其中,一个Web应用对应一个或多个Web容器单元,所述Web容器单元用于处理对于所对应的Web应用的访问请求;Obtaining 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;
根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。Adjust the number of web container units corresponding to the web application according to the acquired monitoring data.
一种提供网页应用服务的***,包括:A system for providing web application services, including:
多个宿主机;Multiple hosts;
每个所述宿主机上运行一个或多个Web容器单元;所述Web容器单元用于处理对于所对应的Web应用的访问请求。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.
可选地,所述的***还包括:Optionally, the system further includes:
接入模块,用于当收到用户对于网页Web应用的访问请求后,从所述Web应用对应的Web容器单元中选择一个Web容器单元;根据所选择的Web容器单元所在的宿主机的地址,以及所选择的Web容器单元在该宿主机上绑定的端口,转发所述访问请求。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.
可选地,所述宿主机为虚拟机。Optionally, the host machine is a virtual machine.
可选地,当一个宿主机上运行多个Web容器单元时,所述多个Web容器单元对应于不同的Web应用。Optionally, when a plurality of web container units are run on one host, the plurality of web container units correspond to different web applications.
可选地,所述的***还包括:Optionally, the system further includes:
网络附属存储装置,用于将各Web应用的数据分别保存在该Web应用对应的目录中;其中,各Web应用对应的目录分别作为该Web应用对应的Web容器单元的存储目录。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.
可选地,所述的***还包括:Optionally, the system further includes:
监控模块,用于分别通过各宿主机中的监控代理获取该宿主机中运行的Web容器单元的监控数据,通过所述接入模块获得对于各Web容器单元的监控数据;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;
弹性调度模块,用于根据各Web容器单元的监控数据,调整Web应用所对应的Web容器单元的数量。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.
可选地,所述监控数据包括Web容器单元的以下一项或多项参数:Optionally, the monitoring data includes one or more of the following parameters of the web container unit:
中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。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.
可选地,所述弹性调度模块根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量包括以下至少一项:Optionally, 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:
所述弹性调度模块当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,从剩余资源能够创建至少一个Web容器的宿主机中确定一个宿主机,指示所确定的宿主机上的容器代理在该宿主机上创建该Web应用对应的Web容器单元;When the monitoring data of the web container unit corresponding to the web application meets the expansion condition, 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;
所述弹性调度模块当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,从该Web应用对应的Web容器单元中确定一个Web容器单元,指示所确定的Web容器单元所在的宿主机上的容器代理删除该宿主机上该Web应用对应的Web容器单元。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.
本申请包括以下优点:This application includes the following advantages:
本申请至少一个实施例为每个Web应用配备多个Web容器单元提供服务,可以实现Web服务器进程间资源控制和隔离,相互不影响,从而提高Web应用服务的可靠性。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.
本申请实施例的一种实现方式中,一个Web应用对应的多个Web容器单元分布在不同宿主机上,可以避免单点故障。In an implementation manner of the embodiment of the present application, multiple web container units corresponding to one web application are distributed on different hosts, so that a single point of failure can be avoided.
本申请实施例的一种实现方式中,对Web容器单元的使用情况进行监控,根据监控数据自动增加或减少Web容器单元的数量,从而提高资源利用率。In an implementation manner of the embodiment of the present 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.
本申请实施例的一种实现方式中,利用网络附属存储(Network Attached Storage, NAS)技术提供的存储空间和性能扩展能力,可以保证用户数据的高可用性,避免了存储磁盘空间有限制的问题,且无需迁移。In an implementation manner of the embodiment of the present application, 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.
当然,实施本申请的任一产品并不一定需要同时达到以上所述的所有优点。Of course, implementing any of the products of the present application does not necessarily require all of the advantages described above to be achieved at the same time.
附图说明DRAWINGS
图1是实施例一的提供网页应用服务的方法的流程图;1 is a flowchart of a method for providing a webpage application service according to Embodiment 1;
图2是实施例二的提供网页应用服务的方法的流程图;2 is a flowchart of a method for providing a webpage application service according to Embodiment 2;
图3是实施例三的提供网页应用服务的装置的示意图;3 is a schematic diagram of an apparatus for providing a webpage application service according to Embodiment 3;
图4是实施例四的提供网页应用服务的装置的示意图;4 is a schematic diagram of an apparatus for providing a webpage application service according to Embodiment 4;
图5是实施例七的例子中的***示意图;Figure 5 is a schematic diagram of the system in the example of the seventh embodiment;
图6是实施例七的例子中应用管理员的操作示意图。Fig. 6 is a schematic diagram showing the operation of the application manager in the example of the seventh embodiment.
具体实施方式detailed description
下面将结合附图及实施例对本申请的技术方案进行更详细的说明。The technical solutions of the present application will be described in more detail below with reference to the accompanying drawings and embodiments.
需要说明的是,如果不冲突,本申请实施例以及实施例中的各个特征可以相互结合,均在本申请的保护范围之内。另外,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。It should be noted that, if there is no conflict, the features in the embodiments and the embodiments in the present application may be combined with each other, and are all within the protection scope of the present application. Additionally, although logical sequences are shown in the flowcharts, in some cases the steps shown or described may be performed in a different order than the ones described herein.
在一种配置中,提供网页应用服务的计算设备可包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存(memory)。In one configuration, a computing device providing a web application service can include one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。内存可能包括模块1,模块2,……,模块N(N为大于2的整数)。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. 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).
计算机可读介质包括永久性和非永久性、可移动和非可移动存储介质,可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM),快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括非暂存电脑可读媒体 (transitory media),如调制的数据信号和载波。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, as defined herein, does not include non-transitory computer readable media, such as modulated data signals and carrier waves.
首先,对本文中的以下概念进行说明:First, explain the following concepts in this article:
(1)Web应用(App):是一种可以通过Web访问的应用程序。用户只需要有浏览器即可,不需要再安装其他软件。(1) Web application (App): An application that can be accessed through the Web. Users only need to have a browser, no need to install other software.
(2)Web容器单元:已分配资源(如CPU、内存等)的容器服务进程,用于处理用户对于Web应用的访问请求;可以但不限于采用LXC,Docker等容器技术创建;一个Web容器单元可视为Web容器的一个实例。(2) 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.
一个Web应用对应于一个或多个Web容器单元,即:该一个或多个Web容器单元为该Web应用处理访问请求。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.
实施例一、一种提供网页应用服务的方法,如图1所示,包括步骤S110~S120:Embodiment 1 A method for providing a webpage application service, as shown in FIG. 1, includes steps S110-S120:
S110、当收到对于网页Web应用的访问请求后,从所述Web应用对应的Web容器单元中选择一个Web容器单元;其中,所述Web容器单元用于处理接收到的访问请求;S110, after receiving an access request for a webpage web application, selecting 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;
S120、将所述访问请求转发给所选择的Web容器单元。S120. Forward the access request to the selected web container unit.
本实施例中,每个Web应用可以配备多个Web容器单元提供服务,从而可以实现In this embodiment, each web application can be provided with multiple web container units to provide services, thereby achieving
Web服务器进程间资源控制和隔离,相互不影响,提高Web应用服务的可靠性。Web server process control and isolation between processes does not affect each other, improving the reliability of Web application services.
本实施例中,当一个Web应用对应多个Web容器单元时,在转发对于该Web应用的访问请求时,可以依据预定的负载均衡策略从多个Web容器单元中进行选择。In this embodiment, 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.
本实施例中,各Web容器单元可以是标准规格的,即:分配给每个Web容器单元的资源(型号、大小等)可以是相同的。In this embodiment, 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.
本实施例中,可以通过一个与各宿主机相连的Web服务的接入模块来执行步骤S110~S120。In this embodiment, steps S110-S120 may be performed by an access module of a web service connected to each host.
一种实现方式中,所述将访问请求转发给所选择的Web容器单元可以包括:In an implementation manner, the forwarding the access request to the selected web container unit may include:
根据所选择的Web容器单元所在的宿主机的地址,以及所选择的Web容器单元在该宿主机上绑定的端口,转发所述访问请求。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.
本实现方式中,一个宿主机上可以运行一个或多个Web容器单元,Web容器单元可以绑定所在宿主机上的一个端口。当宿主机上运行多个Web容器单元时,各Web容器单元可以绑定不同端口。In this implementation, 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. When multiple web container units are running on the host, each web container unit can be bound to a different port.
本实现方式中,可以预先保存各Web应用的域名,到所对应的各Web容器单元所在宿主机的地址和绑定的端口的路由规则,比如Web应用X对应两个Web容器X1和X2,其中X1所在宿主机的地址为Add1,绑定的端口为PORT1,X2所在宿主机的地址 为Add2,绑定的端口为PORT2;假设Web应用X的域名为XDN,则对于Web应用X可以保存两条路由规则:In this implementation manner, 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:
XDN→(Add1,PORT1)XDN→(Add1,PORT1)
XDN→(Add2,PORT2)XDN→(Add2, PORT2)
步骤S110中选择一个Web容器单元,可以看成是选择采用包含Web应用的域名的一个路由规则。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.
本实现方式中,所述地址可以但不限于为IP地址。In this implementation manner, the address may be, but is not limited to, an IP address.
其它实现方式中,也可以采用其它方式转发,比如保存Web应用的标识和Web容器单元的访问路径之间的对应关系,根据所选择的Web容器单元的访问路径进行访问请求的转发。In other implementation manners, 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.
一种实现方式中,所述宿主机可以但不限于为虚拟机。其它实现方式中,宿主机也可以采用实际硬件来实现,比如每个宿主机是一个真实服务器。In one implementation, the host may be, but is not limited to, a virtual machine. In other implementations, the host machine can also be implemented using actual hardware, such as each host machine being a real server.
一种实现方式中,当一个Web应用对应于多个Web容器单元时,所述多个Web容器单元可以运行在不同的宿主机上。In one implementation, when a web application corresponds to a plurality of web container units, the plurality of web container units can run on different hosts.
即:对于任一个宿主机,如果运行了多个Web容器单元,则这多个Web容器单元对应于不同的Web应用。或者说,一个宿主机上对应于一个Web应用的Web容器单元最多只有一个。That is, for any host, if multiple web container units are running, the multiple web container units correspond to different web applications. In other words, there is at most one Web container unit on a host corresponding to a web application.
这样相当于一个Web应用对应的Web容器单元分布在不同的宿主机上,可以防止宿主机故障时造成Web应用性能大幅度下降。This is equivalent to the web container unit corresponding to a web application distributed on different hosts, which can prevent the performance of the web application from degrading greatly when the host fails.
其它实现方式中,一个Web应用对应的多个Web容器单元也可以随意分布在宿主机中;或者,规定一个宿主机上对应于某个Web应用的Web容器单元的上限,比如2个。In other implementation manners, 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.
一种实现方式中,对应于同一个Web应用的Web容器单元,在NAS装置中该Web应用对应的目录中进行数据存储。In one implementation, the web container unit corresponding to the same web application stores data in a directory corresponding to the web application in the NAS device.
本实现方式中,相当于同一个Web应用对应的Web容器单元都是在同一个存储目录中进行读和/或写,因此无需数据同步;由于NAS装置能够提供足够的存储空间,避免了存储磁盘空间有限制的问题,且无需迁移。In this implementation manner, 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.
本实现方式中,可以在NAS装置中为每个Web应用设置一个存储目录,创建一个Web容器单元后,挂载NAS装置中对应的Web应用的存储目录到容器存储目录;如果删除一个Web容器单元,则删除容器存储目录中挂载的Web应用的存储目录。In this implementation manner, 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.
本实现方式中,NAS装置可以但不限于为云存储模块,或称为云磁盘。In this implementation manner, the NAS device may be, but is not limited to, a cloud storage module, or a cloud disk.
其它实现方式中,也可以采用***本地的磁盘或其它的外部存储设备进行存储。In other implementations, the system local disk or other external storage device may also be used for storage.
一种实现方式中,所述的方法还可以包括:In an implementation manner, the method may further include:
获取各网页Web应用对应的Web容器单元的监控数据;Obtaining monitoring data of a web container unit corresponding to each webpage web application;
根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。Adjust the number of web container units corresponding to the web application according to the acquired monitoring data.
本实现方式中,可以实时获取监控数据,也可以周期性获取监控数据。可以实时监视监控数据,一旦监控数据满足预定条件就立即调整Web容器单元的数量;也可以周期性根据监控数据判断是否需要调整,需要则相应调整Web容器单元的数量。In this implementation manner, 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.
本实现方式中,获取监控数据可以是指采集监控数据的过程,也可以是指接收或读取已经采集好的监控数据的过程。In this implementation manner, acquiring the monitoring data may refer to a process of collecting monitoring data, or a process of receiving or reading the collected monitoring data.
本实现方式中,可以预先设置Web应用所对应的Web容器单元的数量的上下限,比如最少1个,最多5个,在调整时不得超过上限或低于下限。In this implementation manner, 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.
其它实现方式中,可以由用户自行设置Web应用所对应的Web容器单元的数量;或者可以由用户设置是否自动根据监控数据调整Web容器单元的数量。In other implementation manners, 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.
本实现方式中,所述监控数据可以包括Web容器单元的以下一项或多项参数:In this implementation manner, the monitoring data may include one or more of the following parameters of the web container unit:
CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数(即单位时间内发送给Web容器单元的访问请求的数量)、处理时间超过预设阈值的访问请求(后文称为慢请求)的数量。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).
其中,CPU的使用率是指Web容器单元所使用的CPU资源,在分配给该Web容器单元的CPU资源中所占的比例;内存的使用率是指Web容器单元所使用的内存资源,在分配给该Web容器单元的内存资源中所占的比例。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.
其中,CPU的使用率和内存的使用率可以通过各宿主机中的监控代理采集,监控代理用于采集所在宿主机中运行的各Web容器单元的监控数据。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.
其中,CPU的使用率和内存的使用率可以是实时采集,也可以周期性采集,或者实时监控,然后将周期中平均或最高的使用率作为监控数据。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.
当CPU、内存的使用率较高,或单位时间内访问请求的最大并发数较大,或慢请求数较多,则说明该Web容器单元负载较大,也就说明该Web容器单元对应的Web应用的处理能力不足,需要补充Web容器单元。当CPU、内存的使用率较低,或单位时间内 访问请求的最大并发数较小,或慢请求数较少,则说明该Web容器单元负载较小,也就说明该Web容器单元对应的Web应用的处理能力过剩,部分资源存在浪费,可以减少Web容器单元。When the usage rate of the CPU and the memory is high, or the maximum number of concurrent access requests per unit time is large, or the number of slow requests is large, 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. When 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.
本实现方式中,所述根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量可以包括以下至少一项:In this implementation manner, 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:
当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,增加该Web应用对应的Web容器单元的数量;When the monitoring data of the web container unit corresponding to the web application meets the expansion condition, the number of the web container unit corresponding to the web application is increased;
当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,减少该Web应用对应的Web容器单元的数量。When the monitoring data of the web container unit corresponding to a web application satisfies the contraction condition, the number of web container units corresponding to the web application is reduced.
其中,扩容条件可以但不限于是监控数据中的一项或多项达到扩容阈值;缩容条件可以但不限于监控数据中的一项或多项达到缩容阈值。对于不同Web应用所对应的Web容器单元,可以采用不同的扩容阈值和缩容阈值。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. For the web container unit corresponding to different web applications, different expansion thresholds and reduction thresholds can be adopted.
其中,当一个Web应用对应多个Web容器时,如果采用负载均衡策略转发访问请求,则各Web容器的监控数据应该相差不大,可以设置成当一个Web应用对应的任一个Web容器满足扩容/缩容条件时,就增加/减少该Web应用对应的Web容器单元的数量。当然,也可以设置成,当一个Web应用对应的全部Web容器,或预定数量的Web容器的监控数据都满足扩容/缩容条件时,才增加/减少该Web应用对应的Web容器单元的数量。When a web application corresponds to multiple web containers, if the load balancing policy is used to forward the access request, 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. When the condition is reduced, the number of web container units corresponding to the web application is increased/decreased. Of course, 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.
其中,所述增加该Web应用对应的Web容器单元的数量可以包括:The increasing the number of web container units corresponding to the web application may include:
从剩余资源能够创建至少一个Web容器的宿主机中确定一个宿主机,指示所确定的宿主机创建该Web应用对应的Web容器单元。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.
其中,在预先保存各Web应用的域名,到所对应的各Web容器单元所在宿主机的地址和绑定的端口的路由规则的情况下,创建Web容器单元后,还要增加该Web容器单元对应的Web应用的域名,到所确定的宿主机的地址、以及所创建的Web容器单元在该宿主机上绑定的端口的路由规则。In the case where the domain name of each web application is pre-stored, and the address of the host device of the corresponding web container unit and the routing rule of the bound port are created, after the web container unit is created, the web container unit is also added. The domain name of the web application, the address of the determined host, and the routing rules of the port to which the created web container unit is bound on the host.
其中,所述减少该Web应用对应的Web容器单元的数量可以包括:The reducing the number of web container units corresponding to the web application may include:
从该Web应用对应的Web容器单元中确定一个Web容器单元,指示所确定的Web容器单元所在的宿主机删除该Web应用对应的Web容器单元。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.
其中,在预先保存各Web应用的域名,到所对应的各Web容器单元所在宿主机的地址和绑定的端口的路由规则的情况下,删除Web容器单元后,还要删除该Web容器 单元对应的Web应用的域名,到所确定的宿主机的地址、以及所创建的Web容器单元在该宿主机上绑定的端口的路由规则。In the case where the domain name of each web application is pre-stored, and the address of the host device and the bound port of each web container unit are deleted in advance, the web container unit is deleted, and the web container unit is deleted. The domain name of the web application, the address of the determined host, and the routing rules of the port to which the created web container unit is bound on the host.
其中,可以通过宿主机上的容器代理来创建或删除Web容器单元。Among them, the web container unit can be created or deleted through the container proxy on the host machine.
实施例二、一种提供网页应用服务的方法,如图2所示,包括步骤S210~S220:Embodiment 2 A method for providing a webpage application service, as shown in FIG. 2, includes steps S210-S220:
S210、获取各Web应用对应的Web容器单元的监控数据;其中,一个Web应用对应一个或多个Web容器单元,所述Web容器单元用于处理对于所对应的Web应用的访问请求;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;
S220、根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。S220. Adjust the number of web container units corresponding to the web application according to the acquired monitoring data.
本实施例中,对Web容器单元的使用情况进行监控,根据监控数据自动增加或减少Web容器单元的数量,从而提高资源利用率。In this embodiment, 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.
本实施例中,各Web应用对应的Web容器单元的存储目录可以分别是网络附属存储装置中,该Web应用对应的目录。In this embodiment, 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.
本实施例中,一个Web应用可以对应一个或多个Web容器单元;当一个Web应用对应于多个Web容器单元时,所述多个Web容器单元可以运行在不同的宿主机上。一个宿主机上可以运行一个或多个Web容器单元,各Web容器单元绑定所在宿主机上的一个端口,同一个宿主机上,不同Web容器单元所绑定的端口不同。In this embodiment, 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.
一种实现方式中,所述监控数据可以包括Web容器单元的以下一项或多项参数:In one implementation, the monitoring data may include one or more of the following parameters of the web container unit:
中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。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.
一种实现方式中,所述根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量可以包括以下至少一项:In an implementation manner, 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:
当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,增加该Web应用对应的Web容器单元的数量;When the monitoring data of the web container unit corresponding to the web application meets the expansion condition, the number of the web container unit corresponding to the web application is increased;
当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,减少该Web应用对应的Web容器单元的数量。When the monitoring data of the web container unit corresponding to a web application satisfies the contraction condition, the number of web container units corresponding to the web application is reduced.
其中,所述增加该Web应用对应的Web容器单元的数量可以包括:The increasing the number of web container units corresponding to the web application may include:
从剩余资源能够创建至少一个Web容器的宿主机中确定一个宿主机,指示所确定的宿主机创建该Web应用对应的Web容器单元。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.
其中,所述减少该Web应用对应的Web容器单元的数量可以包括:The reducing the number of web container units corresponding to the web application may include:
从该Web应用对应的Web容器单元中确定一个Web容器单元,指示所确定的Web容器单元所在的宿主机删除该Web应用对应的Web容器单元。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.
本实施例中的其它实现细节可以参考实施例一。For other implementation details in this embodiment, reference may be made to Embodiment 1.
实施例三、一种提供网页应用服务的装置,如图3所示,包括:Embodiment 3: A device for providing a webpage application service, as shown in FIG. 3, includes:
选择模块31,用于当收到用户对于Web应用的访问请求后,从所述Web应用对应的Web容器单元中选择一个Web容器单元;其中,所述Web容器单元用于处理接收到的访问请求;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 ;
转发模块32,用于将所述访问请求转发给所选择的Web容器单元。The forwarding module 32 is configured to forward the access request to the selected web container unit.
本实施例中,选择模块31是上述装置中负责选择Web容器单元的部分,可以是软件、硬件或两者的结合。In this embodiment, 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.
本实施例中,转发模块32是上述装置中负责转发访问请求的部分,可以是软件、硬件或两者的结合。In this embodiment, 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.
一种实现方式中,所述转发模块将访问请求转发给所选择的Web容器单元可以包括:In an implementation manner, the forwarding module forwarding the access request to the selected web container unit may include:
所述转发模块根据所选择的Web容器单元所在的宿主机的地址,以及所选择的Web容器单元在该宿主机上绑定的端口,转发所述访问请求。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.
其中,所述宿主机可以但不限于是虚拟机。Wherein, the host machine can be, but is not limited to, a virtual machine.
一种实现方式中,当一个Web应用对应于多个Web容器单元时,所述多个Web容器单元可以运行在不同的宿主机上。In one implementation, when a web application corresponds to a plurality of web container units, the plurality of web container units can run on different hosts.
一种实现方式中,各Web应用对应的Web容器单元的存储目录可以分别是网络附属存储装置中,该Web应用对应的目录。In an implementation manner, 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.
一种实现方式中,所述的装置还可以包括:In an implementation manner, the device may further include:
获取模块,用于获取各网页Web应用对应的Web容器单元的监控数据;An obtaining module, configured to acquire monitoring data of a web container unit corresponding to each webpage web application;
调整模块,用于根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。The adjustment module is configured to adjust the number of web container units corresponding to the web application according to the acquired monitoring data.
本实现方式中,所述监控数据可以包括Web容器单元的以下一项或多项参数:In this implementation manner, the monitoring data may include one or more of the following parameters of the web container unit:
中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。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.
本实现方式中,所述调整模块根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量可以包括以下至少一项:In this implementation manner, 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:
当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,所述调整模块增加该Web应用对应的Web容器单元的数量;When the monitoring data of the web container unit corresponding to the web application meets the expansion condition, the adjustment module increases the number of the web container unit corresponding to the web application;
当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,所述调整模块减少该Web应用对应的Web容器单元的数量。When the monitoring data of the web container unit corresponding to the web application satisfies the contraction condition, the adjustment module reduces the number of web container units corresponding to the web application.
本实施例的装置的各模块的操作分别对应于实施例一中的步骤S110~S120,各模块操作的其它实现细节可参见实施例一。The operations of the modules of the device in this embodiment are respectively corresponding to the steps S110 to S120 in the first embodiment. For the other implementation details of the operation of each module, refer to the first embodiment.
实施例四、一种提供网页应用服务的装置,如图4所示,包括:Embodiment 4: A device for providing a webpage application service, as shown in FIG. 4, includes:
获取模块41,用于获取各网页Web应用对应的Web容器单元的监控数据;其中,一个Web应用对应一个或多个Web容器单元,所述Web容器单元用于处理对于所对应的Web应用的访问请求;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;
调整模块42,用于根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。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.
本实施例中,获取模块41是上述装置中负责获取监控数据的部分,可以是软件、硬件或两者的结合。In this embodiment, 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.
本实施例中,调整模块42是上述装置中负责调整Web容器单元的数量的部分,可以是软件、硬件或两者的结合。In this embodiment, 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.
一种实现方式中,所述监控数据可以包括Web容器单元的以下一项或多项参数:In one implementation, the monitoring data may include one or more of the following parameters of the web container unit:
中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。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.
一种实现方式中,所述调整模块根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量可以包括以下至少一项:In an implementation manner, 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:
当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,所述调整模块增加该Web应用对应的Web容器单元的数量;When the monitoring data of the web container unit corresponding to the web application meets the expansion condition, the adjustment module increases the number of the web container unit corresponding to the web application;
当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,所述调整模块减少该Web应用对应的Web容器单元的数量。When the monitoring data of the web container unit corresponding to the web application satisfies the contraction condition, the adjustment module reduces the number of web container units corresponding to the web application.
本实现方式中,所述调整模块增加该Web应用对应的Web容器单元的数量可以包括:In this implementation manner, the adjusting module increases the number of web container units corresponding to the web application, and the method includes:
所述调整模块从剩余资源能够创建至少一个Web容器的宿主机中确定一个宿主机,指示所确定的宿主机创建该Web应用对应的Web容器单元。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.
本实现方式中,所述调整模块减少该Web应用对应的Web容器单元的数量可以包 括:In this implementation manner, the adjusting module reduces the number of web container units corresponding to the web application, and the method includes:
所述调整模块从该Web应用对应的Web容器单元中确定一个Web容器单元,指示所确定的Web容器单元所在的宿主机删除该Web应用对应的Web容器单元。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.
本实施例的装置的各模块的操作分别对应于实施例二中的步骤S210~S220,各模块操作的其它实现细节可参见实施例二。The operations of the modules of the device in this embodiment are respectively corresponding to the steps S210 to S220 in the second embodiment. For the other implementation details of the operation of each module, refer to the second embodiment.
实施例五、一种提供网页应用服务的电子设备,包括:第一存储器和第一处理器;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:
当收到用户对于网页Web应用的访问请求后,从所述Web应用对应的Web容器单元中选择一个Web容器单元;其中,所述Web容器单元用于处理接收到的访问请求;After receiving the user's access request for the webpage web application, selecting 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;
将所述访问请求转发给所选择的Web容器单元。Forwarding the access request to the selected web container unit.
本实施例中,用于提供网页应用服务的程序在被第一处理器读取执行时,所执行的操作对应于实施例一中的步骤S110~S120;该程序所执行的操作的其它细节可参见实施例一。In this embodiment, when the program for providing the webpage application service is read and executed by the first processor, 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:
获取各网页Web应用对应的Web容器单元的监控数据;其中,一个Web应用对应一个或多个Web容器单元,所述Web容器单元用于处理对于所对应的Web应用的访问请求;Obtaining 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;
根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。Adjust the number of web container units corresponding to the web application according to the acquired monitoring data.
本实施例中,用于提供网页应用服务的程序在被第二处理器读取执行时,所执行的操作对应于实施例二中的步骤S210~S220;该程序所执行的操作的其它细节可参见实施例二。In this embodiment, when the program for providing the webpage application service is read and executed by the second processor, 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:
多个宿主机;Multiple hosts;
每个所述宿主机上运行一个或多个Web容器单元;所述Web容器单元用于处理对于所对应的Web应用的访问请求。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.
一种实现方式中,所述的***还可以包括:In an implementation manner, the system may further include:
接入模块,用于当收到用户对于网页Web应用的访问请求后,从所述Web应用对 应的Web容器单元中选择一个Web容器单元;根据所选择的Web容器单元所在的宿主机的地址,以及所选择的Web容器单元在该宿主机上绑定的端口,转发所述访问请求。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.
一种实现方式中,所述宿主机可以为虚拟机。In an implementation manner, the host machine may be a virtual machine.
一种实现方式中,当一个宿主机上运行多个Web容器单元时,所述多个Web容器单元可以对应于不同的Web应用。In one implementation, when multiple web container units are running on one host, the plurality of web container units may correspond to different web applications.
一种实现方式中,所述的***还可以包括:In an implementation manner, the system may further include:
网络附属存储装置,用于将各Web应用的数据分别保存在该Web应用对应的目录中;其中,各Web应用对应的目录分别作为该Web应用对应的Web容器单元的存储目录。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.
一种实现方式中,所述的***还可以包括:In an implementation manner, the system may further include:
监控模块,用于分别通过各宿主机中的监控代理采集该宿主机中运行的Web容器单元的监控数据,通过所述接入模块获得对于各Web容器单元的监控数据;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;
弹性调度模块,用于根据各Web容器单元的监控数据,调整Web应用所对应的Web容器单元的数量。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.
本实现方式中,所述监控数据可以包括Web容器单元的以下一项或多项参数:In this implementation manner, the monitoring data may include one or more of the following parameters of the web container unit:
中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。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.
本实现方式中,所述弹性调度模块根据所采集的监控数据,调整Web应用所对应的Web容器单元的数量可以包括以下至少一项:In this implementation manner, 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:
所述弹性调度模块当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,从剩余资源能够创建至少一个Web容器的宿主机中确定一个宿主机,指示所确定的宿主机上的容器代理在该宿主机上创建该Web应用对应的Web容器单元;When the monitoring data of the web container unit corresponding to the web application meets the expansion condition, 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;
所述弹性调度模块当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,从该Web应用对应的Web容器单元中确定一个Web容器单元,指示所确定的Web容器单元所在的宿主机上的容器代理删除该宿主机上该Web应用对应的Web容器单元。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. For other implementation details, refer to Embodiment 1.
下面用一个例子说明本实施例的***。本例子中,每个Web应用有全局唯一的标识APP_ID,以及全局唯一的域名:APP_DOMAIN_NAME;用户通过域名即可访问相应的Web应用。The system of this embodiment will be described below using an example. In this example, 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.
本例子中,分配给每个Web容器单元的资源(型号、大小等)可以是相同的,即 Web容器单元是标准规格的。每个Web容器单元有全局唯一的标识:CONTAINER_ID。每个Web容器单元在作为本Web容器单元宿主机的VM上至少绑定一个端口:CONTAINER_PORT;Web容器单元具体绑定VM的哪个端口可以自行设置。也就是说,Web容器单元内部运行独立的Web服务进程(如apache、nginx、tomcat等)并绑定独立端口(即CONTAINER_PORT,在VM上唯一)。In this example, the resources (model, size, etc.) assigned to 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).
本例子中,伸缩阈值是判断Web容器单元中的资源是否需要进行调整时的依据,包括扩容阈值和缩容阈值。用户可以为不同的Web应用定义不同的伸缩阈值。In this example, 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.
本例子中,以VM作为运行Web容器单元的宿主机,具有一定计算资源CPU和存储资源(内存,磁盘)。每个VM上可以运行一个或多个Web容器单元,具体数量和VM本身的资源以及为Web容器单元分配的资源有关。本例子中,对于一个Web应用,一个VM上只能有一个对应的Web容器单元。每台VM具有全局唯一的标识VM_ID,和内网IP地址:VM_INNER_IP。In this example, 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. In this example, for a web application, there can only be one corresponding web container unit on a VM. Each VM has a globally unique identifier VM_ID and an intranet IP address: VM_INNER_IP.
本例子中,运行本实施例的方法的***如图5所示,可以包括:In this example, the system running the method of this embodiment is as shown in FIG. 5, and may include:
Web服务的接入模块、弹性调度模块、监控模块、资源模块;Access module, flexible scheduling module, monitoring module, and resource module of the web service;
一个或多个虚拟机,比如图5中的虚拟机1、虚拟机2……;每个虚拟机中分别包括以下组件:One or more virtual machines, such as virtual machine 1, virtual machine 2, and so on in Figure 5; each virtual machine includes the following components:
容器代理(Container Agent):用于从弹性调度模块接收扩容指令和缩容指令,并相应启动或停止Web容器单元;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;
监控代理(Moniter Agent):统计Web容器单元提供的各项资源(本例子中至少包括CPU和内存)的使用率并作为监控数据发送到监控模块。Moniter Agent: 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.
每个虚拟机中运行一个或多个Web容器单元,比如图5中虚拟机1中运行两个Web容器单元,分别对应于Web应用1和Web应用2;虚拟机2中运行两个Web容器单元,分别对应于Web应用1和Web应用3。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.
本例中,每个Web容器单元采用apache提供Web服务进程。In this example, each web container unit uses apache to provide a web service process.
Web服务的接入模块用于在收到对于Web应用的访问请求后,根据所访问的Web应用的域名,在Web应用对应的多个Web容器单元中,根据预先配置的负载均衡策略选择一个路由规则转发所述访问请求;周期性统计各Web容器单元在单位时间内的最大并发数和慢请求数,作为监控数据上报给监控模块。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.
监控模块用于从Web服务的接入模块和监控代理接收监控数据,并将监控数据按照Web应用进行存储,即,将对应于同一个Web应用的Web容器单元的监控数据汇总后 保存为该Web应用的监控数据。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.
弹性调度模块用于从监控模块遍历每个Web应用的监控数据,并根据预定的弹性伸缩策略,对相应VM的容器代理发送扩容或缩容指令;还可以为WEB服务接入模块配置路由规则。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.
资源模块用于保存各VM的资源信息(比如剩余资源多少、运行几个Web容器单元等),以及各Web应用对应的Web容器单元的信息(比如对应的Web应用、所在VM、绑定的端口等),本例子中,分别以VM资源信息表和Web容器单元信息表的形式保存。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.
本例子中,所述***还可以包括采用NAS技术的云存储模块(或称为云磁盘),用于提供更大的空间存储能力和性能扩展能力。In this example, the system may further include a cloud storage module (or cloud disk) adopting NAS technology for providing greater space storage capacity and performance expansion capability.
本例子中,弹性伸缩策略可以是依据Web容器单元在单位时间内的资源使用率,并发数,慢请求数(包含不限于以上3类资源)等判断是否满足扩容阈值或缩容阈值,从而决定如何执行伸缩策略:In this example, 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:
CPU使用率>90%;CPU usage >90%;
内存(memory)使用率>90%;Memory usage >90%;
并发数>1000;Concurrent number >1000;
慢请求数>100。The number of slow requests is >100.
缩容阈值可以是满足以下任一项:The shrinkage threshold can be any of the following:
CPU使用率<30%;CPU usage <30%;
内存(memory)使用率<30%;Memory usage <30%;
并发数<100;Concurrent number <100;
慢请求数<10。The number of slow requests is <10.
本例子中,弹性调度模块可以定时检查每个Web应用对应的Web容器单元,判断Web容器单元对于资源的使用是否达到扩容阈值或缩容,并相应进行扩容或缩容流程。In this example, 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.
扩容流程:如果某个Web容器单元的资源使用情况达到扩容阈值则从资源模块申请容器资源,得到新的Web容器单元,为该Web容器单元分配VM的IP地址和端口(Port),然后调用所分配的VM上的Container Agent启动新的Web容器单元,同时挂载云存储模块中相应Web应用的存储目录到容器存储目录,然后在Web服务接入模块增加新的路由规则,新的路由规则是将相应Web应用的域名路由到新的Web容器单元所在VM的IP地址和Port。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.
本例子中,扩容指令的发送流程包括:In this example, the sending process of the expansion instruction includes:
从VM资源池中,确定一个具有创建新Web容器单元所需的空闲资源的VM;对所找到的VM上的Container Agent发送扩容指令,所述扩容指令用于指示创建指定的应用的Web容器单元。其中,可以根据所确定VM的VM_ID找到对应的VM_INNER_IP,向该VM_INNER_IP发送扩容指令。From the VM resource pool, determine a VM having an idle resource required to create a new web container unit; send a expansion instruction to the Container Agent on the found VM, the expansion instruction is used to indicate that the web container unit of the specified application is created . The 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.
扩容成功后将此Web容器单元的CONTAINER_ID和VM_ID的对应关系存入资源模块。After the expansion is successful, the correspondence between the CONTAINER_ID and the VM_ID of the Web container unit is stored in the resource module.
缩容流程:如果某个Web容器单元达到缩容阈值,则先从Web服务接入模块删除将对应Web应用的域名路由到该Web容器单元所在VM的IP地址和端口的路由规则(对于该Web应用的新的访问请求将不会再路由到此Web容器单元),然后轮询判断此Web容器单元中没有运行中的php进程后,停止Web容器单元,释放相关资源,同时卸载该Web容器单元的容器存储目录所挂载的Web应用的存储目录。最后向资源模块归还分配给此Web容器单元的VM的IP地址和端口。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.
本例子中,缩容指令的发送流程包括:In this example, the sending process of the contraction instruction includes:
确定达到缩容阈值的Web容器单元,对该Web容器单元所在VM的Container Agent发送缩容指令。其中,可以根据所确定的Web容器单元的CONTAINER_ID找到对应的VM_ID,根据该VM_ID找到对应的VM_INNER_IP,向该VM_INNER_IP发送缩容指令。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.
缩容成功后在资源模块里删除缩容的Web容器单元的CONTAINER_ID和VM_ID的对应关系。After the shrinking is successful, the correspondence between the CONTAINER_ID and the VM_ID of the indented Web container unit is deleted in the resource module.
本例子的一种应用场景中,应用管理员首先通过文件传输协议(File Transfer Protocol,FTP)的方式,或本例子中的弹性虚拟主机***开放给应用管理员的服务或客户端,完成网站程序上传的过程,然后通过控制台启动网站。应用访问者可以通过浏览器输入Web应用的域名(或点击移动终端上的App)访问相应Web应用提供的各种服务。In an application scenario of the example, 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.
其中,应用管理员一般是网站的所有者,拥有网站程序,如:可以直接运行的源代码(*.php文件)或编译后的文件(*.class、*.jar等文件)。应用访问者一般是网站的浏览者,是可以通过终端等设备访问网络的人。Among them, 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.
如图6所示,应用管理员可以通过Web控制台、移动终端上的App、桌面应用程序等方式对图5所示***进行监控和设置,比如通过弹性策略界面设置弹性策略,比如设 置:As shown in Figure 6, 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. For example, the elastic policy is used to set the elastic policy, such as setting:
全局可分配最大和最小web容器数设置、伸缩阈值、单位时间的大小(如60秒)、单位时间内CPU的使用范围,单位时间内存的使用范围、单Web容器单元单位时间内最大请求并发数阈值、单Web容器单位时间最大慢请求数阈值等。Globally assignable maximum and minimum web container number setting, scaling threshold, unit time size (such as 60 seconds), CPU usage per unit time, memory usage per unit time, maximum request concurrency per unit time in a single Web container unit Threshold, single web container unit time maximum slow request threshold, and so on.
应用管理员还可以配置调度策略,可以但不限于以下3种:The application administrator can also configure the scheduling policy, which can be, but is not limited to, the following three types:
普通模式:可以指定Web应用对应的Web容器单元的固定数量。Normal mode: You can specify a fixed number of web container units corresponding to the web application.
实时调度模式:根据每个Web容器的监控数据,依据预定义配置策略自动进行扩容和缩容,无需人为干预。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.
预约调度模式:使预约配置阈值在预约时间段到达时进行扩容和缩容动作,提高Web服务可靠性。预约时间段以外恢复成默认的Web容器单元的数量。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.
应用管理员还可以根据Web容器监控界面查看各Web容器单元的监控数据。比如但不限于: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:
分配的web容器总数、每个Web容器的监控数据(比如资源使用率,并发数,慢请求数等)。The total number of web containers allocated, monitoring data for each web container (such as resource usage, number of concurrent, slow requests, etc.).
这样便于应用管理员了解Web应用当前实际资源消耗情况,也可以判断Web容器单元是否健康,也便于根据Web容器单元增减时间准确了解网站实际运行情况,为网站运营报告提供数据依据。This makes it easy for the application administrator to understand the actual resource consumption of the Web application. It can also determine whether the Web container unit is healthy. It is also convenient to accurately understand the actual operation of the website according to the increase and decrease time of the Web container unit, and provide data basis for the website operation report.
根据监控数据还可以更深入了解网站运行状况是否正常,如作为攻击事件时间判断依据等。According to the monitoring data, you can further understand whether the website is running normally, such as the basis for judging the attack time.
本应用场景中,当采用实时调度模式时,可以根据网站实际访问量动态扩容或及时缩容后台的Web容器资源,保证网站访问流畅,不需要人为进行操作,在访问量激增时能保证网站服务的高可用性和经济性,在访问量不足时可以收缩Web容器单元的个数以节省开支。In this application scenario, when the real-time scheduling mode is adopted, 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.
本应用场景中,还可以通过预定义的报警策略,使应用管理员能够及时接收网站运行异常状态时的报警消息,便于及时处理突发事件。In this application scenario, 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.
报警策略中可配置属性可以包含:是否启用扩容时报警、是否启用缩容时报警、报警方式(邮件、短信、Web控制台等)、Web容器资源使用报警阈值(CPU范围,内存范围,并发数范围,慢请求数范围)。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).
本领域普通技术人员可以理解上述方法中的全部或部分步骤可通过程序来指令相关 硬件完成,所述程序可以存储于计算机可读存储介质中,如只读存储器、磁盘或光盘等。可选地,上述实施例的全部或部分步骤也可以使用一个或多个集成电路来实现。相应地,上述实施例中的各模块/单元可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。本申请不限制于任何特定形式的硬件和软件的结合。One of ordinary skill in the art will appreciate that all or a portion of the above steps may be accomplished by a program instructing the associated hardware, such as a read-only memory, a magnetic or optical disk, and the like. Alternatively, all or part of the steps of the above embodiments may also be implemented using one or more integrated circuits. Correspondingly, each module/unit in the foregoing embodiment may be implemented in the form of hardware or in the form of a software function module. This application is not limited to any specific combination of hardware and software.
当然,本申请还可有其他多种实施例,在不背离本申请精神及其实质的情况下,熟悉本领域的技术人员当可根据本申请作出各种相应的改变和变形,但这些相应的改变和变形都应属于本申请的权利要求的保护范围。There are a variety of other embodiments that can be made by those skilled in the art, and various corresponding changes and modifications can be made in accordance with the present application without departing from the spirit and scope of the application. Changes and modifications are intended to fall within the scope of the appended claims.

Claims (35)

  1. 一种提供网页应用服务的方法,包括:A method of providing a web application service, comprising:
    当收到用户对于网页Web应用的访问请求后,从所述Web应用对应的Web容器单元中选择一个Web容器单元;其中,所述Web容器单元用于处理接收到的访问请求;After receiving the user's access request for the webpage web application, selecting 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;
    将所述访问请求转发给所选择的Web容器单元。Forwarding the access request to the selected web container unit.
  2. 如权利要求1所述的方法,其特征在于,所述将所述访问请求转发给所选择的Web容器单元包括:The method of claim 1 wherein said forwarding said access request to said selected web container unit comprises:
    根据所选择的Web容器单元所在的宿主机的地址,以及所选择的Web容器单元在该宿主机上绑定的端口,转发所述访问请求。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.
  3. 如权利要求2所述的方法,其特征在于:The method of claim 2 wherein:
    所述宿主机为虚拟机。The host machine is a virtual machine.
  4. 如权利要求2所述的方法,其特征在于:The method of claim 2 wherein:
    当一个Web应用对应于多个Web容器单元时,所述多个Web容器单元运行在不同的宿主机上。When a web application corresponds to a plurality of web container units, the plurality of web container units run on different hosts.
  5. 如权利要求1所述的方法,其特征在于:The method of claim 1 wherein:
    对应于同一个Web应用的Web容器单元,在网络附属存储装置中该Web应用对应的目录中进行数据存储。Corresponding to the web container unit of the same web application, data storage is performed in a directory corresponding to the web application in the network attached storage device.
  6. 如权利要求1~5中任一项所述的方法,其特征在于,还包括:The method of any of claims 1 to 5, further comprising:
    获取各Web应用对应的Web容器单元的监控数据;Obtaining monitoring data of a web container unit corresponding to each web application;
    根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。Adjust the number of web container units corresponding to the web application according to the acquired monitoring data.
  7. 如权利要求6所述的方法,其特征在于,所述监控数据包括Web容器单元的以下一项或多项参数:The method of claim 6 wherein said monitoring data comprises one or more of the following parameters of a web container unit:
    中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。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.
  8. 如权利要求6所述的方法,其特征在于,所述根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量包括以下至少一项:The method according to claim 6, wherein the adjusting the number of web container units corresponding to the web application according to the acquired monitoring data comprises at least one of the following:
    当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,增加该Web应用对应的Web容器单元的数量;When the monitoring data of the web container unit corresponding to the web application meets the expansion condition, the number of the web container unit corresponding to the web application is increased;
    当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,减少该Web应用对应的Web容器单元的数量。When the monitoring data of the web container unit corresponding to a web application satisfies the contraction condition, the number of web container units corresponding to the web application is reduced.
  9. 一种提供网页应用服务的方法,包括:A method of providing a web application service, comprising:
    获取各网页Web应用对应的Web容器单元的监控数据;其中,一个Web应用对应一个或多个Web容器单元,所述Web容器单元用于处理对于所对应的Web应用的访问请求;Obtaining 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;
    根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。Adjust the number of web container units corresponding to the web application according to the acquired monitoring data.
  10. 如权利要求9所述的方法,其特征在于,所述监控数据包括Web容器单元的以下一项或多项参数:The method of claim 9 wherein said monitoring data comprises one or more of the following parameters of a web container unit:
    中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。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.
  11. 如权利要求9所述的方法,其特征在于,所述根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量包括以下至少一项:The method according to claim 9, wherein the adjusting the number of web container units corresponding to the web application according to the acquired monitoring data comprises at least one of the following:
    当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,增加该Web应用对应的Web容器单元的数量;When the monitoring data of the web container unit corresponding to the web application meets the expansion condition, the number of the web container unit corresponding to the web application is increased;
    当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,减少该Web应用对应的Web容器单元的数量。When the monitoring data of the web container unit corresponding to a web application satisfies the contraction condition, the number of web container units corresponding to the web application is reduced.
  12. 如权利要求11所述的方法,其特征在于,所述增加该Web应用对应的Web容器单元的数量包括:The method of claim 11, wherein the increasing the number of web container units corresponding to the web application comprises:
    从剩余资源能够创建至少一个Web容器的宿主机中确定一个宿主机,指示所确定的宿主机创建该Web应用对应的Web容器单元。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.
  13. 如权利要求11所述的方法,其特征在于,所述减少该Web应用对应的Web容器单元的数量包括:The method of claim 11, wherein the reducing the number of web container units corresponding to the web application comprises:
    从该Web应用对应的Web容器单元中确定一个Web容器单元,指示所确定的Web容器单元所在的宿主机删除该Web应用对应的Web容器单元。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.
  14. 一种提供网页应用服务的装置,其特征在于,包括:An apparatus for providing a webpage application service, comprising:
    选择模块,用于当收到用户对于网页Web应用的访问请求后,从所述Web应用对应的Web容器单元中选择一个Web容器单元;其中,所述Web容器单元用于处理接收到的访问请求;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 ;
    转发模块,用于将所述访问请求转发给所选择的Web容器单元。And a forwarding module, configured to forward the access request to the selected web container unit.
  15. 如权利要求14所述的装置,其特征在于,所述转发模块将访问请求转发给所选择的Web容器单元包括:The apparatus according to claim 14, wherein the forwarding module forwarding the access request to the selected web container unit comprises:
    所述转发模块根据所选择的Web容器单元所在的宿主机的地址,以及所选择的Web容器单元在该宿主机上绑定的端口,转发所述访问请求。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.
  16. 如权利要求15所述的装置,其特征在于:The device of claim 15 wherein:
    当一个Web应用对应于多个Web容器单元时,所述多个Web容器单元运行在不同的宿主机上。When a web application corresponds to a plurality of web container units, the plurality of web container units run on different hosts.
  17. 如权利要求15所述的装置,其特征在于:The device of claim 15 wherein:
    各Web应用对应的Web容器单元的存储目录分别是网络附属存储装置中,该Web应用对应的目录。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.
  18. 如权利要求14~17中任一项所述的装置,其特征在于,还包括:The device according to any one of claims 14 to 17, further comprising:
    获取模块,用于获取各网页Web应用对应的Web容器单元的监控数据;An obtaining module, configured to acquire monitoring data of a web container unit corresponding to each webpage web application;
    调整模块,用于根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。The adjustment module is configured to adjust the number of web container units corresponding to the web application according to the acquired monitoring data.
  19. 如权利要求18所述的装置,其特征在于,所述监控数据包括Web容器单元的以下一项或多项参数:The apparatus of claim 18 wherein said monitoring data comprises one or more of the following parameters of a web container unit:
    中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。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.
  20. 如权利要求18所述的装置,其特征在于,所述调整模块根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量包括以下至少一项:The apparatus according to claim 18, wherein the adjustment 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:
    当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,所述调整模块增加该Web应用对应的Web容器单元的数量;When the monitoring data of the web container unit corresponding to the web application meets the expansion condition, the adjustment module increases the number of the web container unit corresponding to the web application;
    当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,所述调整模块减少该Web应用对应的Web容器单元的数量。When the monitoring data of the web container unit corresponding to the web application satisfies the contraction condition, the adjustment module reduces the number of web container units corresponding to the web application.
  21. 一种提供网页应用服务的装置,其特征在于,包括:An apparatus for providing a webpage application service, comprising:
    获取模块,用于获取各网页Web应用对应的Web容器单元的监控数据;其中,一个Web应用对应一个或多个Web容器单元,所述Web容器单元用于处理对于所对应的Web应用的访问请求;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 ;
    调整模块,用于根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。The adjustment module is configured to adjust the number of web container units corresponding to the web application according to the acquired monitoring data.
  22. 如权利要求21所述的装置,其特征在于,所述监控数据包括Web容器单元的以下一项或多项参数:The apparatus of claim 21 wherein said monitoring data comprises one or more of the following parameters of a web container unit:
    中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。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.
  23. 如权利要求21所述的装置,其特征在于,所述调整模块根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量包括以下至少一项:The device according to claim 21, wherein the adjustment 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:
    当一个Web应用对应的Web容器单元的监控数据满足扩容条件时,所述调整模块增加该Web应用对应的Web容器单元的数量;When the monitoring data of the web container unit corresponding to the web application meets the expansion condition, the adjustment module increases the number of the web container unit corresponding to the web application;
    当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,所述调整模块减少该Web应用对应的Web容器单元的数量。When the monitoring data of the web container unit corresponding to the web application satisfies the contraction condition, the adjustment module reduces the number of web container units corresponding to the web application.
  24. 如权利要求23所述的装置,其特征在于,所述调整模块增加该Web应用对应的Web容器单元的数量包括:The device of claim 23, wherein the adjusting module increases the number of web container units corresponding to the web application, including:
    所述调整模块从剩余资源能够创建至少一个Web容器的宿主机中确定一个宿主机,指示所确定的宿主机创建该Web应用对应的Web容器单元。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.
  25. 如权利要求23所述的装置,其特征在于,所述调整模块减少该Web应用对应的Web容器单元的数量包括:The device of claim 23, wherein the adjusting module reduces the number of web container units corresponding to the web application, including:
    所述调整模块从该Web应用对应的Web容器单元中确定一个Web容器单元,指示所确定的Web容器单元所在的宿主机删除该Web应用对应的Web容器单元。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.
  26. 一种提供网页应用服务的电子设备,包括:第一存储器和第一处理器;其特征在于:An electronic device for providing a webpage application service, comprising: a first memory and a first processor; wherein:
    所述第一存储器用于保存用于提供网页应用服务的程序,所述用于提供网页服务的程序在被所述第一处理器读取执行时,执行以下操作: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:
    当收到用户对于网页Web应用的访问请求后,从所述Web应用对应的Web容器单元中选择一个Web容器单元;其中,所述Web容器单元用于处理接收到的访问请求;After receiving the user's access request for the webpage web application, selecting 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;
    将所述访问请求转发给所选择的Web容器单元。Forwarding the access request to the selected web container unit.
  27. 一种提供网页应用服务的电子设备,包括:第二存储器和第二处理器;其特征在于:An electronic device for providing a web application service, comprising: a second memory and a second processor; wherein:
    所述第二存储器用于保存用于提供网页应用服务的程序,所述用于提供网页服务的程序在被所述第二处理器读取执行时,执行以下操作: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:
    获取各网页Web应用对应的Web容器单元的监控数据;其中,一个Web应用对应一个或多个Web容器单元,所述Web容器单元用于处理对于所对应的Web应用的访问请求;Obtaining 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;
    根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量。Adjust the number of web container units corresponding to the web application according to the acquired monitoring data.
  28. 一种提供网页应用服务的***,其特征在于,包括:A system for providing a web application service, comprising:
    多个宿主机;Multiple hosts;
    每个所述宿主机上运行一个或多个Web容器单元;所述Web容器单元用于处理对于所对应的Web应用的访问请求。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.
  29. 如权利要求28所述的***,其特征在于,还包括:The system of claim 28, further comprising:
    接入模块,用于当收到用户对于网页Web应用的访问请求后,从所述Web应用对应的Web容器单元中选择一个Web容器单元;根据所选择的Web容器单元所在的宿主机的地址,以及所选择的Web容器单元在该宿主机上绑定的端口,转发所述访问请求。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.
  30. 如权利要求28所述的***,其特征在于:The system of claim 28 wherein:
    所述宿主机为虚拟机。The host machine is a virtual machine.
  31. 如权利要求28所述的***,其特征在于:The system of claim 28 wherein:
    当一个宿主机上运行多个Web容器单元时,所述多个Web容器单元对应于不同的Web应用。When multiple web container units are running on one host, the plurality of web container units correspond to different web applications.
  32. 如权利要求28所述的***,其特征在于,还包括:The system of claim 28, further comprising:
    网络附属存储装置,用于将各Web应用的数据分别保存在该Web应用对应的目录中;其中,各Web应用对应的目录分别作为该Web应用对应的Web容器单元的存储目录。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.
  33. 如权利要求29所述的***,其特征在于,还包括:The system of claim 29, further comprising:
    监控模块,用于分别通过各宿主机中的监控代理获取该宿主机中运行的Web容器单元的监控数据,通过所述接入模块获得对于各Web容器单元的监控数据;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;
    弹性调度模块,用于根据各Web容器单元的监控数据,调整Web应用所对应的Web容器单元的数量。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.
  34. 如权利要求33所述的***,其特征在于,所述监控数据包括Web容器单元的以下一项或多项参数:The system of claim 33 wherein said monitoring data comprises one or more of the following parameters of a web container unit:
    中央处理器CPU的使用率、内存的使用率、单位时间内访问请求的最大并发数、处理时间超过预设阈值的访问请求的数量。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.
  35. 如权利要求33所述的***,其特征在于,所述弹性调度模块根据所获取的监控数据,调整Web应用所对应的Web容器单元的数量包括以下至少一项:The system of claim 33, wherein 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:
    所述弹性调度模块当一个Web应用对应的Web容器单元的监控数据满足扩容条件 时,从剩余资源能够创建至少一个Web容器的宿主机中确定一个宿主机,指示所确定的宿主机上的容器代理在该宿主机上创建该Web应用对应的Web容器单元;When the monitoring data of the web container unit corresponding to the web application meets the expansion condition, 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;
    所述弹性调度模块当一个Web应用对应的Web容器单元的监控数据满足缩容条件时,从该Web应用对应的Web容器单元中确定一个Web容器单元,指示所确定的Web容器单元所在的宿主机上的容器代理删除该宿主机上该Web应用对应的Web容器单元。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.
PCT/CN2017/117081 2016-12-27 2017-12-19 Web application service providing method, apparatus, electronic device and system WO2018121334A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201611228664.9 2016-12-27
CN201611228664.9A CN108243239A (en) 2016-12-27 2016-12-27 A kind of method, apparatus, electronic equipment and system that web application service is provided

Publications (1)

Publication Number Publication Date
WO2018121334A1 true WO2018121334A1 (en) 2018-07-05

Family

ID=62702845

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/117081 WO2018121334A1 (en) 2016-12-27 2017-12-19 Web application service providing method, apparatus, electronic device and system

Country Status (2)

Country Link
CN (1) CN108243239A (en)
WO (1) WO2018121334A1 (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109981615A (en) * 2019-03-12 2019-07-05 上海纽盾科技股份有限公司 Attack protection system and method based on block chain
CN111367678A (en) * 2020-03-31 2020-07-03 中国工商银行股份有限公司 Cluster resource management method and system
CN111831447A (en) * 2020-07-16 2020-10-27 中国民航信息网络股份有限公司 Application elastic capacity expansion method and device based on performance monitoring
CN112306640A (en) * 2020-11-12 2021-02-02 广州方硅信息技术有限公司 Container dispensing method, apparatus, device and medium therefor
CN112532669A (en) * 2019-09-19 2021-03-19 贵州白山云科技股份有限公司 Network edge computing method, device and medium

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109117149A (en) * 2018-07-13 2019-01-01 下代互联网重大应用技术(北京)工程研究中心有限公司 A kind of behavior analysis system dispositions method and electronic equipment
CN109240799B (en) * 2018-09-06 2022-04-15 福建星瑞格软件有限公司 Disaster tolerance method and system for big data platform cluster and computer readable storage medium
CN109284275B (en) * 2018-09-28 2021-03-09 苏州浪潮智能科技有限公司 Cloud platform virtual machine file system monitoring method and device
CN110888780A (en) * 2019-11-19 2020-03-17 泰康保险集团股份有限公司 Application monitoring method, device, equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104580226A (en) * 2015-01-15 2015-04-29 上海瀚之友信息技术服务有限公司 Session data sharing system and method
CN106201819A (en) * 2016-06-28 2016-12-07 乐视控股(北京)有限公司 The system resource occupancy monitoring method and apparatus of application container engine

Family Cites Families (6)

* Cited by examiner, † Cited by third party
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 (en) * 2007-12-20 2013-01-02 上海盛娱网络科技有限公司 Method for accessing WAP network based on Web terminal and transition module
CN102681899B (en) * 2011-03-14 2015-06-10 金剑 Virtual computing resource dynamic management system of cloud computing service platform
CN103139183A (en) * 2011-12-02 2013-06-05 电子科技大学 Application virtualization technology based on cloud platform
US10218633B2 (en) * 2014-03-28 2019-02-26 Amazon Technologies, Inc. Implementation of a service that coordinates the placement and execution of containers
CN105979009B (en) * 2016-07-06 2019-05-17 乾云数创(山东)信息技术研究院有限公司 A kind of increase load automatic balancing method for cloud application container

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104580226A (en) * 2015-01-15 2015-04-29 上海瀚之友信息技术服务有限公司 Session data sharing system and method
CN106201819A (en) * 2016-06-28 2016-12-07 乐视控股(北京)有限公司 The system resource occupancy monitoring method and apparatus of application container engine

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109981615A (en) * 2019-03-12 2019-07-05 上海纽盾科技股份有限公司 Attack protection system and method based on block chain
CN109981615B (en) * 2019-03-12 2023-11-14 上海纽盾科技股份有限公司 Block chain-based anti-attack system and method
CN112532669A (en) * 2019-09-19 2021-03-19 贵州白山云科技股份有限公司 Network edge computing method, device and medium
CN111367678A (en) * 2020-03-31 2020-07-03 中国工商银行股份有限公司 Cluster resource management method and system
CN111367678B (en) * 2020-03-31 2023-08-22 中国工商银行股份有限公司 Cluster resource management method and system
CN111831447A (en) * 2020-07-16 2020-10-27 中国民航信息网络股份有限公司 Application elastic capacity expansion method and device based on performance monitoring
CN111831447B (en) * 2020-07-16 2024-04-30 中国民航信息网络股份有限公司 Application elastic capacity expansion method and device based on performance monitoring
CN112306640A (en) * 2020-11-12 2021-02-02 广州方硅信息技术有限公司 Container dispensing method, apparatus, device and medium therefor

Also Published As

Publication number Publication date
CN108243239A (en) 2018-07-03

Similar Documents

Publication Publication Date Title
WO2018121334A1 (en) Web application service providing method, apparatus, electronic device and system
JP6669682B2 (en) Cloud server scheduling method and apparatus
US20200057680A1 (en) Adjusting variable limit on concurrent code executions
US10104037B2 (en) Method and system for network access request control
US9959188B1 (en) Managing processor usage of a physical host configured for hosting computing instances
EP2871553B1 (en) Systems and methods for protecting virtualized assets
US9251040B2 (en) Remote debugging in a cloud computing environment
JP6495010B2 (en) System and method for active-passive routing and control of traffic in a traffic director environment
US20180375726A1 (en) Resource Configuration Method, Virtualized Network Function Manager, and Element Management System
US7587492B2 (en) Dynamic performance management for virtual servers
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
US11573725B2 (en) Object migration method, device, and system
CN111796908B (en) System and method for automatic elastic expansion and contraction of resources and cloud platform
CN109213571B (en) Memory sharing method, container management platform and computer readable storage medium
CN106713378B (en) Method and system for providing service by multiple application servers
CN111258627A (en) Interface document generation method and device
US20170329390A1 (en) System and method for selectively hibernating and restarting a node of an application instance
CN113010818A (en) Access current limiting method and device, electronic equipment and storage medium
WO2017185615A1 (en) Method for determining service status of service processing device and scheduling device
CN105592134B (en) A kind of method and apparatus of load balancing
US20200272526A1 (en) Methods and systems for automated scaling of computing clusters
CN106911741B (en) Method for balancing virtual network management file downloading load and network management server
US20170111240A1 (en) Service Elastic Method and Apparatus in Cloud Computing
WO2020252724A1 (en) Log processing method and device, and computer-readable storage medium

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