WO2020063206A1 - Flexible scaling method for microservice instances, device, and storage medium - Google Patents

Flexible scaling method for microservice instances, device, and storage medium Download PDF

Info

Publication number
WO2020063206A1
WO2020063206A1 PCT/CN2019/101856 CN2019101856W WO2020063206A1 WO 2020063206 A1 WO2020063206 A1 WO 2020063206A1 CN 2019101856 W CN2019101856 W CN 2019101856W WO 2020063206 A1 WO2020063206 A1 WO 2020063206A1
Authority
WO
WIPO (PCT)
Prior art keywords
service
instances
micro
microservice
allocated
Prior art date
Application number
PCT/CN2019/101856
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 WO2020063206A1 publication Critical patent/WO2020063206A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/40Support for services or applications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web services

Definitions

  • the present invention claims the priority of a Chinese patent application filed on September 28, 2018 with the Chinese Patent Office, with the application number 201811136091.6, and the invention name is "Microservice instance elastic scaling method, device and storage medium", the entire content of the application Incorporated by reference in the present invention.
  • Embodiments of the present application relate to the field of communications technologies, and in particular, to a method and apparatus for elastically scaling a microservice instance, and a computer-readable storage medium.
  • the network management system can automatically calculate its flexible resource management services, seamlessly add microservice instances when business demand peaks increase, and automatically reduce microservice instances to reduce costs when business demand decreases, that is, The need for systems to be able to scale microservice instances elastically has become a common requirement for current big data applications.
  • the elastic scaling of resources is based on the remaining resources (CPU and memory) or how much the load exceeds the preset number and the amount to be reduced.
  • This elastic scaling method cannot gradually meet the detailed requirements for the shrinking strategy in multi-service interconnected applications, which are mainly reflected in:
  • each service is required to maintain the prescribed processing capacity.
  • the services that have been opened can use the system's free resources to serve them as much as possible;
  • the preset number of shrinking instances is not enough to support the current business, resulting in a bottleneck.
  • the newly opened service needs to be able to obtain its regulations. The resources needed to serve it.
  • the purpose of the embodiments of the present application is to provide a microservice instance elastic scaling method, device, and computer-readable storage medium to solve the problem that the existing elastic scaling methods cannot meet the requirements of multi-service interconnected applications.
  • a microservice instance elastic scaling method the method includes:
  • the number of instances calculates the number of micro service instances that each business needs to increase or decrease; and adjusts the number of micro service instances of each business according to the number of micro service instances that each business needs to increase or decrease.
  • a microservice instance elastic scaling device includes a memory, a processor, and a microservice instance elasticity stored in the memory and operable on the processor.
  • a scaling program where the microservice instance elastic scaling program is executed by the processor to implement the steps of the above microservice instance elastic scaling method.
  • a computer-readable storage medium stores a microservice instance elastic scaling program, and the microservice instance elastic scaling program is executed by a processor. Steps for implementing the elastic service scaling method of the micro service instance described above.
  • a computer program product includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions.
  • the program instructions When executed by a computer, the computer is caused to execute the method described in each of the above aspects.
  • FIG. 1 is a schematic flowchart of a microservice instance elastic scaling method according to a first embodiment of the present application
  • FIG. 2 is a schematic structural diagram of an elastic scaling component of a microservice instance according to an embodiment of the present application
  • FIG. 3 is a schematic diagram of an elastic scaling structure of a microservice instance according to an embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of a microservice example elastic scaling device according to a second embodiment of the present application.
  • a first embodiment of the present application provides a method for elastically scaling a microservice instance.
  • the method includes:
  • Step S11 Obtaining the status of the idle resources in the total resources, the number of micro service instances required by each service in the multiple services, the number of micro service instances allocated to each service, and the maximum number of micro services that can be allocated to each service The number of service instances.
  • the state of obtaining idle resources in the total resources the number of micro service instances required by each service in multiple services, the number of micro service instances allocated to each service, and the number of micro service instances that can be allocated to the services.
  • the maximum number of microservice instances per business previously also included:
  • the number of tasks of each service should be less than the maximum number of tasks allowed to be processed by the service; otherwise, the user should appropriately prompt or reject the new task when receiving a new task.
  • the single task time consuming is the actual time consuming task processing of each business.
  • the initial experience value can be obtained through testing and experience, and the operation period can be dynamically adjusted according to the actual task execution status of each business.
  • the shrinking model formulas for different tasks are different for different businesses, and the formulas can be determined based on different business characteristics.
  • the resource quota ratio of each service is a weight ratio of each service to resource usage determined by comprehensively considering service characteristics (for example, periodic length (hour / day), random on-demand, business importance, etc.).
  • service characteristics for example, periodic length (hour / day), random on-demand, business importance, etc.
  • the default value of the quota ratio can be determined by experience and test data.
  • adaptive adjustments are made according to business characteristics to achieve efficient use of resources.
  • the total resources are represented by MAX; the number of tasks for each service is represented by TaskNum (En), where En represents the business En and n is a positive integer; Vone_task represents the single task time consuming; FUNC_INS (En) represents each service The number of tasks shrinks the model formula; FUNC_RES (En) indicates the resource quota ratio of each service; ToAlloc_InstanceNum (En) indicates the number of microservice instances required by each service; MAX_InstanceNum (En) indicates that it can be allocated to the service Maximum number of microservice instances per business.
  • ToAlloc_InstanceNum (En) V_NumOfTotalTask / (V_X / Vone_task).
  • the maximum number of microservice instances that can be allocated to each business is calculated by the following formula:
  • the obtaining total resources, the number of tasks per service, the time required for a single task, the shrinking model formula of the number of tasks per service, and the resource quota ratio of each service Before also including:
  • the obtaining a new single task is time-consuming based on the recorded task number and time information of each service, and then further includes:
  • the resource quota ratio of each service is adjusted.
  • the timing detection function can be turned on; the number of tasks of each service and the current time are recorded; the number of tasks of each service and the current time are recorded in the next monitoring cycle; and then according to Record the number of tasks and time information of each business to obtain a new single task time; if the change (up) of the new single task time from the current single task time exceeds 20% but is less than the maximum permitted time, adjust the current If the change (up) of the new single task time from the current single task time exceeds 20% and is greater than the maximum permitted time, then adjust the current single task time to the maximum permitted time; if Compared with the default single task time consumption, the new single task time consumption has dropped for more than half a year, so adjust the resource quota ratio of each service.
  • the micro service instance required by each service is calculated according to the number of tasks of each service, the time consumption of the single task, and the shrinking model formula of the number of tasks of each service. Number, followed by:
  • the allocation of the number of microservice instances for each service according to the service priority and its resource preemption rules includes, but is not limited to, the following situations:
  • the low-priority task itself retains the lowest number of microservice instances, ensure that high-priority services can enjoy more microservice instances, that is, the maximum number of microservice instances that preferentially guarantee high-priority services;
  • the number of microservice instances cannot guarantee that the total time consumption meets the business requirements.
  • the priority is to ensure the lowest number of microservice instances for the low-priority business in the direction of low priority, and then recursively ensure that the number of microservice instances for the low-priority business is equal to or higher.
  • the minimum number of microservice instances if all services have been allocated according to the minimum number of microservice instances, the total time consumption of each business still does not meet the business requirements, it is prompted that an appropriate number of microservice instances cannot be given.
  • the allocating the number of microservice instances to each service according to the service priority and its resource preemption rules further includes:
  • the resource preemption rule may be: whether high-priority services occupy all or part of the resources of low-priority services during a business storm, and whether low-priority services should retain the minimum number of microservice instances.
  • Step S12 according to the idle resource status in the total resources, the number of microservice instances required by each service, the number of microservice instances allocated to each service, and the maximum number of microservice instances that can be allocated to each service
  • the number of micro service instances is to calculate the number of micro service instances that each business needs to increase or decrease.
  • the number of micro service instances required for each service, the number of micro service instances allocated to each service, and the number of micro service instances allocated to each service according to the status of idle resources in the total resources including:
  • the number of micro service instances required in each service is greater than the number of micro service instances allocated to each service, and the number of micro service instances allocated to each service is equal to the maximum number of micro services that can be allocated to each service
  • the number of microservice instances required for each service is the number of microservice instances required for each service and the microservices allocated to each service The difference in the number of instances.
  • ToAlloc_InstanceNum (En) represents the number of micro service instances required by each service
  • Current_InstanceNum (En) represents the number of micro service instances allocated to each service
  • MAX_InstanceNum (En) represents that it can be allocated to the services Maximum number of microservice instances per business.
  • the number of micro service instances required in each service is greater than the number of micro service instances allocated to each service, and the number of micro service instances allocated to each service is equal to the maximum number of micro services that can be allocated to each service In the case where the number of service instances and total resources have no idle resources, the number of micro service instances that each business needs to increase or decrease is zero; in this case, the number of micro service instances for each business remains as allocatable The maximum number of micro service instances for each service is guaranteed at this time.
  • the number of micro service instances required by each service is less than the number of micro service instances allocated to each service
  • the number of micro service instances required to be reduced by each service is the number of micro service instances allocated to each service The difference between the number of microservice instances and the number of microservice instances required for each business; in this case, there is no need to pop up a new microservice instance; instead, the number of microservice instances that complete the task needs to be reduced.
  • ToAlloc_InstanceNum (En) represents the number of microservice instances required by each service
  • Current_InstanceNum (En) represents the number of microservice instances allocated to each service.
  • the number of micro service instances required for each service is greater than the number of micro service instances allocated to each service, and the number of micro service instances required for each service is less than or equal to the maximum number of micro services that can be allocated to each service In the case of the number of service instances, and the total resources have no free resources, the number of micro service instances required for each service is the number of micro service instances allocated to another service and the maximum micro service that can be allocated to the other service The difference in the number of instances.
  • ToAlloc_InstanceNum (En) represents the number of micro service instances required by each service
  • Current_InstanceNum (En) represents the number of micro service instances allocated to each service
  • MAX_InstanceNum (En) represents that it can be allocated to the services The maximum number of microservice instances for each business
  • Current_InstanceNum (Em) represents the number of microservice instances allocated to another business
  • MAX_InstanceNum (Em) represents the difference between the maximum number of microservice instances that can be allocated to the other business.
  • Step S13 Adjust the number of microservice instances of each service according to the number of microservice instances required to be increased or decreased for each service.
  • the adjusting the number of micro service instances of each service according to the increase or reduction of the number of micro service instances required by each service further includes:
  • the number of micro service instances required to be added to each service is marked with the identifier of each service; or the number of micro service instances required to be reduced for each service is removed from the identifier of each service.
  • the number of micro service instances required for business En must be marked with En.
  • the microservice instance marked with the En logo is then executed based on the task of obtaining only the business En, and once the microservice instance is assigned to other services (such as Em), the microservice instance needs to remove the En logo and be marked with the service Em Logo.
  • Figure 2 is a schematic diagram of the microservice instance elastic scaling component structure, which includes model management, resource management, and business tasks Pool
  • Figure 3 is a schematic diagram of an elastic scaling structure of a microservice instance, where business tasks include interference tasks and degradation detection tasks).
  • a company China Telecom's alarm northbound interface adopts a traditional elastic scaling strategy, which only quantifies elastic scaling based on a preset resource occupation. It often lags behind business processing requests, resulting in the accumulation of business processing tasks and causing the system processing capacity to deteriorate when needed. Occupies redundant resources.
  • the intelligent interference resource usage rate is below 80% for a long time. The released resources cannot be used immediately. For degradation detection.
  • the model management module sets two services: intelligent interference location (on demand), and degradation detection (cycle time).
  • each task has 3 seconds processing time, 25 instances are allocated, the actual 12 second processing time is less than 15 seconds; 100 tasks, each task is 2 seconds processing time, 17 instances are allocated, the actual 12 second processing time. That is, 100 instances of task assignment are required to be processed within 12 to 15 seconds.
  • the actual time required for each task is obtained through monitoring data, and the cycle is adjusted on a daily basis. The formula is as follows:
  • ToAlloc_InstanceNum (En) V_NumOfTotalTask / (V_12 / Vone_task).
  • ToAlloc_InstanceNum (En) V_NumOfTotalTask / (V_10 / Vone_task).
  • the resource management module adjusts the number of service microservice instances according to the setting information.
  • the adjusted information is shown in the following table:
  • the model management module sets two services: intelligent interference location (on demand), and degradation detection (cycle time).
  • the number of business tasks shrinks the model formula FUNC_INS (E1) for interference tasks: 100 tasks, 2.5 seconds processing time for each task, 20 instances are allocated, the actual processing time is 12.5 seconds; 100 tasks, 2 seconds processing time for each task , Allocate 16 instances, the actual 14 seconds processing time. That is, 100 instances of task assignment are required to be processed within 12 to 15 seconds.
  • the actual time required for each task is obtained through monitoring data, and the cycle is adjusted on a daily basis.
  • the formula is as follows:
  • ToAlloc_InstanceNum (En) V_NumOfTotalTask / (V_12 / Vone_task).
  • the number of business tasks shrinks the model formula FUNC_INS (E2) for degradation detection tasks: 100 tasks, 2.5 seconds processing time per task, 25 instances allocated, actual 10 second processing time; 100 tasks, 2 seconds processing per task Time, 15 instances are allocated, and the actual processing time is 10.5 seconds. That is, 100 instances of task assignment are required to be processed within 10 to 12 seconds.
  • the actual time required for each task is obtained through monitoring data, and the cycle is adjusted on a daily basis.
  • the formula is as follows:
  • ToAlloc_InstanceNum (En) V_NumOfTotalTask / (V_10 / Vone_task).
  • the resource management module adjusts the number of service microservice instances according to the setting information.
  • the adjusted information is shown in the following table:
  • the method for elastically scaling microservice instances by dynamically adjusting the number of microservice instances of each service in multiple services, solves the problem that existing elastic scaling methods cannot meet the requirements of multi-service interconnected applications. ; In the case of ensuring that the processing capacity of the business is not affected by other businesses, ensure that the number of microservice instances of each business is under the best conditions; and improve resource utilization.
  • a second embodiment of the present application provides a microservice instance elastic scaling device.
  • the device includes: a memory 21, a processor 22, and stored on the memory 21 and may be on the processor 22.
  • the running microservice instance elastic scaling program when the microservice instance elastic scaling program is executed by the processor 22, is used to implement the steps of the microservice instance elastic scaling method described below:
  • the number of instances calculates the number of micro service instances that each business needs to increase or decrease; and adjusts the number of micro service instances of each business according to the number of micro service instances that each business needs to increase or decrease.
  • microservice instance elastic scaling program When executed by the processor 22, it is also used to implement the steps of the microservice instance elastic scaling method described below:
  • microservice instance elastic scaling program When executed by the processor 22, it is also used to implement the steps of the microservice instance elastic scaling method described below:
  • microservice instance elastic scaling program When executed by the processor 22, it is also used to implement the steps of the microservice instance elastic scaling method described below:
  • the resource quota ratio of each service is adjusted.
  • microservice instance elastic scaling program When executed by the processor 22, it is also used to implement the steps of the microservice instance elastic scaling method described below:
  • microservice instance elastic scaling program When executed by the processor 22, it is also used to implement the steps of the microservice instance elastic scaling method described below:
  • microservice instance elastic scaling program When executed by the processor 22, it is also used to implement the steps of the microservice instance elastic scaling method described below:
  • the number of micro service instances required in each service is greater than the number of micro service instances allocated to each service, and the number of micro service instances allocated to each service is equal to the maximum number of micro services that can be allocated to each service
  • the number of microservice instances required for each service is the number of microservice instances required for each service and the microservices allocated to each service
  • the difference between the number of instances; the number of microservice instances required in each business is greater than the number of microservice instances allocated to each business, and the number of microservice instances allocated to each business is equal to the number of microservice instances that can be allocated to the
  • the maximum number of microservice instances of each service and the total resources have no idle resources the number of microservice instances required to be increased or decreased for each service is zero; the number of microservice instances required for each service is less than In the case of the number of micro service instances allocated to each service, the number of micro service instances to be reduced for each service is the number of micro service instances allocated to each service and the number of micro services instances allocated
  • the difference between the number of required microservice instances; the number of microservice instances required in each business is greater than the number of microservice instances allocated to each business, and the number of microservice instances required in each business is less than or equal to
  • the number of micro service instances required to be added for each service is the number of micro service instances allocated to another service and the number of allocable resources.
  • microservice instance elastic scaling program When executed by the processor 22, it is also used to implement the steps of the microservice instance elastic scaling method described below:
  • the number of micro service instances required to be added to each service is marked with the identifier of each service; or the number of micro service instances required to be reduced for each service is removed from the identifier of each service.
  • the microservice instance elastic scaling device of the embodiment of the present application dynamically adjusts the number of microservice instances of each service in multiple services; and solves the problem that the existing elastic scaling method cannot meet the requirements of multi-service interconnected applications. ; In the case of ensuring that the processing capacity of the business is not affected by other businesses, ensure that the number of microservice instances of each business is under the best conditions; and improve resource utilization.
  • a third embodiment of the present application provides a computer-readable storage medium.
  • the computer-readable storage medium stores a microservice instance elastic scaling program.
  • the microservice instance elastic scaling program is used to implement a first service when executed by a processor. The steps of the microservice instance elastic scaling method described in the embodiment.
  • the computer-readable storage medium of this embodiment belongs to the same concept as the method of the first embodiment.
  • the specific implementation process is described in detail in the method embodiment, and the technical features in the method embodiment are all in this embodiment. Correspondence applies, and is not repeated here.
  • the computer-readable storage medium of the embodiment of the present application dynamically adjusts the number of micro service instances of each service in multiple services; and solves the problem that the existing elastic scaling method cannot meet the requirements of multi-service interconnected applications; In the case that the processing capacity of the business is not affected by other businesses, the number of microservice instances of each business is under the optimal condition; the resource utilization rate is improved.
  • the computer program product of the embodiment of the present application includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions.
  • the program instructions When the program instructions are executed by a computer, The computer executes the method in any of the above method embodiments.
  • Such software may be distributed on computer-readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media).
  • computer storage medium includes volatile and non-volatile implemented in any method or technology used to store information such as computer-readable instructions, data structures, program modules or other data.
  • Removable, removable and non-removable media Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or may Any other medium used to store desired information and which can be accessed by a computer.
  • a communication medium typically contains computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and may include any information delivery medium .

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Debugging And Monitoring (AREA)

Abstract

Disclosed in the embodiments of the present application are a flexible scaling method for microservice instances, a device, and a computer-readable storage medium, the method comprising: acquiring an idle-resource state in total resources, the number of microservice instances required by each service in a plurality of services, the number of microservice instances allocated to each service, and the maximum number of microservice instances able to be allocated to each service; calculating the number of microservice instances needing to be added to or removed from each service; and on the basis of the number of the number of microservice instances needing to be added to or removed from each service, adjusting the number of microservice instances of each service.

Description

微服务实例弹性伸缩方法、装置以及存储介质Microservice instance elastic scaling method, device and storage medium
交叉引用cross reference
本发明要求在2018年9月28日提交至中国专利局、申请号为201811136091.6、发明名称为“微服务实例弹性伸缩方法、装置以及存储介质”的中国专利申请的优先权,该申请的全部内容通过引用结合在本发明中。The present invention claims the priority of a Chinese patent application filed on September 28, 2018 with the Chinese Patent Office, with the application number 201811136091.6, and the invention name is "Microservice instance elastic scaling method, device and storage medium", the entire content of the application Incorporated by reference in the present invention.
技术领域Technical field
本申请实施例涉及通信技术领域,尤其涉及一种微服务实例弹性伸缩方法、装置以及计算机可读存储介质。Embodiments of the present application relate to the field of communications technologies, and in particular, to a method and apparatus for elastically scaling a microservice instance, and a computer-readable storage medium.
背景技术Background technique
根据业务需求和策略,网管系统能够自动计算其弹性资源的管理服务,在满足业务需求高峰增长时无缝地增加微服务实例,并在业务需求下降时自动减少微服务实例以节约成本,也就是系统要能够弹性伸缩微服务实例,已经成为了当前大数据应用的通用要求。According to business needs and policies, the network management system can automatically calculate its flexible resource management services, seamlessly add microservice instances when business demand peaks increase, and automatically reduce microservice instances to reduce costs when business demand decreases, that is, The need for systems to be able to scale microservice instances elastically has become a common requirement for current big data applications.
传统的开源框架或者系统中,对资源的弹性伸缩都只是依据剩余的资源(CPU和内存)或者负荷超过多少就弹出预设的数量以及要缩减到的数量。这种弹性伸缩方式逐步满足不了多业务相互关联应用中的对弹缩策略的细化要求,主要体现在:In traditional open source frameworks or systems, the elastic scaling of resources is based on the remaining resources (CPU and memory) or how much the load exceeds the preset number and the amount to be reduced. This elastic scaling method cannot gradually meet the detailed requirements for the shrinking strategy in multi-service interconnected applications, which are mainly reflected in:
首先,多业务情况下,要求每种业务保持规定的处理能力;其次,多业务情况下,如果某些业务暂不开展,已开通的服务则能够利用系统空余出来的资源尽可能为其服务;再者,业务突发时,预设的弹缩实例数不足以支撑当前业务,导致产生瓶颈;最后,多业务情况下,如果之前未开通的业务一旦开通,刚开通的业务需要能够获取其规定需要的资源为其服务。First, in the case of multiple services, each service is required to maintain the prescribed processing capacity. Second, in the case of multiple services, if certain services are temporarily unavailable, the services that have been opened can use the system's free resources to serve them as much as possible; Furthermore, when there is a business burst, the preset number of shrinking instances is not enough to support the current business, resulting in a bottleneck. Finally, in the case of multiple services, if the previously unopened service is opened once, the newly opened service needs to be able to obtain its regulations. The resources needed to serve it.
发明内容Summary of the Invention
有鉴于此,本申请实施例的目的在于提供一种微服务实例弹性伸缩方法、装置以及计算机可读存储介质,以解决现有弹性伸缩方式存在的不能满足多业务相互关联应用的要求的问题。In view of this, the purpose of the embodiments of the present application is to provide a microservice instance elastic scaling method, device, and computer-readable storage medium to solve the problem that the existing elastic scaling methods cannot meet the requirements of multi-service interconnected applications.
本申请实施例解决上述技术问题所采用的技术方案如下:The technical solutions adopted by the embodiments of the present application to solve the above technical problems are as follows:
根据本申请实施例的一个方面,提供的一种微服务实例弹性伸缩方法, 所述方法包括:According to an aspect of the embodiments of the present application, there is provided a microservice instance elastic scaling method, the method includes:
获取总资源中的空闲资源状况、多个业务中每个业务需要的微服务实例数、分配给所述每个业务的微服务实例数以及可分配给所述每个业务的最大微服务实例数;根据所述总资源中的空闲资源状况、所述每个业务需要的微服务实例数、分配给所述每个业务的微服务实例数、以及可分配给所述每个业务的最大微服务实例数,计算所述每个业务需要增加或者缩减的微服务实例数;根据所述每个业务需要增加或者缩减的微服务实例数,对所述每个业务的微服务实例数进行调整。Obtaining the status of idle resources in the total resources, the number of microservice instances required by each service in multiple services, the number of microservice instances allocated to each service, and the maximum number of microservice instances that can be allocated to each service ; According to the idle resource status in the total resources, the number of micro service instances required by each service, the number of micro service instances allocated to each service, and the maximum micro service that can be allocated to each service The number of instances calculates the number of micro service instances that each business needs to increase or decrease; and adjusts the number of micro service instances of each business according to the number of micro service instances that each business needs to increase or decrease.
根据本申请实施例的另一个方面,提供的一种微服务实例弹性伸缩装置,所述装置包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的微服务实例弹性伸缩程序,所述微服务实例弹性伸缩程序被所述处理器执行时实现上述的微服务实例弹性伸缩方法的步骤。According to another aspect of the embodiments of the present application, a microservice instance elastic scaling device is provided, the device includes a memory, a processor, and a microservice instance elasticity stored in the memory and operable on the processor. A scaling program, where the microservice instance elastic scaling program is executed by the processor to implement the steps of the above microservice instance elastic scaling method.
根据本申请实施例的另一个方面,提供的一种计算机可读存储介质,所述计算机可读存储介质上存储有微服务实例弹性伸缩程序,所述微服务实例弹性伸缩程序被处理器执行时实现上述的微服务实例弹性伸缩方法的步骤。According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided. The computer-readable storage medium stores a microservice instance elastic scaling program, and the microservice instance elastic scaling program is executed by a processor. Steps for implementing the elastic service scaling method of the micro service instance described above.
根据本申请实施例的另一个方面,提供的一种计算机程序产品,所述计算机程序产品包括存储在非暂态计算机可读存储介质上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,使所述计算机执行以上各个方面所述的方法。According to another aspect of the embodiments of the present application, a computer program product is provided. The computer program product includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer is caused to execute the method described in each of the above aspects.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1为本申请第一实施例的微服务实例弹性伸缩方法流程示意图;1 is a schematic flowchart of a microservice instance elastic scaling method according to a first embodiment of the present application;
图2为本申请实施例的微服务实例弹性伸缩组件结构示意图;2 is a schematic structural diagram of an elastic scaling component of a microservice instance according to an embodiment of the present application;
图3为本申请实施例的微服务实例弹性伸缩结构示意图;3 is a schematic diagram of an elastic scaling structure of a microservice instance according to an embodiment of the present application;
图4为本申请第二实施例的微服务实例弹性伸缩装置结构示意图。FIG. 4 is a schematic structural diagram of a microservice example elastic scaling device according to a second embodiment of the present application.
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The implementation, functional features and advantages of the purpose of this application will be further described with reference to the embodiments and the drawings.
具体实施方式detailed description
为了使本申请所要解决的技术问题、技术方案及有益效果更加清楚、明白,以下结合附图和实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the technical problems, technical solutions, and beneficial effects to be more clearly understood in the present application, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the application, and are not used to limit the application.
第一实施例First embodiment
如图1所示,本申请第一实施例提供一种微服务实例弹性伸缩方法,所述方法包括:As shown in FIG. 1, a first embodiment of the present application provides a method for elastically scaling a microservice instance. The method includes:
步骤S11:获取总资源中的空闲资源状况、多个业务中每个业务需要的微服务实例数、分配给所述每个业务的微服务实例数以及可分配给所述每个业务的最大微服务实例数。Step S11: Obtaining the status of the idle resources in the total resources, the number of micro service instances required by each service in the multiple services, the number of micro service instances allocated to each service, and the maximum number of micro services that can be allocated to each service The number of service instances.
在一种实施方式中,所述获取总资源中的空闲资源状况、多个业务中每个业务需要的微服务实例数、分配给所述每个业务的微服务实例数以及可分配给所述每个业务的最大微服务实例数,之前还包括:In an implementation manner, the state of obtaining idle resources in the total resources, the number of micro service instances required by each service in multiple services, the number of micro service instances allocated to each service, and the number of micro service instances that can be allocated to the services The maximum number of microservice instances per business, previously also included:
获取总资源、所述每个业务的任务数、单任务耗时、所述每个业务的任务数弹缩模型公式、以及所述每个业务的资源配额比;根据所述每个业务的任务数、所述单任务耗时以及所述每个业务的任务数弹缩模型公式,计算所述每个业务需要的微服务实例数;根据所述总资源、以及所述每个业务的资源配额比,计算可分配给所述每个业务的最大微服务实例数。Obtaining the total resources, the number of tasks of each service, the time required for a single task, the shrinking model formula of the number of tasks of each service, and the resource quota ratio of each service; according to the tasks of each service Number, the time required for the single task, and the shrinking model formula for the number of tasks for each service to calculate the number of microservice instances required for each service; based on the total resources and the resource quota for each service Ratio, calculating the maximum number of microservice instances that can be allocated to each business.
在该实施方式中,所述每个业务的任务数应该小于该业务允许待处理最大的任务数,否则在接收新任务时候应当适当提示或者拒绝用户下达新任务。In this implementation manner, the number of tasks of each service should be less than the maximum number of tasks allowed to be processed by the service; otherwise, the user should appropriately prompt or reject the new task when receiving a new task.
所述单任务耗时是各个业务的任务处理实际耗时,初始的经验值可由测试和经验获得,运行期可根据各业务实际执行任务情况进行动态调整。The single task time consuming is the actual time consuming task processing of each business. The initial experience value can be obtained through testing and experience, and the operation period can be dynamically adjusted according to the actual task execution status of each business.
不同业务的任务数弹缩模型公式不同,公式可根据不同的业务特性确定。The shrinking model formulas for different tasks are different for different businesses, and the formulas can be determined based on different business characteristics.
所述每个业务的资源配额比,是综合考虑业务特点(例如:周期性长短(小时/天)、随机按需、业务重要度等等),确定的各业务对资源使用的权重比例。该配额比的默认值可由经验和测试数据决定,运行中根据业务特点进行自适应调整,以达到资源的有效使用。The resource quota ratio of each service is a weight ratio of each service to resource usage determined by comprehensively considering service characteristics (for example, periodic length (hour / day), random on-demand, business importance, etc.). The default value of the quota ratio can be determined by experience and test data. During operation, adaptive adjustments are made according to business characteristics to achieve efficient use of resources.
作为示例地,假设总资源以MAX表示;每个业务的任务数以TaskNum(En)表示,其中En表示业务En,n为正整数;Vone_task表示单任务耗时;FUNC_INS(En)表示每个业务的任务数弹缩模型公式;FUNC_RES(En)表示所述每个业务的资源配额比;ToAlloc_InstanceNum(En)表示所述每个业务需要的微服务实例数;MAX_InstanceNum(En)表示可分配给所述每个业务的最大微服务实例数。As an example, suppose that the total resources are represented by MAX; the number of tasks for each service is represented by TaskNum (En), where En represents the business En and n is a positive integer; Vone_task represents the single task time consuming; FUNC_INS (En) represents each service The number of tasks shrinks the model formula; FUNC_RES (En) indicates the resource quota ratio of each service; ToAlloc_InstanceNum (En) indicates the number of microservice instances required by each service; MAX_InstanceNum (En) indicates that it can be allocated to the service Maximum number of microservice instances per business.
则所述每个业务需要的微服务实例数ToAlloc_InstanceNum(En)通过以下公式进行计算:Then the number of micro service instances ToAlloc_InstanceNum (En) required for each business is calculated by the following formula:
ToAlloc_InstanceNum(En)=V_NumOfTotalTask/(V_X/Vone_task)。ToAlloc_InstanceNum (En) = V_NumOfTotalTask / (V_X / Vone_task).
可分配给所述每个业务的最大微服务实例数通过以下公式进行计算:The maximum number of microservice instances that can be allocated to each business is calculated by the following formula:
MAX_InstanceNum(En)=MAX*FUNC_RES(En)。MAX_InstanceNum (En) = MAX * FUNC_RES (En).
在一种实施方式中,所述获取总资源、所述每个业务的任务数、单任务耗时、所述每个业务的任务数弹缩模型公式、以及所述每个业务的资源配额比,之前还包括:In an implementation manner, the obtaining total resources, the number of tasks per service, the time required for a single task, the shrinking model formula of the number of tasks per service, and the resource quota ratio of each service , Before also including:
记录所述每个业务的任务数以及时间信息;根据记录的所述每个业务的任务数以及时间信息得到新的单任务耗时;在所述新的单任务耗时与所述单任务耗时的变化率超过预设值的情况下,调整所述单任务耗时。Recording the number of tasks and time information of each business; obtaining a new single task time according to the recorded number of tasks and time information of each business; in the new single task time and the single task time When the change rate of time exceeds a preset value, adjusting the time consumption of the single task.
在该实施方式中,所述根据记录的所述每个业务的任务数以及时间信息得到新的单任务耗时,之后还包括:In this implementation manner, the obtaining a new single task is time-consuming based on the recorded task number and time information of each service, and then further includes:
在所述新的单任务耗时相比缺省的单任务耗时下降连续超过预设时间的情况下,调整所述每个业务的资源配额比。In a case where the time consumption of the new single task decreases compared with the default time consumption of the single task continuously over a preset time, the resource quota ratio of each service is adjusted.
作为示例地,在需要调整业务的微服务实例数时,可开启定时检测功能;记录该时刻各个业务的任务数以及当前时间;下个监测周期时记录各个业务的任务数以及当前时间;然后根据记录的各个业务的任务数以及时间信息得到新的单任务耗时;如果新的单任务耗时与当前的单任务耗时的变化(上升)超过20%但小于最大许可耗时,则调整当前的单任务耗时;如果新的单任务耗时与当前的单任务耗时的变化(上升)超过20%且大于最大许可耗时,则调整当前的单任务耗时为最大许可耗时;如果新的单任务耗时相比缺省的单任务耗时下降连续超过半年,则调整每个业务的资源配额比。As an example, when the number of service microservice instances needs to be adjusted, the timing detection function can be turned on; the number of tasks of each service and the current time are recorded; the number of tasks of each service and the current time are recorded in the next monitoring cycle; and then according to Record the number of tasks and time information of each business to obtain a new single task time; if the change (up) of the new single task time from the current single task time exceeds 20% but is less than the maximum permitted time, adjust the current If the change (up) of the new single task time from the current single task time exceeds 20% and is greater than the maximum permitted time, then adjust the current single task time to the maximum permitted time; if Compared with the default single task time consumption, the new single task time consumption has dropped for more than half a year, so adjust the resource quota ratio of each service.
在一种实施方式中,所述根据所述每个业务的任务数、所述单任务耗时以及所述每个业务的任务数弹缩模型公式,计算所述每个业务需要的微服务实例数,之后还包括:In an implementation manner, the micro service instance required by each service is calculated according to the number of tasks of each service, the time consumption of the single task, and the shrinking model formula of the number of tasks of each service. Number, followed by:
计算所有业务需要的微服务实例总数;在所有业务需要的微服务实例总数小于总资源的情况下,将计算的所述每个业务需要的微服务实例数分配给所述每个业务进行使用;在所有业务需要的微服务实例总数大于总资源的情况下,根据业务优先级及其资源抢占规则对所述每个业务进行微服务实例数的分配。Calculate the total number of micro service instances required by all services; and if the total number of micro service instances required by all services is less than the total resources, allocate the calculated number of micro service instances required by each service to each service for use; When the total number of micro service instances required by all services is greater than the total resources, the number of micro service instances is allocated to each service according to the service priority and its resource preemption rules.
在该实施方式中,根据业务优先级及其资源抢占规则对所述每个业务进行微服务实例数的分配包括但不限于以下情形:In this implementation manner, the allocation of the number of microservice instances for each service according to the service priority and its resource preemption rules includes, but is not limited to, the following situations:
保证低优先级任务自身保留最低的微服务实例数时,确保高优先级业务可以享有更多的微服务实例数,即优先保证高优先级业务的最大微服务实例 数;如果低优先级业务的微服务实例数无法保证总耗时符合业务要求,按优先级顺序低往高的方向保证低优先级业务自身最低的微服务实例数,然后递归保证低优先级业务的微服务实例数等于或高于自身的最低的微服务实例数;如果所有业务都已按最低的微服务实例数进行分配时,各业务的总耗时仍不符合业务要求,则提示无法给出合适的微服务实例数。When ensuring that the low-priority task itself retains the lowest number of microservice instances, ensure that high-priority services can enjoy more microservice instances, that is, the maximum number of microservice instances that preferentially guarantee high-priority services; The number of microservice instances cannot guarantee that the total time consumption meets the business requirements. The priority is to ensure the lowest number of microservice instances for the low-priority business in the direction of low priority, and then recursively ensure that the number of microservice instances for the low-priority business is equal to or higher. The minimum number of microservice instances; if all services have been allocated according to the minimum number of microservice instances, the total time consumption of each business still does not meet the business requirements, it is prompted that an appropriate number of microservice instances cannot be given.
在该实施方式中,所述根据业务优先级及其资源抢占规则对所述每个业务进行微服务实例数的分配,之前还包括:In this embodiment, the allocating the number of microservice instances to each service according to the service priority and its resource preemption rules further includes:
确定所述业务优先级及其资源抢占规则。Determining the service priority and its resource preemption rule.
作为示例地,资源抢占规则可以为:业务风暴时高优先级业务是全占还是部分抢夺低优先级业务的资源,低优先级业务是否要保留最低的微服务实例数。As an example, the resource preemption rule may be: whether high-priority services occupy all or part of the resources of low-priority services during a business storm, and whether low-priority services should retain the minimum number of microservice instances.
步骤S12:根据所述总资源中的空闲资源状况、所述每个业务需要的微服务实例数、分配给所述每个业务的微服务实例数、以及可分配给所述每个业务的最大微服务实例数,计算所述每个业务需要增加或者缩减的微服务实例数。Step S12: according to the idle resource status in the total resources, the number of microservice instances required by each service, the number of microservice instances allocated to each service, and the maximum number of microservice instances that can be allocated to each service The number of micro service instances is to calculate the number of micro service instances that each business needs to increase or decrease.
在本实施例中,所述根据所述总资源中的空闲资源状况、所述每个业务需要的微服务实例数、分配给所述每个业务的微服务实例数、以及可分配给所述每个业务的最大微服务实例数,计算所述每个业务需要增加或者缩减的微服务实例数,包括:In this embodiment, the number of micro service instances required for each service, the number of micro service instances allocated to each service, and the number of micro service instances allocated to each service according to the status of idle resources in the total resources, The maximum number of micro service instances for each business, and calculating the number of micro service instances that each business needs to increase or decrease, including:
在所述每个业务需要的微服务实例数大于分配给所述每个业务的微服务实例数、分配给所述每个业务的微服务实例数等于可分配给所述每个业务的最大微服务实例数、且总资源还有空闲资源的情况下,所述每个业务需要增加的微服务实例数为所述每个业务需要的微服务实例数与分配给所述每个业务的微服务实例数的差值。The number of micro service instances required in each service is greater than the number of micro service instances allocated to each service, and the number of micro service instances allocated to each service is equal to the maximum number of micro services that can be allocated to each service In the case of the number of service instances and total resources and free resources, the number of microservice instances required for each service is the number of microservice instances required for each service and the microservices allocated to each service The difference in the number of instances.
作为示例地,假设ToAlloc_InstanceNum(En)表示所述每个业务需要的微服务实例数;Current_InstanceNum(En)表示分配给所述每个业务的微服务实例数;MAX_InstanceNum(En)表示可分配给所述每个业务的最大微服务实例数。As an example, it is assumed that ToAlloc_InstanceNum (En) represents the number of micro service instances required by each service; Current_InstanceNum (En) represents the number of micro service instances allocated to each service; MAX_InstanceNum (En) represents that it can be allocated to the services Maximum number of microservice instances per business.
当ToAlloc_InstanceNum(En)>Current_InstanceNum(En)、Current_InstanceNum(En)=MAX_InstanceNum(En)、且总资源还有空闲资源时,所述每个业务需要增加的微服务实例数为:(ToAlloc_InstanceNum(En)-Current_InstanceNum(En))。When ToAlloc_InstanceNum (En)> Current_InstanceNum (En), Current_InstanceNum (En) = MAX_InstanceNum (En), and the total resources still have free resources, the number of microservice instances required for each service is: (ToAlloc_InstanceNum (En)- Current_InstanceNum (En)).
在所述每个业务需要的微服务实例数大于分配给所述每个业务的微服务实例数、分配给所述每个业务的微服务实例数等于可分配给所述每个业务的最大微服务实例数、且总资源没有空闲资源的情况下,所述每个业务需要增加或者缩减的微服务实例数为零;在该情形下,所述每个业务的微服务实例数保持为可分配给所述每个业务的最大微服务实例数,此时保证了系统对业务的处理能力。The number of micro service instances required in each service is greater than the number of micro service instances allocated to each service, and the number of micro service instances allocated to each service is equal to the maximum number of micro services that can be allocated to each service In the case where the number of service instances and total resources have no idle resources, the number of micro service instances that each business needs to increase or decrease is zero; in this case, the number of micro service instances for each business remains as allocatable The maximum number of micro service instances for each service is guaranteed at this time.
在所述每个业务需要的微服务实例数小于分配给所述每个业务的微服务实例数的情况下,所述每个业务需要缩减的微服务实例数为分配给所述每个业务的微服务实例数与所述每个业务需要的微服务实例数的差值;在该情形下,无需弹出新的微服务实例;相反,需要把完成任务的微服务实例数进行缩减。In a case where the number of micro service instances required by each service is less than the number of micro service instances allocated to each service, the number of micro service instances required to be reduced by each service is the number of micro service instances allocated to each service The difference between the number of microservice instances and the number of microservice instances required for each business; in this case, there is no need to pop up a new microservice instance; instead, the number of microservice instances that complete the task needs to be reduced.
作为示例地,假设ToAlloc_InstanceNum(En)表示所述每个业务需要的微服务实例数;Current_InstanceNum(En)表示分配给所述每个业务的微服务实例数。当ToAlloc_InstanceNum(En)<Current_InstanceNum(En)时,需要把完成任务的微服务实例数缩减到ToAlloc_InstanceNum(En)。As an example, it is assumed that ToAlloc_InstanceNum (En) represents the number of microservice instances required by each service; Current_InstanceNum (En) represents the number of microservice instances allocated to each service. When ToAlloc_InstanceNum (En) <Current_InstanceNum (En), you need to reduce the number of microservice instances that complete the task to ToAlloc_InstanceNum (En).
在所述每个业务需要的微服务实例数大于分配给所述每个业务的微服务实例数、所述每个业务需要的微服务实例数小于等于可分配给所述每个业务的最大微服务实例数、且总资源没有空闲资源的情况下,所述每个业务需要增加的微服务实例数为分配给另一个业务的微服务实例数与可分配给所述另一个业务的最大微服务实例数的差值。The number of micro service instances required for each service is greater than the number of micro service instances allocated to each service, and the number of micro service instances required for each service is less than or equal to the maximum number of micro services that can be allocated to each service In the case of the number of service instances, and the total resources have no free resources, the number of micro service instances required for each service is the number of micro service instances allocated to another service and the maximum micro service that can be allocated to the other service The difference in the number of instances.
作为示例地,假设ToAlloc_InstanceNum(En)表示所述每个业务需要的微服务实例数;Current_InstanceNum(En)表示分配给所述每个业务的微服务实例数;MAX_InstanceNum(En)表示可分配给所述每个业务的最大微服务实例数;Current_InstanceNum(Em)表示分配给另一个业务的微服务实例数;MAX_InstanceNum(Em)表示可分配给所述另一个业务的最大微服务实例数的差值。As an example, it is assumed that ToAlloc_InstanceNum (En) represents the number of micro service instances required by each service; Current_InstanceNum (En) represents the number of micro service instances allocated to each service; MAX_InstanceNum (En) represents that it can be allocated to the services The maximum number of microservice instances for each business; Current_InstanceNum (Em) represents the number of microservice instances allocated to another business; MAX_InstanceNum (Em) represents the difference between the maximum number of microservice instances that can be allocated to the other business.
当ToAlloc_InstanceNum(En)<=MAX_InstanceNum(En)、ToAlloc_InstanceNum(En)>Current_InstanceNum(En)、且总资源没有空闲资源时,所述每个业务需要增加的微服务实例数为:Current_InstanceNum(Em)-MAX_InstanceNum(Em)。When ToAlloc_InstanceNum (En) <= MAX_InstanceNum (En), ToAlloc_InstanceNum (En)> Current_InstanceNum (En), and the total resources have no idle resources, the number of microservice instances that need to be increased for each service is: Current_InstanceNum (Em) -MAX_InstanceNum (Em).
步骤S13:根据所述每个业务需要增加或者缩减的微服务实例数,对所述每个业务的微服务实例数进行调整。Step S13: Adjust the number of microservice instances of each service according to the number of microservice instances required to be increased or decreased for each service.
在一种实施方式中,所述根据所述每个业务需要增加或者缩减的微服务实例数,对所述每个业务的微服务实例数进行调整,之前还包括:In an embodiment, the adjusting the number of micro service instances of each service according to the increase or reduction of the number of micro service instances required by each service further includes:
对所述每个业务需要增加的微服务实例数打上所述每个业务的标识;或者对所述每个业务需要缩减的微服务实例数去除所述每个业务的标识。The number of micro service instances required to be added to each service is marked with the identifier of each service; or the number of micro service instances required to be reduced for each service is removed from the identifier of each service.
作为示例地,业务En需要增加的微服务实例数,都要打上En标识。打上En标识的微服务实例,后续根据En标识只获取业务En的任务来执行;而一旦微服务实例被分配到其他业务(例如Em)时,该微服务实例需去除En标识并打上业务Em的标识。As an example, the number of micro service instances required for business En must be marked with En. The microservice instance marked with the En logo is then executed based on the task of obtaining only the business En, and once the microservice instance is assigned to other services (such as Em), the microservice instance needs to remove the En logo and be marked with the service Em Logo.
为了更好地阐述微服务实例弹性伸缩过程,以下结合图2、图3、以及应用场景进行说明:(其中图2为微服务实例弹性伸缩组件结构示意图,组件包括模型管理、资源管理以及业务任务池;图3为微服务实例弹性伸缩结构示意图,其中业务任务包括干扰任务和劣化检测任务)。In order to better explain the microservice instance elastic scaling process, the following is described in conjunction with Figure 2, Figure 3, and application scenarios: (where Figure 2 is a schematic diagram of the microservice instance elastic scaling component structure, which includes model management, resource management, and business tasks Pool; Figure 3 is a schematic diagram of an elastic scaling structure of a microservice instance, where business tasks include interference tasks and degradation detection tasks).
某司中国电信告警北向接口,采用传统的弹性伸缩策略,只是根据预设的资源占用定量进行弹性伸缩,往往滞后于业务处理请求,导致业务处理任务累积,造成需要时系统处理能力恶化,不需要时冗余资源占用。A company China Telecom's alarm northbound interface adopts a traditional elastic scaling strategy, which only quantifies elastic scaling based on a preset resource occupation. It often lags behind business processing requests, resulting in the accumulation of business processing tasks and causing the system processing capacity to deteriorate when needed. Occupies redundant resources.
设计CPU使用率超过80%增加5个实例,不区分业务,长期运行造成劣化检测任务堆积,连续增加导致申请资源失败,而智能干扰的资源使用率长期低于80%,释放的资源不能即时用于劣化检测。The design CPU usage exceeds 80% and increases by 5 instances. It does not distinguish between services. The long-term operation causes accumulation of degradation detection tasks. The continuous increase leads to failure in applying for resources. However, the intelligent interference resource usage rate is below 80% for a long time. The released resources cannot be used immediately. For degradation detection.
基于传统的弹性伸缩策略存在的问题,在一种应用情景中,模型管理模块设定两种业务:智能干扰定位(按需)、劣化检测(周期小时)。Based on the problems of the traditional elastic scaling strategy, in one application scenario, the model management module sets two services: intelligent interference location (on demand), and degradation detection (cycle time).
其中,业务可分配的最大资源MAX(En)=100,业务的资源配额比FUNC_RES(En)=30:70。Among them, the maximum resource that the service can allocate is MAX (En) = 100, and the resource quota ratio of the service is FUNC_RES (En) = 30: 70.
业务的任务数弹缩模型公式FUNC_INS(E1)对干扰任务:FUNC_INS (E1), the contraction model formula of the number of business tasks, for interference tasks:
100个任务,每个任务3秒处理时间,分配25个实例,实际12秒处理时间<15秒内;100个任务,每个任务2秒处理时间,分配17个实例,实际12秒处理时间。即要求100个任务分配的实例需要12秒~15秒内处理完,实际的每个任务耗时通过监测数据得到,周期按天进行调整。公式如下:100 tasks, each task has 3 seconds processing time, 25 instances are allocated, the actual 12 second processing time is less than 15 seconds; 100 tasks, each task is 2 seconds processing time, 17 instances are allocated, the actual 12 second processing time. That is, 100 instances of task assignment are required to be processed within 12 to 15 seconds. The actual time required for each task is obtained through monitoring data, and the cycle is adjusted on a daily basis. The formula is as follows:
ToAlloc_InstanceNum(En)=V_NumOfTotalTask/(V_12/Vone_task)。ToAlloc_InstanceNum (En) = V_NumOfTotalTask / (V_12 / Vone_task).
业务的任务数弹缩模型公式FUNC_INS(E2)对劣化检测任务:The number of business tasks shrinks the model formula FUNC_INS (E2) for degradation detection tasks:
100个任务,每个任务2秒处理时间,分配20个实例,实际10秒处理时间<12秒;100个任务,每个任务1.5秒处理时间,分配15个实例,实际10.5秒处理时间<12秒。即要求100个任务分配的实例需要10秒~12秒内处 理完,实际的每个任务耗时通过监测数据得到,周期按天进行调整。公式如下:100 tasks, 2 seconds processing time per task, 20 instances allocated, actual 10 seconds processing time <12 seconds; 100 tasks, 1.5 seconds processing time per task, 15 instances allocated, actual 10.5 seconds processing time <12 second. That is, 100 instances of task assignment are required to be processed within 10 to 12 seconds. The actual time required for each task is obtained through monitoring data, and the cycle is adjusted on a daily basis. The formula is as follows:
ToAlloc_InstanceNum(En)=V_NumOfTotalTask/(V_10/Vone_task)。ToAlloc_InstanceNum (En) = V_NumOfTotalTask / (V_10 / Vone_task).
资源管理模块根据设定信息,对业务的微服务实例数进行调整,调整后的信息如下表格所示:The resource management module adjusts the number of service microservice instances according to the setting information. The adjusted information is shown in the following table:
Figure PCTCN2019101856-appb-000001
Figure PCTCN2019101856-appb-000001
从该表格中可以看出,在第1-第3个监测周期中,需要的实例总数小于MAX(En)的情形中,各任务的实际分配的实例数与需要的实例数相同,即得到全力分配。在第4个监测周期中,需要的实例总数(38+80)大于MAX(En),因此优先按照业务的资源配额比的满配进行分配,高优先级任务可以抢夺使用低优先级任务的资源(实例)。It can be seen from the table that in the first to third monitoring cycles, when the total number of required instances is less than MAX (En), the actual number of instances allocated for each task is the same as the number of required instances. distribution. In the fourth monitoring cycle, the total number of required instances (38 + 80) is greater than MAX (En). Therefore, the priority is allocated according to the full allocation of the service's resource quota ratio. High-priority tasks can rob resources using low-priority tasks. (Example).
在另一种应用场景中,模型管理模块设定两种业务:智能干扰定位(按需)、劣化检测(周期小时)。其中,业务可分配的最大资源MAX(En)=100,业务的资源配额比FUNC_RES(En)=40:60。In another application scenario, the model management module sets two services: intelligent interference location (on demand), and degradation detection (cycle time). Among them, the maximum resource that the service can allocate is MAX (En) = 100, and the resource quota ratio of the service is FUNC_RES (En) = 40: 60.
业务的任务数弹缩模型公式FUNC_INS(E1)对干扰任务:100个任务,每个任务2.5秒处理时间,分配20个实例,实际12.5秒处理时间;100个任务,每个任务2秒处理时间,分配16个实例,实际14秒处理时间。即要求100个任务分配的实例需要12秒~15秒内处理完,实际的每个任务耗时通过监测数据得到,周期按天进行调整。公式如下:The number of business tasks shrinks the model formula FUNC_INS (E1) for interference tasks: 100 tasks, 2.5 seconds processing time for each task, 20 instances are allocated, the actual processing time is 12.5 seconds; 100 tasks, 2 seconds processing time for each task , Allocate 16 instances, the actual 14 seconds processing time. That is, 100 instances of task assignment are required to be processed within 12 to 15 seconds. The actual time required for each task is obtained through monitoring data, and the cycle is adjusted on a daily basis. The formula is as follows:
ToAlloc_InstanceNum(En)=V_NumOfTotalTask/(V_12/Vone_task)。ToAlloc_InstanceNum (En) = V_NumOfTotalTask / (V_12 / Vone_task).
业务的任务数弹缩模型公式FUNC_INS(E2)对劣化检测任务:100个任务,每个任务2.5秒处理时间,分配25个实例,实际10秒处理时间;100个任务,每个任务2秒处理时间,分配15个实例,实际10.5秒处理时间。 即要求100个任务分配的实例需要10秒~12秒内处理完,实际的每个任务耗时通过监测数据得到,周期按天进行调整。公式如下:The number of business tasks shrinks the model formula FUNC_INS (E2) for degradation detection tasks: 100 tasks, 2.5 seconds processing time per task, 25 instances allocated, actual 10 second processing time; 100 tasks, 2 seconds processing per task Time, 15 instances are allocated, and the actual processing time is 10.5 seconds. That is, 100 instances of task assignment are required to be processed within 10 to 12 seconds. The actual time required for each task is obtained through monitoring data, and the cycle is adjusted on a daily basis. The formula is as follows:
ToAlloc_InstanceNum(En)=V_NumOfTotalTask/(V_10/Vone_task)。ToAlloc_InstanceNum (En) = V_NumOfTotalTask / (V_10 / Vone_task).
资源管理模块根据设定信息,对业务的微服务实例数进行调整,调整后的信息如下表格所示:The resource management module adjusts the number of service microservice instances according to the setting information. The adjusted information is shown in the following table:
Figure PCTCN2019101856-appb-000002
Figure PCTCN2019101856-appb-000002
本申请实施例的微服务实例弹性伸缩方法,通过对多个业务中每个业务的微服务实例数进行动态调整;解决了现有弹性伸缩方式存在的不能满足多业务相互关联应用的要求的问题;在保证业务的处理能力不受其它业务的影响的情况下,确保各业务的微服务实例数都在最佳状况下;提升了资源利用率。The method for elastically scaling microservice instances according to the embodiment of the present application, by dynamically adjusting the number of microservice instances of each service in multiple services, solves the problem that existing elastic scaling methods cannot meet the requirements of multi-service interconnected applications. ; In the case of ensuring that the processing capacity of the business is not affected by other businesses, ensure that the number of microservice instances of each business is under the best conditions; and improve resource utilization.
第二实施例Second embodiment
如图4所示,本申请第二实施例提供一种微服务实例弹性伸缩装置,所述装置包括:存储器21、处理器22及存储在所述存储器21上并可在所述处理器22上运行的微服务实例弹性伸缩程序,所述微服务实例弹性伸缩程序被所述处理器22执行时,用于实现以下所述的微服务实例弹性伸缩方法的步骤:As shown in FIG. 4, a second embodiment of the present application provides a microservice instance elastic scaling device. The device includes: a memory 21, a processor 22, and stored on the memory 21 and may be on the processor 22. The running microservice instance elastic scaling program, when the microservice instance elastic scaling program is executed by the processor 22, is used to implement the steps of the microservice instance elastic scaling method described below:
获取总资源中的空闲资源状况、多个业务中每个业务需要的微服务实例数、分配给所述每个业务的微服务实例数以及可分配给所述每个业务的最大微服务实例数;根据所述总资源中的空闲资源状况、所述每个业务需要的微 服务实例数、分配给所述每个业务的微服务实例数、以及可分配给所述每个业务的最大微服务实例数,计算所述每个业务需要增加或者缩减的微服务实例数;根据所述每个业务需要增加或者缩减的微服务实例数,对所述每个业务的微服务实例数进行调整。Obtaining the status of idle resources in the total resources, the number of microservice instances required by each service in multiple services, the number of microservice instances allocated to each service, and the maximum number of microservice instances that can be allocated to each service ; According to the idle resource status in the total resources, the number of micro service instances required by each service, the number of micro service instances allocated to each service, and the maximum micro service that can be allocated to each service The number of instances calculates the number of micro service instances that each business needs to increase or decrease; and adjusts the number of micro service instances of each business according to the number of micro service instances that each business needs to increase or decrease.
所述微服务实例弹性伸缩程序被所述处理器22执行时,还用于实现以下所述的微服务实例弹性伸缩方法的步骤:When the microservice instance elastic scaling program is executed by the processor 22, it is also used to implement the steps of the microservice instance elastic scaling method described below:
获取总资源、所述每个业务的任务数、单任务耗时、所述每个业务的任务数弹缩模型公式、以及所述每个业务的资源配额比;根据所述每个业务的任务数、所述单任务耗时以及所述每个业务的任务数弹缩模型公式,计算所述每个业务需要的微服务实例数;根据所述总资源、以及所述每个业务的资源配额比,计算可分配给所述每个业务的最大微服务实例数。Obtaining the total resources, the number of tasks of each service, the time required for a single task, the shrinking model formula of the number of tasks of each service, and the resource quota ratio of each service; according to the tasks of each service Number, the time required for the single task, and the shrinking model formula for the number of tasks for each service to calculate the number of microservice instances required for each service; based on the total resources and the resource quota for each service Ratio, calculating the maximum number of microservice instances that can be allocated to each business.
所述微服务实例弹性伸缩程序被所述处理器22执行时,还用于实现以下所述的微服务实例弹性伸缩方法的步骤:When the microservice instance elastic scaling program is executed by the processor 22, it is also used to implement the steps of the microservice instance elastic scaling method described below:
记录所述每个业务的任务数以及时间信息;根据记录的所述每个业务的任务数以及时间信息得到新的单任务耗时;在所述新的单任务耗时与所述单任务耗时的变化率超过预设值的情况下,调整所述单任务耗时。Recording the number of tasks and time information of each business; obtaining a new single task time according to the recorded number of tasks and time information of each business; in the new single task time and the single task time When the change rate of time exceeds a preset value, adjusting the time consumption of the single task.
所述微服务实例弹性伸缩程序被所述处理器22执行时,还用于实现以下所述的微服务实例弹性伸缩方法的步骤:When the microservice instance elastic scaling program is executed by the processor 22, it is also used to implement the steps of the microservice instance elastic scaling method described below:
在所述新的单任务耗时相比缺省的单任务耗时下降连续超过预设时间的情况下,调整所述每个业务的资源配额比。In a case where the time consumption of the new single task decreases compared with the default time consumption of the single task continuously over a preset time, the resource quota ratio of each service is adjusted.
所述微服务实例弹性伸缩程序被所述处理器22执行时,还用于实现以下所述的微服务实例弹性伸缩方法的步骤:When the microservice instance elastic scaling program is executed by the processor 22, it is also used to implement the steps of the microservice instance elastic scaling method described below:
计算所有业务需要的微服务实例总数;在所有业务需要的微服务实例总数小于总资源的情况下,将计算的所述每个业务需要的微服务实例数分配给所述每个业务进行使用;在所有业务需要的微服务实例总数大于总资源的情况下,根据业务优先级及其资源抢占规则对所述每个业务进行微服务实例数的分配。Calculate the total number of micro service instances required by all services; and if the total number of micro service instances required by all services is less than the total resources, allocate the calculated number of micro service instances required by each service to each service for use; When the total number of micro service instances required by all services is greater than the total resources, the number of micro service instances is allocated to each service according to the service priority and its resource preemption rules.
所述微服务实例弹性伸缩程序被所述处理器22执行时,还用于实现以下所述的微服务实例弹性伸缩方法的步骤:When the microservice instance elastic scaling program is executed by the processor 22, it is also used to implement the steps of the microservice instance elastic scaling method described below:
确定所述业务优先级及其资源抢占规则。Determining the service priority and its resource preemption rule.
所述微服务实例弹性伸缩程序被所述处理器22执行时,还用于实现以下所述的微服务实例弹性伸缩方法的步骤:When the microservice instance elastic scaling program is executed by the processor 22, it is also used to implement the steps of the microservice instance elastic scaling method described below:
在所述每个业务需要的微服务实例数大于分配给所述每个业务的微服务实例数、分配给所述每个业务的微服务实例数等于可分配给所述每个业务的最大微服务实例数、且总资源还有空闲资源的情况下,所述每个业务需要增加的微服务实例数为所述每个业务需要的微服务实例数与分配给所述每个业务的微服务实例数的差值;在所述每个业务需要的微服务实例数大于分配给所述每个业务的微服务实例数、分配给所述每个业务的微服务实例数等于可分配给所述每个业务的最大微服务实例数、且总资源没有空闲资源的情况下,所述每个业务需要增加或者缩减的微服务实例数为零;在所述每个业务需要的微服务实例数小于分配给所述每个业务的微服务实例数的情况下,所述每个业务需要缩减的微服务实例数为分配给所述每个业务的微服务实例数与所述每个业务需要的微服务实例数的差值;在所述每个业务需要的微服务实例数大于分配给所述每个业务的微服务实例数、所述每个业务需要的微服务实例数小于等于可分配给所述每个业务的最大微服务实例数、且总资源没有空闲资源的情况下,所述每个业务需要增加的微服务实例数为分配给另一个业务的微服务实例数与可分配给所述另一个业务的最大微服务实例数的差值。The number of micro service instances required in each service is greater than the number of micro service instances allocated to each service, and the number of micro service instances allocated to each service is equal to the maximum number of micro services that can be allocated to each service In the case of the number of service instances and total resources and free resources, the number of microservice instances required for each service is the number of microservice instances required for each service and the microservices allocated to each service The difference between the number of instances; the number of microservice instances required in each business is greater than the number of microservice instances allocated to each business, and the number of microservice instances allocated to each business is equal to the number of microservice instances that can be allocated to the In the case where the maximum number of microservice instances of each service and the total resources have no idle resources, the number of microservice instances required to be increased or decreased for each service is zero; the number of microservice instances required for each service is less than In the case of the number of micro service instances allocated to each service, the number of micro service instances to be reduced for each service is the number of micro service instances allocated to each service and the number of micro services instances allocated to each service. The difference between the number of required microservice instances; the number of microservice instances required in each business is greater than the number of microservice instances allocated to each business, and the number of microservice instances required in each business is less than or equal to In the case that the maximum number of micro service instances allocated to each service and the total resources have no free resources, the number of micro service instances required to be added for each service is the number of micro service instances allocated to another service and the number of allocable resources The difference between the maximum number of microservice instances for the other business.
所述微服务实例弹性伸缩程序被所述处理器22执行时,还用于实现以下所述的微服务实例弹性伸缩方法的步骤:When the microservice instance elastic scaling program is executed by the processor 22, it is also used to implement the steps of the microservice instance elastic scaling method described below:
对所述每个业务需要增加的微服务实例数打上所述每个业务的标识;或者对所述每个业务需要缩减的微服务实例数去除所述每个业务的标识。The number of micro service instances required to be added to each service is marked with the identifier of each service; or the number of micro service instances required to be reduced for each service is removed from the identifier of each service.
本申请实施例的微服务实例弹性伸缩装置,通过对多个业务中每个业务的微服务实例数进行动态调整;解决了现有弹性伸缩方式存在的不能满足多业务相互关联应用的要求的问题;在保证业务的处理能力不受其它业务的影响的情况下,确保各业务的微服务实例数都在最佳状况下;提升了资源利用率。The microservice instance elastic scaling device of the embodiment of the present application dynamically adjusts the number of microservice instances of each service in multiple services; and solves the problem that the existing elastic scaling method cannot meet the requirements of multi-service interconnected applications. ; In the case of ensuring that the processing capacity of the business is not affected by other businesses, ensure that the number of microservice instances of each business is under the best conditions; and improve resource utilization.
第三实施例Third embodiment
本申请第三实施例提供一种计算机可读存储介质,所述计算机可读存储介质上存储有微服务实例弹性伸缩程序,所述微服务实例弹性伸缩程序被处理器执行时用于实现第一实施例所述的微服务实例弹性伸缩方法的步骤。A third embodiment of the present application provides a computer-readable storage medium. The computer-readable storage medium stores a microservice instance elastic scaling program. The microservice instance elastic scaling program is used to implement a first service when executed by a processor. The steps of the microservice instance elastic scaling method described in the embodiment.
需要说明的是,本实施例的计算机可读存储介质,与第一实施例的方法属于同一构思,其具体实现过程详细见方法实施例,且方法实施例中的技术特征在本实施例中均对应适用,这里不再赘述。It should be noted that the computer-readable storage medium of this embodiment belongs to the same concept as the method of the first embodiment. The specific implementation process is described in detail in the method embodiment, and the technical features in the method embodiment are all in this embodiment. Correspondence applies, and is not repeated here.
本申请实施例的计算机可读存储介质,通过对多个业务中每个业务的微服务实例数进行动态调整;解决了现有弹性伸缩方式存在的不能满足多业务相互关联应用的要求的问题;在保证业务的处理能力不受其它业务的影响的情况下,确保各业务的微服务实例数都在最佳状况下;提升了资源利用率。The computer-readable storage medium of the embodiment of the present application dynamically adjusts the number of micro service instances of each service in multiple services; and solves the problem that the existing elastic scaling method cannot meet the requirements of multi-service interconnected applications; In the case that the processing capacity of the business is not affected by other businesses, the number of microservice instances of each business is under the optimal condition; the resource utilization rate is improved.
第四实施例Fourth embodiment
本申请实施例的计算机程序产品,所述计算机程序产品包括存储在非暂态计算机可读存储介质上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,使所述计算机执行上述任意方法实施例中的方法。The computer program product of the embodiment of the present application includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, The computer executes the method in any of the above method embodiments.
本领域普通技术人员可以理解,上文中所公开方法中的全部或某些步骤、系统、装置中的功能模块/单元可以被实施为软件、固件、硬件及其适当的组合。在硬件实施方式中,在以上描述中提及的功能模块/单元之间的划分不一定对应于物理组件的划分;例如,一个物理组件可以具有多个功能,或者一个功能或步骤可以由若干物理组件合作执行。某些物理组件或所有物理组件可以被实施为由处理器,如中央处理器、数字信号处理器或微处理器执行的软件,或者被实施为硬件,或者被实施为集成电路,如专用集成电路。这样的软件可以分布在计算机可读介质上,计算机可读介质可以包括计算机存储介质(或非暂时性介质)和通信介质(或暂时性介质)。如本领域普通技术人员公知的,术语计算机存储介质包括在用于存储信息(诸如计算机可读指令、数据结构、程序模块或其他数据)的任何方法或技术中实施的易失性和非易失性、可移除和不可移除介质。计算机存储介质包括但不限于RAM、ROM、EEPROM、闪存或其他存储器技术、CD-ROM、数字多功能盘(DVD)或其他光盘存储、磁盒、磁带、磁盘存储或其他磁存储装置、或者可以用于存储期望的信息并且可以被计算机访问的任何其他的介质。此外,本领域普通技术人员公知的是,通信介质通常包含计算机可读指令、数据结构、程序模块或者诸如载波或其他传输机制之类的调制数据信号中的其他数据,并且可包括任何信息递送介质。Those of ordinary skill in the art can understand that all or some of the steps, systems, and functional modules / units in the devices disclosed in the methods above can be implemented as software, firmware, hardware, and appropriate combinations thereof. In a hardware implementation, the division between functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be composed of several physical The components execute cooperatively. Some or all physical components can be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit . Such software may be distributed on computer-readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). As is known to those of ordinary skill in the art, the term computer storage medium includes volatile and non-volatile implemented in any method or technology used to store information such as computer-readable instructions, data structures, program modules or other data. Removable, removable and non-removable media. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or may Any other medium used to store desired information and which can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that a communication medium typically contains computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and may include any information delivery medium .
以上参照附图说明了本申请的优选实施例,并非因此局限本申请的权利范围。本领域技术人员不脱离本申请的范围和实质内所作的任何修改、等同替换和改进,均应在本申请的权利范围之内。The preferred embodiments of the present application have been described above with reference to the accompanying drawings, and thus do not limit the scope of rights of the present application. Any modification, equivalent replacement, and improvement made by those skilled in the art without departing from the scope and substance of this application shall fall within the scope of rights of this application.

Claims (10)

  1. 一种微服务实例弹性伸缩方法,所述方法包括:A microservice instance elastic scaling method, the method includes:
    获取总资源中的空闲资源状况、多个业务中每个业务需要的微服务实例数、分配给所述每个业务的微服务实例数以及可分配给所述每个业务的最大微服务实例数;Obtaining the status of idle resources in the total resources, the number of microservice instances required by each service in multiple services, the number of microservice instances allocated to each service, and the maximum number of microservice instances that can be allocated to each service ;
    根据所述总资源中的空闲资源状况、所述每个业务需要的微服务实例数、分配给所述每个业务的微服务实例数、以及可分配给所述每个业务的最大微服务实例数,计算所述每个业务需要增加或者缩减的微服务实例数;According to the idle resource status in the total resources, the number of micro service instances required by each service, the number of micro service instances allocated to each service, and the maximum micro service instance that can be allocated to each service Number, calculating the number of micro service instances that each business needs to increase or decrease;
    根据所述每个业务需要增加或者缩减的微服务实例数,对所述每个业务的微服务实例数进行调整。Adjusting the number of micro service instances of each service according to the number of micro service instances required to be increased or decreased for each service.
  2. 根据权利要求1所述的方法,其中,所述获取总资源中的空闲资源状况、多个业务中每个业务需要的微服务实例数、分配给所述每个业务的微服务实例数以及可分配给所述每个业务的最大微服务实例数,之前还包括:The method according to claim 1, wherein said obtaining the free resource status in the total resources, the number of micro service instances required by each service in the plurality of services, the number of micro service instances allocated to each service, and the available The maximum number of micro service instances allocated to each service previously also includes:
    获取总资源、所述每个业务的任务数、单任务耗时、所述每个业务的任务数弹缩模型公式、以及所述每个业务的资源配额比;Obtaining the total resources, the number of tasks of each service, the time required for a single task, the shrinking model formula of the number of tasks of each service, and the resource quota ratio of each service;
    根据所述每个业务的任务数、所述单任务耗时以及所述每个业务的任务数弹缩模型公式,计算所述每个业务需要的微服务实例数;Calculating the number of microservice instances required by each service according to the number of tasks of each service, the time consumption of the single task, and the shrinking model formula of the number of tasks of each service;
    根据所述总资源、以及所述每个业务的资源配额比,计算可分配给所述每个业务的最大微服务实例数。Calculating the maximum number of microservice instances that can be allocated to each service according to the total resources and the resource quota ratio of each service.
  3. 根据权利要求2所述的方法,其中,所述获取总资源、所述每个业务的任务数、单任务耗时、所述每个业务的任务数弹缩模型公式、以及所述每个业务的资源配额比,之前还包括:The method according to claim 2, wherein the obtaining total resources, the number of tasks per business, the time required for a single task, the shrinking model formula of the number of tasks per business, and the each business The resource quota ratio, including:
    记录所述每个业务的任务数以及时间信息;Record the number of tasks and time information of each service;
    根据记录的所述每个业务的任务数以及时间信息得到新的单任务耗时;Obtaining a new single task time consuming according to the recorded number of tasks and time information of each service;
    在所述新的单任务耗时与所述单任务耗时的变化率超过预设值的情况下,调整所述单任务耗时。When the rate of change between the new single task time and the single task time exceeds a preset value, adjust the single task time.
  4. 根据权利要求3所述的方法,其中,所述根据记录的所述每个业务的任 务数以及时间信息得到新的单任务耗时,之后还包括:The method according to claim 3, wherein the obtaining a new single task is time-consuming based on the recorded number of tasks and time information of each service, and further comprising:
    在所述新的单任务耗时相比缺省的单任务耗时下降连续超过预设时间的情况下,调整所述每个业务的资源配额比。In a case where the time consumption of the new single task decreases compared with the default time consumption of the single task continuously over a preset time, the resource quota ratio of each service is adjusted.
  5. 根据权利要求2所述的方法,其中,所述根据所述每个业务的任务数、所述单任务耗时以及所述每个业务的任务数弹缩模型公式,计算所述每个业务需要的微服务实例数,之后还包括:The method according to claim 2, wherein the calculation of the needs of each service is based on a shrinking model formula of the number of tasks of each service, the time consumption of the single task, and the number of tasks of each service. Number of microservice instances, after which also includes:
    计算所有业务需要的微服务实例总数;Calculate the total number of microservice instances required for all business;
    在所有业务需要的微服务实例总数小于总资源的情况下,将计算的所述每个业务需要的微服务实例数分配给所述每个业务进行使用;When the total number of micro service instances required by all services is less than the total resources, allocating the calculated number of micro service instances required by each service to each service for use;
    在所有业务需要的微服务实例总数大于总资源的情况下,根据业务优先级及其资源抢占规则对所述每个业务进行微服务实例数的分配。When the total number of micro service instances required by all services is greater than the total resources, the number of micro service instances is allocated to each service according to the service priority and its resource preemption rules.
  6. 根据权利要求5所述的方法,其中,所述根据业务优先级及其资源抢占规则对所述每个业务进行微服务实例数的分配,之前还包括:The method according to claim 5, wherein the distributing the number of microservice instances to each service according to the service priority and its resource preemption rules further comprises:
    确定所述业务优先级及其资源抢占规则。Determining the service priority and its resource preemption rule.
  7. 根据权利要求1所述的方法,其中,所述根据所述总资源中的空闲资源状况、所述每个业务需要的微服务实例数、分配给所述每个业务的微服务实例数、以及可分配给所述每个业务的最大微服务实例数,计算所述每个业务需要增加或者缩减的微服务实例数,包括:The method according to claim 1, wherein said according to a state of free resources in said total resources, the number of microservice instances required by said each service, the number of microservice instances allocated to said each service, and The maximum number of micro service instances that can be allocated to each service, and calculating the number of micro service instances that each service needs to increase or decrease includes:
    在所述每个业务需要的微服务实例数大于分配给所述每个业务的微服务实例数、分配给所述每个业务的微服务实例数等于可分配给所述每个业务的最大微服务实例数、且总资源还有空闲资源的情况下,所述每个业务需要增加的微服务实例数为所述每个业务需要的微服务实例数与分配给所述每个业务的微服务实例数的差值;The number of micro service instances required in each service is greater than the number of micro service instances allocated to each service, and the number of micro service instances allocated to each service is equal to the maximum number of micro services that can be allocated to each service In the case of the number of service instances and total resources and free resources, the number of microservice instances required for each service is the number of microservice instances required for each service and the microservices allocated to each service The difference in the number of instances;
    在所述每个业务需要的微服务实例数大于分配给所述每个业务的微服务实例数、分配给所述每个业务的微服务实例数等于可分配给所述每个业务的最大微服务实例数、且总资源没有空闲资源的情况下,所述每个业务需要增加或者缩减的微服务实例数为零;The number of micro service instances required in each service is greater than the number of micro service instances allocated to each service, and the number of micro service instances allocated to each service is equal to the maximum number of micro services that can be allocated to each service In the case where the number of service instances and total resources have no idle resources, the number of micro service instances that each business needs to increase or decrease is zero;
    在所述每个业务需要的微服务实例数小于分配给所述每个业务的微服务实 例数的情况下,所述每个业务需要缩减的微服务实例数为分配给所述每个业务的微服务实例数与所述每个业务需要的微服务实例数的差值;In a case where the number of micro service instances required by each service is less than the number of micro service instances allocated to each service, the number of micro service instances required to be reduced by each service is the number of micro service instances allocated to each service A difference between the number of micro service instances and the number of micro service instances required by each service;
    在所述每个业务需要的微服务实例数大于分配给所述每个业务的微服务实例数、所述每个业务需要的微服务实例数小于等于可分配给所述每个业务的最大微服务实例数、且总资源没有空闲资源的情况下,所述每个业务需要增加的微服务实例数为分配给另一个业务的微服务实例数与可分配给所述另一个业务的最大微服务实例数的差值。The number of micro service instances required for each service is greater than the number of micro service instances allocated to each service, and the number of micro service instances required for each service is less than or equal to the maximum number of micro services that can be allocated to each service In the case of the number of service instances, and the total resources have no free resources, the number of micro service instances required for each service is the number of micro service instances allocated to another service and the maximum micro service that can be allocated to the other service The difference in the number of instances.
  8. 根据权利要求1所述的方法,其中,所述根据所述每个业务需要增加或者缩减的微服务实例数,对所述每个业务的微服务实例数进行调整,之前还包括:The method according to claim 1, wherein the adjusting the number of microservice instances of each service according to the increase or decrease of the number of microservice instances required by each service further comprises:
    对所述每个业务需要增加的微服务实例数打上所述每个业务的标识;或者对所述每个业务需要缩减的微服务实例数去除所述每个业务的标识。The number of micro service instances required to be added to each service is marked with the identifier of each service; or the number of micro service instances required to be reduced for each service is removed from the identifier of each service.
  9. 一种微服务实例弹性伸缩装置,其中,所述装置包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的微服务实例弹性伸缩程序,所述微服务实例弹性伸缩程序被所述处理器执行时实现如权利要求1至8中任一项所述的微服务实例弹性伸缩方法的步骤。A microservice instance elastic scaling device, wherein the device includes a memory, a processor, and a microservice instance elastic scaling program stored on the memory and operable on the processor, and the microservice instance elastically scales When the program is executed by the processor, the steps of the microservice instance elastic scaling method according to any one of claims 1 to 8 are implemented.
  10. 一种计算机可读存储介质,其中,所述计算机可读存储介质上存储有微服务实例弹性伸缩程序,所述微服务实例弹性伸缩程序被所述处理器执行时实现如权利要求1至8中任一项所述的微服务实例弹性伸缩方法的步骤。A computer-readable storage medium, wherein a microservice instance elastic scaling program is stored on the computer-readable storage medium, and the microservice instance elastic scaling program is implemented as claimed in claims 1 to 8 when executed by the processor. Steps of the microservice instance elastic scaling method according to any one.
PCT/CN2019/101856 2018-09-28 2019-08-21 Flexible scaling method for microservice instances, device, and storage medium WO2020063206A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811136091.6 2018-09-28
CN201811136091.6A CN110971623B (en) 2018-09-28 2018-09-28 Micro-service instance elastic scaling method and device and storage medium

Publications (1)

Publication Number Publication Date
WO2020063206A1 true WO2020063206A1 (en) 2020-04-02

Family

ID=69951018

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/101856 WO2020063206A1 (en) 2018-09-28 2019-08-21 Flexible scaling method for microservice instances, device, and storage medium

Country Status (2)

Country Link
CN (1) CN110971623B (en)
WO (1) WO2020063206A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111459681A (en) * 2020-04-07 2020-07-28 上海熙菱信息技术有限公司 Dynamic elastic expansion method based on micro-service load
CN111858042A (en) * 2020-07-10 2020-10-30 苏州浪潮智能科技有限公司 Method and device for verifying micro-service governance quota opening based on domestic cloud platform
CN112243024A (en) * 2020-09-17 2021-01-19 北京金山云网络技术有限公司 Service control method, device, server and storage medium
CN112685153A (en) * 2020-12-25 2021-04-20 广州奇盾信息技术有限公司 Micro-service scheduling method and device and electronic equipment

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112565391A (en) * 2020-12-01 2021-03-26 瀚云科技有限公司 Method, apparatus, device and medium for adjusting instances in an industrial internet platform
CN115250230A (en) * 2022-07-22 2022-10-28 中国电信股份有限公司 Network element timer management method, system and related equipment based on micro-service

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107734066A (en) * 2017-11-16 2018-02-23 郑州云海信息技术有限公司 A kind of data center's total management system services administering method
CN108234589A (en) * 2016-12-22 2018-06-29 瞻博网络公司 The auto zoom of micro services application
US20180198845A1 (en) * 2017-01-09 2018-07-12 International Business Machines Corporation Local Microservice Development for Remote Deployment
WO2018144060A1 (en) * 2017-02-05 2018-08-09 Intel Corporation Microservice provision and management

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108206852B (en) * 2016-12-20 2020-12-22 华为技术有限公司 Session-based service instance management method and device under micro-service framework
CN108259522A (en) * 2016-12-28 2018-07-06 中兴通讯股份有限公司 A kind of bullet contracting method and device of PaaS platform containerization application
CN107104846A (en) * 2017-06-02 2017-08-29 北京北信源软件股份有限公司 A kind of method for realizing resource distribution, device and resource distribution center
CN108021447B (en) * 2017-11-28 2021-08-03 象翌微链科技发展有限公司 Method and system for determining optimal resource strategy based on distributed data

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108234589A (en) * 2016-12-22 2018-06-29 瞻博网络公司 The auto zoom of micro services application
US20180198845A1 (en) * 2017-01-09 2018-07-12 International Business Machines Corporation Local Microservice Development for Remote Deployment
WO2018144060A1 (en) * 2017-02-05 2018-08-09 Intel Corporation Microservice provision and management
CN107734066A (en) * 2017-11-16 2018-02-23 郑州云海信息技术有限公司 A kind of data center's total management system services administering method

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111459681A (en) * 2020-04-07 2020-07-28 上海熙菱信息技术有限公司 Dynamic elastic expansion method based on micro-service load
CN111459681B (en) * 2020-04-07 2023-08-08 上海熙菱信息技术有限公司 Dynamic elastic telescoping method based on micro-service load
CN111858042A (en) * 2020-07-10 2020-10-30 苏州浪潮智能科技有限公司 Method and device for verifying micro-service governance quota opening based on domestic cloud platform
CN111858042B (en) * 2020-07-10 2023-01-10 苏州浪潮智能科技有限公司 Method and device for verifying micro-service governance quota opening based on domestic cloud platform
CN112243024A (en) * 2020-09-17 2021-01-19 北京金山云网络技术有限公司 Service control method, device, server and storage medium
CN112243024B (en) * 2020-09-17 2022-05-06 北京金山云网络技术有限公司 Service control method, device, server and storage medium
CN112685153A (en) * 2020-12-25 2021-04-20 广州奇盾信息技术有限公司 Micro-service scheduling method and device and electronic equipment

Also Published As

Publication number Publication date
CN110971623A (en) 2020-04-07
CN110971623B (en) 2023-02-17

Similar Documents

Publication Publication Date Title
WO2020063206A1 (en) Flexible scaling method for microservice instances, device, and storage medium
US10772115B2 (en) Resource scheduling method and server
US20170201574A1 (en) Method, system, and device for allocating resources in a server
CN109582447B (en) Computing resource allocation method, task processing method and device
CN109412841A (en) Method of adjustment, device and the cloud platform of resources of virtual machine
CN110661824B (en) Flow control method of server in distributed cluster and storage medium
CN107800574B (en) Storage QOS adjusting method, system, equipment and computer readable memory
CN112749002A (en) Method and device for dynamically managing cluster resources
CN112445857A (en) Resource quota management method and device based on database
EP4177745A1 (en) Resource scheduling method, electronic device, and storage medium
CN106936867A (en) The response method and device of a kind of service request
CN112214288B (en) Pod scheduling method, device, equipment and medium based on Kubernetes cluster
CN111190719B (en) Method, device, medium and electronic equipment for optimizing cluster resource allocation
CN107872480B (en) Big data cluster data balancing method and device
CN106775925B (en) Quota processing method and device for CPU of virtual machine
US11513856B2 (en) Method, devices and computer program products for resource usage
US20150117259A1 (en) System and method for artificial intelligence cloud management
US20200228461A1 (en) Resource allocation using restore credits
US20140380304A1 (en) Methods and systems for energy management in a virtualized data center
CN110838989A (en) Method and device for network current limiting based on token
CN115941622A (en) Bandwidth adjusting method, system, equipment and storage medium
CN112612583B (en) Data synchronization method, device, computer equipment and readable storage medium
US10540341B1 (en) System and method for dedupe aware storage quality of service
CN108829520B (en) Server resource allocation method and device in cloud environment
CN110457130B (en) Distributed resource elastic scheduling model, method, electronic equipment and 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: 19865640

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: 19865640

Country of ref document: EP

Kind code of ref document: A1