CN114490078A - Dynamic capacity reduction and expansion method, device and equipment for micro-service - Google Patents

Dynamic capacity reduction and expansion method, device and equipment for micro-service Download PDF

Info

Publication number
CN114490078A
CN114490078A CN202210128324.8A CN202210128324A CN114490078A CN 114490078 A CN114490078 A CN 114490078A CN 202210128324 A CN202210128324 A CN 202210128324A CN 114490078 A CN114490078 A CN 114490078A
Authority
CN
China
Prior art keywords
micro
service
current
instances
index
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202210128324.8A
Other languages
Chinese (zh)
Inventor
周健
许祺
王中伟
陈维强
孙永良
李建伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qingdao Guochuang Wisdom Cloud Brain Technology Co.,Ltd.
Hisense TransTech Co Ltd
Original Assignee
Hisense TransTech Co Ltd
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 Hisense TransTech Co Ltd filed Critical Hisense TransTech Co Ltd
Priority to CN202210128324.8A priority Critical patent/CN114490078A/en
Publication of CN114490078A publication Critical patent/CN114490078A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load

Abstract

The application provides a dynamic capacity shrinkage and expansion method, a dynamic capacity shrinkage and expansion device and a dynamic capacity shrinkage and expansion device for micro services, wherein according to example operation data of the micro services, current index values corresponding to at least one predefined micro service load degree index are obtained; comparing the current index value with a corresponding preset expected index value, and determining a capacity reduction coefficient corresponding to the preset expected index value according to a comparison result when the capacity reduction condition is met according to the comparison result; and determining the number of target examples according to the capacity reduction and expansion coefficient, and adjusting the number of the examples of the current micro-service to the number of the target examples.

Description

Dynamic capacity reduction and expansion method, device and equipment for micro-service
Technical Field
The application relates to the technical field of cloud computing, in particular to a dynamic capacity shrinking and expanding method, device and equipment for micro-service.
Background
With the rapid development of the internet, the data volume is increased explosively, and higher requirements are put on the performance of a business system. The micro-service architecture has come and come, the expansibility and the reliability of the system are improved, and the maintenance cost of the system is reduced. In some scenarios, the access amount of the micro-service is greatly increased, the performance of the micro-service is not enough to support a huge access amount, and when the access amount is reduced, too many micro-service instances occupy server resources to cause resource waste.
Disclosure of Invention
The embodiment of the application provides a dynamic capacity reduction and expansion method, a dynamic capacity reduction and expansion device and dynamic capacity reduction and expansion equipment for micro services, and aims to solve the problems that the access quantity of the micro services is greatly increased, the performance of the micro services is not enough to support huge access quantity, and when the access quantity is reduced, excessive micro service instances occupy server resources unnecessarily, so that resource waste is caused.
In a first aspect, an embodiment of the present application provides a method for dynamic capacity reduction and expansion of a microservice, where the method includes:
obtaining current index values corresponding to at least one predefined micro-service load degree index according to the micro-service instance operation data;
comparing the current index value with a corresponding preset expected index value, and determining a capacity reduction coefficient corresponding to the preset expected index value according to a comparison result when the capacity reduction condition is met according to the comparison result;
and determining the number of target instances according to the capacity reduction coefficient, and adjusting the number of the instances of the current micro service to the number of the target instances.
In a possible implementation manner, obtaining current index values respectively corresponding to at least one predefined micro-service load degree index according to the instance operation data of the current micro-service includes at least one of the following steps:
counting the number of access requests received by the current micro-service instance to obtain a current index value of the micro-service access amount index;
counting the server resources occupied by the current micro-service instance to obtain a current index value of the micro-server resource occupation index;
the micro server resource occupation index comprises CPU utilization rate and/or memory occupation rate.
In a possible implementation manner, the method includes the following steps that a plurality of predefined microservice load degree indexes are provided, and a capacity reduction and expansion coefficient corresponding to a preset expected index value is determined according to a comparison result, and the method includes:
taking the ratio of the current index value corresponding to each micro service load degree index to the corresponding preset expected index value as a capacity shrinkage and expansion coefficient corresponding to each micro service load degree index;
calculating the product of the number of the current examples and the reduction-expansion coefficient corresponding to each micro-service load degree index, and rounding the product upwards to obtain the number of the target examples corresponding to each micro-service load degree index;
and determining the maximum value of the target example number corresponding to each micro-service load degree index as the target example number corresponding to the micro-service.
In a possible implementation manner, the determining that the capacity reduction condition is met according to the comparison result includes:
determining the ratio of the current index value corresponding to each micro-service load degree index to the corresponding preset expected index value;
if the ratio corresponding to any micro-service load degree index is larger than the corresponding first preset tolerance value, determining that the capacity expansion condition is met;
and if the ratio corresponding to any micro-service load degree index is smaller than the second tolerance value, determining that the capacity reduction condition is met.
In a possible implementation manner, obtaining current index values respectively corresponding to at least one predefined micro-service load degree index according to the instance operation data of the micro-service includes:
acquiring example operation data of the micro-service in different measurement types, wherein the example operation data of the different measurement types comprises data of an accumulation measurement type, data of a length measurement type, data of a histogram measurement type and data of a summary measurement type;
and determining the current index values corresponding to at least one predefined micro-service load degree index respectively according to the running data of the micro-service with different measurement types.
In one possible implementation, adjusting the number of instances of the current microservice to the target number of instances comprises:
responding to the capacity expansion instruction, and inquiring a target server where an unoccupied instance access port is located; sending a service starting script to the target server to start a corresponding instance until the number of the instances of the current micro service is adjusted to the number of the target instances; or
And responding to the capacity reduction instruction, determining the running stopping instances and sending scripts of the running stopping instances to the target server where the running stopping instances are located until the number of the instances of the current micro service is adjusted to the number of the target instances.
In a possible implementation manner, before adjusting the number of instances of the current microservice to the target number of instances, the method further includes:
acquiring all current examples of the micro-service, and screening out a first example which is stopped running and a second example which is not acquired and used for calculating the micro-service load degree index;
and determining the number of the screened instances of the micro-service as the number of the instances of the current micro-service.
In a second aspect, an embodiment of the present application provides a dynamic companding apparatus, where the apparatus includes:
a module for determining a current index value, which is used for obtaining the current index value corresponding to at least one predefined micro-service load degree index according to the micro-service instance operation data;
a module for determining a reduction-expansion coefficient, configured to compare the current index value with a corresponding preset expected index value, and determine, according to a comparison result, a reduction-expansion coefficient corresponding to the preset expected index value when it is determined that a reduction-expansion condition is satisfied;
and the adjusting example number module is used for determining the target example number according to the capacity reduction coefficient and adjusting the number of the examples of the current micro service to the target example number.
In a third aspect, an embodiment of the present application provides a dynamic capacity reduction and expansion device, where the device includes:
at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform any one of microservice dynamic companding methods.
In a fourth aspect, an embodiment of the present application provides a computer storage medium storing a computer program for causing a computer to execute any one of the dynamic capacity reduction methods for microservices.
The embodiment of the application provides a dynamic capacity reduction method, a dynamic capacity reduction device and dynamic capacity reduction equipment for micro-services. By the method, the micro-service operation performance is ensured, and meanwhile, the waste of server resources is avoided.
Drawings
FIG. 1 is a flowchart illustrating a method for dynamic companding of a microservice according to an exemplary embodiment of the present invention;
FIG. 2 is a schematic diagram illustrating dynamic capacity expansion of a microservice according to an exemplary embodiment of the invention;
FIG. 3 is a schematic diagram illustrating dynamic reduction of a microservice, according to an illustrative embodiment of the present invention;
FIG. 4 is a schematic overall flowchart illustrating a method for dynamic companding of a microservice according to an exemplary embodiment of the present invention;
FIG. 5 is a schematic diagram of a micro-service dynamic companding apparatus according to an exemplary embodiment of the present invention;
fig. 6 is a schematic diagram of a microservice dynamic companding device according to an example embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present application will be described in detail and clearly with reference to the accompanying drawings. It is to be understood that the embodiments described are only a few embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention. In the embodiment of the application, the acquisition, storage, use, processing and the like of the data all conform to relevant regulations of national laws and regulations.
In order to solve the problem that the performance of the microservice cannot support a huge access amount and an excessive microservice instance occupies a server resource when the access amount of the microservice is greatly increased at present, an embodiment of the present application provides a dynamic capacity reduction and expansion method for the microservice, as shown in fig. 1, the method includes:
s101: and obtaining current index values corresponding to at least one predefined micro-service load degree index respectively according to the micro-service instance operation data.
The micro-service load degree index comprises two main types: the first type belongs to indexes of server resource types, namely resource types, such as CPU utilization rate, memory usage values and the like; the second category is an indicator of the type of microservice itself, i.e. the type of service, for example: the number of http requests per second, the number of messages processed per second, etc.
The current index values corresponding to the two types of indexes are obtained in different modes, and the current index value corresponding to the first type of index is obtained through an open source program according to micro-service example operation data; the current index value corresponding to the second type of index needs to be collected and processed by a measurement server (metrics server), namely, the current index value corresponding to the predefined second type of index is calculated according to the example operation data of the micro-service in addition to the example operation data of the micro-service. This also means that the user can customize the microservice load level indicator according to the requirements. Wherein, metrics server is built based on open source monitoring system Prometheus.
The predefined at least one micro-service load degree index may include one of the above-mentioned indexes, and may also include the above-mentioned two indexes.
S102: and comparing the current index value with a corresponding preset expected index value, and determining a capacity reduction coefficient corresponding to the preset expected index value according to the comparison result when the capacity reduction condition is met according to the comparison result.
The expected value is a preset value, and a user can determine the expected value according to the requirements and experience of the user.
In a possible implementation manner, the method includes the following steps that a plurality of predefined microservice load degree indexes are provided, and a capacity reduction and expansion coefficient corresponding to a preset expected index value is determined according to a comparison result, and the method includes:
and taking the ratio of the current index value corresponding to each micro service load degree index to the corresponding preset expected index value as the capacity shrinkage and expansion coefficient corresponding to each micro service load degree index.
In the process of calculating the ratio of the current index value corresponding to each micro-service load degree index to the corresponding preset expected index value, when the ratio is very close to 1, a tolerance can be set so that the micro-service does not perform the operation of shrinking/expanding capacity. For example, when the tolerance is 0.1, and the ratio is [0.9,1.1], the expansion/contraction is not performed.
S103: and determining the number of target instances according to the capacity reduction coefficient, and adjusting the number of the instances of the current micro service to the number of the target instances.
Adjusting the number of instances of the current microservice includes expanding the number of instances of the current microservice and reducing the number of instances of the current microservice. As shown in fig. 2, the number of instances of the current microservice is expanded, the current index value is obtained through the monitoring system, and the number of the current instances is expanded through the expansion controller; FIG. 3 shows a method for reducing the number of instances of a current microservice, obtaining a current index value through a monitoring system, and reducing the number of current instances through a capacity reduction controller.
In a possible implementation, determining the number of target instances according to the companding factor in S102 includes:
calculating the product of the number of the current examples and the contraction and expansion coefficients corresponding to each micro service load degree index, and rounding the product upwards to obtain the number of the target examples corresponding to each micro service load degree index;
and determining the maximum value of the target example number corresponding to each micro-service load degree index, wherein the maximum value is the target example number corresponding to the micro-service.
The maximum value in the target instance quantity is taken as the target instance quantity corresponding to the micro-service, so that the concurrent access quantity and the service reliability of the micro-service are greatly improved.
According to the dynamic capacity shrinkage and expansion method for the micro-service, the number of target examples is obtained through calculation according to the current index value, the preset expected index value and the current example number which correspond to the pre-defined micro-service load degree index, and when the capacity shrinkage and expansion condition is determined to be met, the number of the examples of the current micro-service is adjusted to the target example number. By the method, the micro-service operation performance is ensured, and meanwhile, the waste of server resources is avoided.
Specifically, the above S101 may be implemented as follows:
because the micro-service load degree indexes comprise two types, the steps of acquiring the current index values corresponding to the two types of micro-service load degree indexes are explained respectively.
1) An indication of a server resource type.
Obtaining current index values respectively corresponding to at least one predefined micro-service load degree index according to the example operation data of the current micro-service, and the method comprises at least one of the following steps:
counting the number of access requests received by the current micro-service instance to obtain a current index value of the micro-service access amount index;
counting server resources occupied by the current micro-service instance to obtain a current index value of the micro-server resource occupation index;
the micro server resource occupation index comprises CPU utilization rate and/or memory occupation rate.
2) An indication of the type of microservice itself.
The second type of index comprises multiple types, and the corresponding current index value is collected and processed through the metrics server.
In a possible implementation manner, obtaining current index values respectively corresponding to at least one predefined micro-service load degree index according to the instance operation data of the micro-service includes:
acquiring instance operation data of different metric types of the micro-service, wherein the instance operation data of different metric types comprises data of a cumulative metric type (Counter), data of a length metric type (Gauge), data of a Histogram metric type (Histogram), and data of a Summary metric type (Summary);
and determining the current index values corresponding to at least one predefined micro-service load degree index respectively according to the running data of the micro-service with different measurement types.
Counter: one type of metric accumulated, such as the number of service history total requests, etc.
Gauge: one type of length metric may be increased or decreased, such as the number of real-time requests for service, the number of messages processed per second, etc.
Histopram: which may be understood as a histogram, applicable to request duration, response time, etc.
Summary: similar to Histogram, the observed data is sampled to obtain the number and sum of the data. In addition, a sliding window is taken, and the quantile of the sample data in the window is calculated. Often used for request latency, reply length, etc.
After determining to obtain current index values corresponding to the predefined micro-service load degree indexes, the target number of instances of the micro-service can be calculated according to the current index values, specifically by the following formula:
current instance number x (current index value ÷ desired index value)
The current example number and the current index value in the formula are obtained through the S101 mode, and the expected index value is a preset value.
When the value of the current index value/the expected index value is determined to be close to 1, a tolerance can be set to enable the micro-service not to perform contraction/expansion operation, in a possible implementation manner, the determining that the contraction/expansion condition is met according to the comparison result includes:
determining the ratio of the current index value corresponding to each micro-service load degree index to the corresponding preset expected index value;
if the ratio corresponding to any micro-service load degree index is larger than the corresponding first preset tolerance value, determining that the capacity expansion condition is met;
and if the ratio corresponding to any micro-service load degree index is smaller than the second tolerance value, determining that the capacity reduction condition is met.
For example, if the tolerance is 0.1, the ratio is [0.9,1.1], for example, if the number of current examples is 6 and the ratio is 1.4, the target number of examples is 6 × 1.4 — 8.4, and the target number of examples is 9 obtained by rounding up 8.4. And when the maximum value of the target example number corresponding to each micro-service load degree index is determined to be 9>6, the capacity expansion condition is met, and the current example number is expanded to 9.
For example, when the number of current instances is 6 and the ratio is 0.4, the number of target instances is 6 × 0.4 — 2.4, and rounding up 2.4 results in 3. And when the maximum value of the target example number corresponding to each micro-service load degree index is determined to be 3<6, capacity reduction conditions are met, and the current example number is reduced to 3.
It should be noted that, the predefined target number of instances corresponding to each index is calculated by the above formula, in order to meet the service requirement, the minimum value of the target number of instances of the micro service is at least 1, and the maximum value may be 10, but is not limited to 10, and may be appropriately adjusted according to the occupation situation of the server resource.
The deployment mode of the micro service is divided into containerization and non-containerization, when the deployment mode is the non-containerization mode, the problem of port conflict may occur when the micro service starts the instance, namely the port of the micro service is configured to be 0 in the embodiment of the application, and an idle port is searched when the instance is started, so that the problem of the port conflict can be avoided.
In one possible implementation, adjusting the number of instances of the current microservice to the target number of instances comprises:
responding to the capacity expansion instruction, and inquiring a target server where an unoccupied instance access port is located; sending a service starting script to the target server to start a corresponding instance until the number of the instances of the current micro service is adjusted to the number of the target instances; or
And responding to the capacity reduction instruction, determining the running stopping instances and sending scripts of the running stopping instances to the target server where the running stopping instances are located until the number of the instances of the current micro service is adjusted to the number of the target instances.
The micro-service is contracted/contained through a script program, a new instance needs to be started when the capacity is expanded, an occupied port needs to be inquired, and the problem of port conflict does not exist when the micro-service is contracted, so that an idle port does not need to be inquired.
For the containerized micro-service deployment mode without the problem of port conflict, the embodiment of the application considers the two deployment modes and provides the solution as described above.
The method for acquiring the number of the current instances specifically comprises the following steps:
in a possible implementation manner, before adjusting the number of instances of the current microservice to the target number of instances, the method further includes:
acquiring all current examples of the micro-service, and screening out a first example which is stopped running and a second example which is not acquired and used for calculating the micro-service load degree index;
and determining the number of the screened instances of the micro-service as the number of the instances of the current micro-service.
In the process of acquiring the current number of instances, the action of shrinking/expanding is changed in real time, and it is possible that when the current number of instances is acquired, a certain instance is stopped, but the stopping process needs to be performed for a period of time, and in this case, the instance will not be counted in the current number of instances; similarly, the number of current instances cannot be counted in the case where the index of the degree of the micro-service load cannot be obtained.
The overall flow of the dynamic capacity reduction and expansion method of the microservice is shown in fig. 4:
1) at least one micro-service load degree index is predefined;
2) acquiring current index values respectively corresponding to at least one predefined microservice load degree index through an open source program or metrics server;
3) calculating the number of micro-service target instances;
the calculation steps are as above, and are not described herein again;
4) and when the number of the micro-service target instances is determined to be larger than the current instance number, carrying out capacity expansion operation on the micro-service, and when the number of the micro-service target instances is determined to be smaller than the current instance number, carrying out capacity reduction operation on the micro-service.
Based on the same inventive concept, the embodiment of the present application provides a microservice dynamic companding apparatus 500, as shown in fig. 5, the apparatus includes:
a module 501 for determining a current index value, configured to obtain current index values corresponding to at least one predefined micro-service load degree index according to the example operation data of the micro-service;
a module 502 for determining a reduction-expansion coefficient, configured to compare the current index value with a corresponding preset expected index value, and determine, according to a comparison result, a reduction-expansion coefficient corresponding to the preset expected index value when it is determined that a reduction-expansion condition is met;
an adjusting instance number module 503, configured to determine a target instance number according to the companding coefficient, and adjust the number of instances of the current micro service to the target instance number.
In a possible implementation manner, the module for determining a current index value is configured to obtain current index values corresponding to at least one predefined micro-service load degree index according to the instance operation data of the current micro-service, and includes at least one of the following steps:
counting the number of access requests received by the current micro-service instance to obtain a current index value of the micro-service access amount index;
counting the server resources occupied by the current micro-service instance to obtain a current index value of the micro-server resource occupation index;
the micro server resource occupation index comprises CPU utilization rate and/or memory occupation rate.
In a possible implementation manner, the predefined micro-service load degree indexes are multiple, and the determining a reduction-expansion coefficient module is configured to determine, according to the comparison result, a reduction-expansion coefficient corresponding to the preset expected index value, including:
taking the ratio of the current index value corresponding to each micro service load degree index to the corresponding preset expected index value as a capacity shrinkage and expansion coefficient corresponding to each micro service load degree index;
calculating the product of the number of the current examples and the reduction-expansion coefficient corresponding to each micro-service load degree index, and rounding the product upwards to obtain the number of the target examples corresponding to each micro-service load degree index;
and determining the maximum value of the target example number corresponding to each micro-service load degree index as the target example number corresponding to the micro-service.
In a possible implementation manner, the determining a companding coefficient module is configured to determine that a companding condition is met according to the comparison result, and includes:
determining the ratio of the current index value corresponding to each micro-service load degree index to the corresponding preset expected index value;
if the ratio corresponding to any micro-service load degree index is larger than the corresponding first preset tolerance value, determining that the capacity expansion condition is met;
and if the ratio corresponding to any micro-service load degree index is smaller than the second tolerance value, determining that the capacity reduction condition is met.
In a possible implementation manner, the determining a current index value module is configured to obtain current index values corresponding to at least one predefined micro-service load degree index according to the instance operation data of the micro-service, and includes:
acquiring example operation data of the micro-service in different measurement types, wherein the example operation data of the different measurement types comprises data of an accumulation measurement type, data of a length measurement type, data of a histogram measurement type and data of a summary measurement type;
and determining the current index values corresponding to at least one predefined micro-service load degree index respectively according to the running data of the micro-service with different measurement types.
In one possible implementation, the adjusting number of instances module is configured to adjust the number of instances of the current microservice to the target number of instances, and includes:
responding to a capacity expansion instruction, and inquiring a target server where an unoccupied instance access port is located; sending a service starting script to the target server to start a corresponding instance until the number of the instances of the current micro service is adjusted to the number of the target instances; or
And responding to the capacity reduction instruction, determining the running stopping instances and sending scripts of the running stopping instances to the target server where the running stopping instances are located until the number of the instances of the current micro service is adjusted to the number of the target instances.
In a possible implementation manner, the adjusting number of instances module is configured to, before adjusting the number of instances of the current micro service to the target number of instances, further include:
acquiring all current examples of the micro-service, and screening out a first example which is stopped running and a second example which is not acquired and used for calculating the micro-service load degree index;
and determining the number of the screened instances of the micro-service as the number of the instances of the current micro-service.
Based on the same inventive concept, an embodiment of the present application provides a dynamic capacity-reducing and-expanding device for microservice, as shown in fig. 6, the device includes:
at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform any of the methods of microservice dynamic scaling.
The electronic device 130 according to this embodiment of the present application is described below with reference to fig. 6. The electronic device 130 shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 6, the electronic device 130 is represented in the form of a general electronic device. The components of the electronic device 130 may include, but are not limited to: the at least one processor 131, the at least one memory 132, and a bus 133 that connects the various system components (including the memory 132 and the processor 131).
The processor 131 is configured to obtain current index values corresponding to at least one predefined micro-service load degree index according to the micro-service instance operation data;
comparing the current index value with a corresponding preset expected index value, and determining a capacity reduction coefficient corresponding to the preset expected index value according to a comparison result when the capacity reduction condition is met according to the comparison result;
and determining the number of target instances according to the capacity reduction coefficient, and adjusting the number of the instances of the current micro service to the number of the target instances.
In a possible implementation manner, the processor 131 is configured to obtain current index values respectively corresponding to at least one predefined micro-service load degree index according to the instance operation data of the current micro-service, and includes at least one of the following steps:
counting the number of access requests received by the current micro-service instance to obtain a current index value of the micro-service access amount index;
counting server resources occupied by the current micro-service instance to obtain a current index value of the micro-server resource occupation index;
the micro server resource occupation index comprises CPU utilization rate and/or memory occupation rate.
The predefined microservice load degree index is multiple, and in a possible implementation, the processor 131 is configured to determine, according to the comparison result, a companding coefficient corresponding to the preset expected index value, including:
taking the ratio of the current index value corresponding to each micro service load degree index to the corresponding preset expected index value as a capacity shrinkage and expansion coefficient corresponding to each micro service load degree index;
calculating the product of the number of the current examples and the reduction-expansion coefficient corresponding to each micro-service load degree index, and rounding the product upwards to obtain the number of the target examples corresponding to each micro-service load degree index;
and determining the maximum value of the target example number corresponding to each micro-service load degree index as the target example number corresponding to the micro-service.
In a possible implementation, the processor 131 is configured to determine that the companding condition is satisfied according to the comparison result, and includes:
determining the ratio of the current index value corresponding to each micro-service load degree index to the corresponding preset expected index value;
if the ratio corresponding to any micro-service load degree index is larger than the corresponding first preset tolerance value, determining that the capacity expansion condition is met;
and if the ratio corresponding to any micro-service load degree index is smaller than the second tolerance value, determining that the capacity reduction condition is met.
In a possible implementation manner, the processor 131 is configured to obtain, according to the instance operation data of the micro service, current index values respectively corresponding to at least one predefined micro service load degree index, including:
acquiring example operation data of the micro-service in different measurement types, wherein the example operation data of the different measurement types comprises data of an accumulation measurement type, data of a length measurement type, data of a histogram measurement type and data of a summary measurement type;
and determining the current index values corresponding to at least one predefined micro-service load degree index respectively according to the running data of the micro-service with different measurement types.
In one possible implementation, the processor 131 is configured to adjust the number of instances of the current micro service to the target number of instances, and includes:
responding to the capacity expansion instruction, and inquiring a target server where an unoccupied instance access port is located; sending a service starting script to the target server to start a corresponding instance until the number of the instances of the current micro service is adjusted to the number of the target instances; or
And responding to the capacity reduction instruction, determining the running stopping instances and sending scripts of the running stopping instances to the target server where the running stopping instances are located until the number of the instances of the current micro service is adjusted to the number of the target instances.
In a possible implementation manner, before the processor 131 is configured to adjust the number of instances of the current micro service to the target number of instances, the method further includes:
acquiring all current examples of the micro-service, and screening out a first example which is stopped running and a second example which is not acquired and used for calculating the micro-service load degree index;
and determining the number of the screened instances of the micro-service as the number of the instances of the current micro-service.
Bus 133 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a processor, or a local bus using any of a variety of bus architectures.
The memory 132 may include readable media in the form of volatile memory, such as Random Access Memory (RAM)1321 and/or cache memory 1322, and may further include Read Only Memory (ROM) 1323.
Memory 132 may also include a program/utility 1325 having a set (at least one) of program modules 1324, such program modules 1324 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
The electronic device 130 may also communicate with one or more external devices 134 (e.g., keyboard, pointing device, etc.), with one or more devices that enable a user to interact with the electronic device 130, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 130 to communicate with one or more other electronic devices. Such communication may occur via input/output (I/O) interfaces 135. Also, the electronic device 130 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via the network adapter 136. As shown, network adapter 136 communicates with other modules for electronic device 130 over bus 133. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with electronic device 130, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
In some possible embodiments, the aspects of a method for dynamic capacity reduction of a microservice provided by the present application may also be implemented in the form of a program product comprising program code means for causing a computer device to perform the steps of a method for dynamic capacity reduction of a microservice according to various exemplary embodiments of the present application described above in this specification, when the program product is run on a computer device.
In addition, an embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored, where the computer program is used to enable a computer to execute the method described in any one of the above embodiments.
These computer program instructions may be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (10)

1. A method for dynamic scaling of microservices, the method comprising:
obtaining current index values corresponding to at least one predefined micro-service load degree index according to the micro-service instance operation data;
comparing the current index value with a corresponding preset expected index value, and determining a capacity reduction coefficient corresponding to the preset expected index value according to a comparison result when the capacity reduction condition is met according to the comparison result;
and determining the number of target instances according to the capacity reduction coefficient, and adjusting the number of the instances of the current micro service to the number of the target instances.
2. The method according to claim 1, wherein obtaining the current index values respectively corresponding to at least one predefined micro-service load degree index according to the instance operation data of the current micro-service comprises at least one of the following steps:
counting the number of access requests received by the current micro-service instance to obtain a current index value of the micro-service access amount index;
counting the server resources occupied by the current micro-service instance to obtain a current index value of the micro-server resource occupation index;
the micro server resource occupation index comprises CPU utilization rate and/or memory occupation rate.
3. The method according to claim 1 or 2, wherein the predefined micro-service load degree indexes are multiple, and the determining of the companding coefficient corresponding to the preset expected index value according to the comparison result comprises:
taking the ratio of the current index value corresponding to each micro service load degree index to the corresponding preset expected index value as a capacity shrinkage and expansion coefficient corresponding to each micro service load degree index;
calculating the product of the number of the current examples and the reduction-expansion coefficient corresponding to each micro-service load degree index, and rounding the product upwards to obtain the number of the target examples corresponding to each micro-service load degree index;
and determining the maximum value of the target example number corresponding to each micro-service load degree index as the target example number corresponding to the micro-service.
4. The method of claim 1, wherein determining that the companding condition is satisfied according to the comparison result comprises:
determining the ratio of the current index value corresponding to each micro-service load degree index to the corresponding preset expected index value;
if the ratio corresponding to any micro-service load degree index is larger than the corresponding first preset tolerance value, determining that the capacity expansion condition is met;
and if the ratio corresponding to any micro-service load degree index is smaller than the second tolerance value, determining that the capacity reduction condition is met.
5. The method of claim 1, wherein obtaining current index values corresponding to at least one predefined microservice load level index according to the instance operation data of the microservice comprises:
acquiring example operation data of the micro-service in different measurement types, wherein the example operation data of the different measurement types comprises data of an accumulation measurement type, data of a length measurement type, data of a histogram measurement type and data of a summary measurement type;
and determining the current index values corresponding to at least one predefined micro-service load degree index respectively according to the running data of the micro-service with different measurement types.
6. The method of claim 1, wherein adjusting the number of instances of the current microservice to the target number of instances comprises:
responding to the capacity expansion instruction, and inquiring a target server where an unoccupied instance access port is located; sending a service starting script to the target server to start a corresponding instance until the number of the instances of the current micro service is adjusted to the number of the target instances; or
And responding to the capacity reduction instruction, determining the running stopping instances and sending scripts of the running stopping instances to the target server where the running stopping instances are located until the number of the instances of the current micro service is adjusted to the number of the target instances.
7. The method of claim 1, wherein before adjusting the number of instances of the current microservice to the target number of instances, further comprising:
acquiring all current examples of the micro-service, and screening out a first example which is stopped running and a second example which is not acquired and used for calculating the micro-service load degree index;
and determining the number of the screened instances of the micro-service as the number of the instances of the current micro-service.
8. A microservice dynamic companding apparatus, the apparatus comprising:
the current index value determining module is used for obtaining current index values corresponding to at least one predefined micro-service load degree index according to the micro-service instance operation data;
a module for determining a reduction-expansion coefficient, configured to compare the current index value with a corresponding preset expected index value, and determine, according to a comparison result, a reduction-expansion coefficient corresponding to the preset expected index value when it is determined that a reduction-expansion condition is satisfied;
and the adjusting example number module is used for determining the target example number according to the capacity reduction coefficient and adjusting the number of the examples of the current micro service to the target example number.
9. A micro-service dynamic capacity reduction and expansion device, the device comprising:
at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.
10. A computer storage medium, characterized in that the computer storage medium stores a computer program for causing a computer to perform the method according to any one of claims 1-7.
CN202210128324.8A 2022-02-11 2022-02-11 Dynamic capacity reduction and expansion method, device and equipment for micro-service Pending CN114490078A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210128324.8A CN114490078A (en) 2022-02-11 2022-02-11 Dynamic capacity reduction and expansion method, device and equipment for micro-service

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210128324.8A CN114490078A (en) 2022-02-11 2022-02-11 Dynamic capacity reduction and expansion method, device and equipment for micro-service

Publications (1)

Publication Number Publication Date
CN114490078A true CN114490078A (en) 2022-05-13

Family

ID=81481305

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210128324.8A Pending CN114490078A (en) 2022-02-11 2022-02-11 Dynamic capacity reduction and expansion method, device and equipment for micro-service

Country Status (1)

Country Link
CN (1) CN114490078A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115242648A (en) * 2022-07-19 2022-10-25 北京百度网讯科技有限公司 Capacity expansion and contraction discrimination model training method and operator capacity expansion and contraction method
CN115996229A (en) * 2022-11-30 2023-04-21 中国电子科技集团公司第十研究所 Micro-service data synchronization method for cloud measurement and control baseband pool

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115242648A (en) * 2022-07-19 2022-10-25 北京百度网讯科技有限公司 Capacity expansion and contraction discrimination model training method and operator capacity expansion and contraction method
CN115996229A (en) * 2022-11-30 2023-04-21 中国电子科技集团公司第十研究所 Micro-service data synchronization method for cloud measurement and control baseband pool
CN115996229B (en) * 2022-11-30 2024-04-05 中国电子科技集团公司第十研究所 Micro-service data synchronization method for cloud measurement and control baseband pool

Similar Documents

Publication Publication Date Title
CN110196767B (en) Service resource control method, device, equipment and storage medium
CN112291104B (en) Micro-service automatic scaling system, method and corresponding equipment and storage medium
CN114490078A (en) Dynamic capacity reduction and expansion method, device and equipment for micro-service
CN109981744B (en) Data distribution method and device, storage medium and electronic equipment
CN111277640B (en) User request processing method, device, system, computer equipment and storage medium
CN114500339B (en) Node bandwidth monitoring method and device, electronic equipment and storage medium
CN115277566B (en) Load balancing method and device for data access, computer equipment and medium
CN111966289A (en) Partition optimization method and system based on Kafka cluster
CN112751726A (en) Data processing method and device, electronic equipment and storage medium
CN112506619A (en) Job processing method, apparatus, electronic device, storage medium, and program product
CN114637650A (en) Elastic expansion method based on Kubernetes cluster
CN110096339B (en) System load-based capacity expansion and contraction configuration recommendation system and method
CN110569170A (en) method, device and equipment for evaluating utilization rate of server and storage medium thereof
CN115756812A (en) Resource adjusting method and device and storage medium
CN107168643B (en) Data storage method and device
CN110347546B (en) Dynamic adjustment method, device, medium and electronic equipment for monitoring task
CN112565391A (en) Method, apparatus, device and medium for adjusting instances in an industrial internet platform
CN112416568A (en) Duration estimation method and duration estimation device for audio and video transcoding task
CN115190010B (en) Distributed recommendation method and device based on software service dependency relationship
CN112817687A (en) Data synchronization method and device
CN107748711B (en) Method for automatically optimizing Storm parallelism, terminal equipment and storage medium
CN112367384B (en) Kafka cluster-based dynamic speed limiting method and device and computer equipment
CN115525394A (en) Method and device for adjusting number of containers
CN115016890A (en) Virtual machine resource allocation method and device, electronic equipment and storage medium
CN109586970B (en) Resource allocation method, device and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20220819

Address after: 266071 4th floor, building B3, Hisense R & D center, 399 Songling Road, Laoshan District, Qingdao, Shandong Province

Applicant after: QINGDAO HISENSE TRANSTECH Co.,Ltd.

Applicant after: Qingdao Guochuang Wisdom Cloud Brain Technology Co.,Ltd.

Address before: 266071 No. 151, Zhuzhou Road, Laoshan District, Shandong, Qingdao

Applicant before: QINGDAO HISENSE TRANSTECH Co.,Ltd.