Disclosure of Invention
The embodiment of the invention provides a container cloud-based soft load resource processing method and device, which are used for solving the problems of complex resource deployment and resource waste caused by manual resource expansion and contraction by taking a virtual machine as a unit in the conventional soft load resource processing method.
The embodiment of the invention provides a soft load resource processing method based on a container cloud, which comprises the following steps:
acquiring soft load queue lengths of a soft load resource pool at multiple moments, wherein the soft load queue lengths at the multiple moments at least comprise the soft load queue length at the current moment;
acquiring queue mutation information according to the soft load queue lengths at the multiple moments;
and processing the soft load resources by taking the soft load container as a unit according to the queue mutation information.
Optionally, obtaining queue sudden change information according to the soft load queue lengths at the multiple times includes:
acquiring a first queue mutation factor and a second queue mutation factor according to the soft load queue lengths at the multiple moments, wherein the first queue mutation factor is a queue mutation factor before the current moment, and the second queue mutation factor is a queue mutation factor including the current moment;
and acquiring queue mutation information according to the difference value of the first queue mutation factor and the second queue mutation factor.
Optionally, the first queue mutation factor is obtained according to the following formula:
obtaining the second queue mutation factor according to the following formula:
wherein ε 1 represents a first cohort mutation factor and ε 2 represents a second cohort mutation factor; n represents the number of the obtained soft load queue lengths; x represents the soft load queue length at the current time, xiRepresenting the soft load queue length at a difference i from the current time.
Optionally, the processing the soft load resource by using the soft load container as a unit according to the queue sudden change information includes:
if the difference between the second queue mutation factor and the second queue mutation factor is larger than a first preset threshold value, carrying out capacity expansion on the soft load resource by taking a soft load container as a unit;
if the difference between the first queue mutation factor and the second queue mutation factor is larger than a first preset threshold value, carrying out capacity reduction on the soft load resource by taking a soft load container as a unit;
optionally, when the absolute value of the difference between the first queue mutation factor and the second queue mutation factor is smaller than a first preset threshold, the method further comprises:
acquiring a weight value of resource processing according to the length, the concurrency quantity and the response time of the soft load queue at the current moment;
if the weight value of the resource processing is larger than a second preset threshold value, carrying out capacity expansion on the soft load resource by taking a soft load container as a unit;
and if the weight value of the resource processing is smaller than a third preset threshold value, carrying out capacity reduction on the soft load resource by taking a soft load container as a unit.
Optionally, the obtaining a weight value of resource processing according to the soft load queue length, the concurrency amount, and the response time at the current time includes:
respectively acquiring a degree coefficient of the soft load queue length, a degree coefficient of the concurrency amount and a degree coefficient of the response time at the current moment according to the concurrency amount and the response time of the soft load queue length at the current moment;
and acquiring a weight value of resource processing according to the degree coefficient of the soft load queue length at the current moment, the degree coefficient of the concurrency quantity and the degree coefficient of the response time.
The embodiment of the invention provides a soft load resource processing device based on a container cloud, which comprises:
a soft load queue length obtaining unit, configured to obtain soft load queue lengths at multiple times of a soft load resource pool, where the soft load queue lengths at the multiple times at least include a soft load queue length at a current time;
a queue mutation information obtaining unit, configured to obtain queue mutation information according to the soft load queue lengths at the multiple times;
and the processing unit is used for processing the soft load resources by taking the soft load container as a unit according to the queue mutation information.
Optionally, the queue mutation information obtaining unit includes:
a queue mutation factor obtaining module, configured to obtain a first queue mutation factor and a second queue mutation factor according to the soft load queue lengths at the multiple times, where the first queue mutation factor is a queue mutation factor before the current time, and the second queue mutation factor is a queue mutation factor including the current time;
and the queue mutation information acquisition module is used for acquiring queue mutation information according to the difference value of the first queue mutation factor and the second queue mutation factor.
An embodiment of the present invention provides an electronic device, including: a processor, a memory, and a bus; wherein,
the processor and the memory complete mutual communication through the bus;
the processor is used for calling the program instructions in the memory to execute the container cloud-based soft load resource processing method.
Embodiments of the present invention provide a non-transitory computer readable storage medium, which stores computer instructions, where the computer instructions cause the computer to execute the above container cloud-based soft load resource processing method.
According to the soft load resource processing method and device based on the container cloud, provided by the embodiment of the invention, the soft load queue lengths of a soft load resource pool at multiple moments are obtained, wherein the soft load queue lengths at the multiple moments at least comprise the soft load queue length at the current moment; acquiring queue mutation information according to the soft load queue lengths at the multiple moments; and processing the soft load resources by taking the soft load container as a unit according to the queue mutation information. The embodiment of the invention is based on a containerization technology, integrates bottom resources, and shares resources with soft load service and application service, thereby improving the resource utilization rate; the containerized soft load service overcomes the defect that the soft load service cannot be rapidly deployed in the prior art, automatically performs dynamic capacity expansion or capacity reduction on soft load resources by taking a soft load container as a unit, and reduces service interruption caused by high concurrent high flow or burst flow of a system.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. 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 prior art, although the soft load resources can be manually scheduled through operation and maintenance experience and the use conditions of a CPU, a memory and the like of the soft load server to ensure normal access to the service, in most cases, it is difficult to predict the concurrent request amount of the service and the quick response to the service demand, which causes that the soft load resources cannot be dynamically expanded and contracted in time, resulting in failure of service access of the data center and failure of normal service resources to be fully utilized.
In the prior art, the soft load balancing elastic expansion capability is weak, the deployment mode is constructed by taking a virtual machine as a unit, the expansion process is complex, and the deployment time is long. When the traffic volume suddenly increases, rapid deployment expansion and dynamic scheduling cannot be carried out, so that service faults are caused, meanwhile, the soft load balance cannot be automatically reduced, and certain reservation and waste of system resources exist.
Fig. 2 is a schematic flow chart of a container cloud-based soft load resource processing method according to an embodiment of the present invention.
It should be noted that the container cloud encapsulates the entire software runtime environment by using the container as a basic unit for resource partitioning and scheduling, and provides a platform for building, publishing, and running the distributed application.
As shown in fig. 2, the method of this embodiment includes:
s21: acquiring soft load queue lengths of a soft load resource pool at multiple moments, wherein the soft load queue lengths at the multiple moments at least comprise the soft load queue length at the current moment;
it should be noted that the soft load resource pool according to the embodiment of the present invention includes a plurality of soft load containers, and each soft load container (as shown in fig. 3) runs a soft load service. The soft load queue stores the concurrent requests to be processed, and the number of the concurrent requests to be processed is the length of the soft load queue.
In practical application, the host Master node obtains the soft load queue length at multiple moments through the performance of the data center soft load resource pool and the log data.
S22: acquiring queue mutation information according to the soft load queue lengths at the multiple moments;
it can be understood that if there is a large difference between the current time and the previous time period in the length of the soft load queue, which indicates that the traffic request amount changes greatly, the capacity of the soft load needs to be expanded or reduced. Therefore, the embodiment of the invention obtains the queue mutation information through the soft load queue length at multiple moments, and can dynamically expand or reduce the capacity of the soft load resource through the queue mutation information.
S23: processing the soft load resources by taking the soft load container as a unit according to the queue mutation information;
understandably, the processing procedure of the soft load resource comprises the capacity expansion and the capacity reduction of the soft load resource; the expansion of the soft load resource refers to increasing the soft load container, and the contraction of the soft load resource refers to decreasing the soft load container.
In practical application, if elastic expansion and contraction are needed, the host Master node sends an elastic expansion and contraction instruction to the data center soft load resource pool to perform soft load expansion and contraction and records the elastic expansion and contraction event. And if the soft load resource pool of the data center cannot meet the resource requirement required by elastic expansion, informing a super administrator to perform expansion processing on the resource pool, and performing elastic scheduling again.
According to the soft load resource processing method based on the container cloud, provided by the embodiment of the invention, the bottom layer resources are integrated based on the container technology, and the soft load service and the application service share the resources, so that the resource utilization rate is improved; the containerized soft load service overcomes the defect that the soft load service cannot be rapidly deployed in the prior art, automatically performs dynamic capacity expansion or capacity reduction on soft load resources by taking a soft load container as a unit, and reduces service interruption caused by high concurrent high flow or burst flow of a system.
In an optional implementation manner of the embodiment of the present invention, similar to the method in fig. 2, obtaining the queue sudden change information according to the soft load queue lengths at the multiple time instants includes:
acquiring a first queue mutation factor and a second queue mutation factor according to the soft load queue lengths at the multiple moments, wherein the first queue mutation factor is a queue mutation factor before the current moment, and the second queue mutation factor is a queue mutation factor including the current moment;
and acquiring queue mutation information according to the difference value of the first queue mutation factor and the second queue mutation factor.
Specifically, the first queue mutation factor is obtained according to the following formula:
obtaining the second queue mutation factor according to the following formula:
wherein ε 1 represents a first cohort mutation factor and ε 2 represents a second cohort mutation factor; n represents the number of the obtained soft load queue lengths; x represents the soft load queue length at the current time, xiRepresenting the soft load queue length at a difference i from the current time.
For example, the current time is 12 points, and the lengths of the soft load queues corresponding to three times, namely 12 points, 11 points and 10 points, are obtained. And calculating to obtain the queue mutation factor excluding the current 12-point according to a calculation formula of the first queue mutation factor, and calculating to obtain the queue mutation factor including the current 12-point according to a calculation formula of the second queue mutation factor.
Further, the processing the soft load resource by taking the soft load container as a unit according to the queue sudden change information includes:
if the difference between the second queue mutation factor and the second queue mutation factor is larger than a first preset threshold value, carrying out capacity expansion on the soft load resource by taking a soft load container as a unit;
if the difference between the first queue mutation factor and the second queue mutation factor is larger than a first preset threshold value, carrying out capacity reduction on the soft load resource by taking a soft load container as a unit;
further, when the absolute value of the difference between the first queue mutation factor and the second queue mutation factor is smaller than a first preset threshold, the method further comprises:
acquiring a weight value of resource processing according to the length, the concurrency quantity and the response time of the soft load queue at the current moment;
if the weight value of the resource processing is larger than a second preset threshold value, carrying out capacity expansion on the soft load resource by taking a soft load container as a unit;
and if the weight value of the resource processing is smaller than a third preset threshold value, carrying out capacity reduction on the soft load resource by taking a soft load container as a unit.
It should be noted that the concurrency amount in the embodiment of the present invention refers to the number of concurrent requests being processed.
It can be understood that when the soft load queue is judged and known not to have sudden change according to the queue sudden change factor, the soft load resource is processed according to the length, the concurrency and the response time of the soft load queue at the current moment.
Specifically, the obtaining a weight value of resource processing according to the soft load queue length, the concurrency amount, and the response time at the current time includes:
respectively acquiring a degree coefficient of the soft load queue length, a degree coefficient of the concurrency amount and a degree coefficient of the response time at the current moment according to the concurrency amount and the response time of the soft load queue length at the current moment;
and acquiring a weight value of resource processing according to the degree coefficient of the soft load queue length at the current moment, the degree coefficient of the concurrency quantity and the degree coefficient of the response time.
In practical application, the degree coefficients of the three indexes need to be assigned according to an assignment reference table, and the operation can be dynamically distributed by an administrator according to different application scenes and time periods. The assignment reference table is shown in table 1:
table 1 assignment reference table
Of extreme importance
|
Of strong importance
|
Of obvious importance
|
9
|
7
|
5 |
And carrying out normalization processing according to the assignment reference table to obtain degree coefficients corresponding to the three indexes. x is the number ofi_normNamely, the degree coefficient of the index, the specific calculation method is as follows:
wherein xiIndicating the value assigned to the i-th entry in the reference table.
For example, the length of the soft load queue at the current time is 10, and the concurrency is 100; the response time is 30 (in ms), and the degree coefficients of the three indexes are obtained according to the corresponding importance degrees. (it is assumed that the importance of the queue length: 9; the importance of the concurrency amount: 7; the importance of the response time: 5).
Therefore, the degree coefficient of the soft load queue length at the present time is 9/21; the degree coefficient of concurrency was 7/21; the degree coefficient of the response time is 5/21. The three are added to obtain a value. This value is compared to upper and lower threshold values.
In practical application, the most appropriate upper and lower limit thresholds can be obtained through multiple experiments according to actual operating conditions, and the upper and lower limit thresholds can also be manually specified by an administrator according to soft load requirements.
In practical application, the soft load instance of the back end is updated by calling the hard load interface. The soft load example and the loading information are started first, and then the hard load information is updated, so that no perception is ensured when the service is accessed.
The embodiment of the invention combines a containerization technology, integrates bottom resources, shares a resource pool by soft load service and application service, maximally utilizes resources of a data center, reduces waste and redundancy of the resources and improves the resource utilization rate of the data center. The method has good popularization value for the container cloud environment of the data center. The soft load service is containerized, the dynamic expansion and elastic expansion capability of soft load resources can be realized, the response time of a data center can be effectively prolonged, and the soft load resources can be quickly expanded and contracted aiming at large flow and large concurrent services. And by means of a two-stage judgment mechanism, the soft load use condition is comprehensively considered, queue variation factors are added, the soft load state can be judged more accurately, fine-grained elastic expansion and contraction resources are realized, and the method has a high practical value in a large-scale production environment.
Fig. 4 is a schematic structural diagram of a container cloud-based soft load resource processing apparatus according to an embodiment of the present invention. As shown in fig. 4, the apparatus of this embodiment includes a soft load queue length obtaining unit 41, a queue break information obtaining unit 42, and a processing unit 43, specifically:
a soft load queue length obtaining unit 41, configured to obtain soft load queue lengths of multiple times of a soft load resource pool, where the soft load queue lengths of the multiple times at least include a soft load queue length of a current time;
a queue mutation information obtaining unit 42, configured to obtain queue mutation information according to the soft load queue lengths at the multiple times;
and the processing unit 43 is configured to process the soft load resource in units of soft load containers according to the queue sudden change information.
According to the soft load resource processing device based on the container cloud, provided by the embodiment of the invention, the bottom layer resources are integrated based on the container technology, and the soft load service and the application service share the resources, so that the resource utilization rate is improved; the containerized soft load service overcomes the defect that the soft load service cannot be rapidly deployed in the prior art, automatically performs dynamic capacity expansion or capacity reduction on soft load resources by taking a soft load container as a unit, and reduces service interruption caused by high concurrent high flow or burst flow of a system.
Further, the queue mutation information obtaining unit 42 includes:
a queue mutation factor obtaining module, configured to obtain a first queue mutation factor and a second queue mutation factor according to the soft load queue lengths at the multiple times, where the first queue mutation factor is a queue mutation factor before the current time, and the second queue mutation factor is a queue mutation factor including the current time;
and the queue mutation information acquisition module is used for acquiring queue mutation information according to the difference value of the first queue mutation factor and the second queue mutation factor.
The container cloud-based soft load resource processing device of the embodiment of the present invention may be used to implement the method embodiments, and the principle and technical effect are similar, which are not described herein again.
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Referring to fig. 5, the electronic device includes: a processor (processor)51, a memory (memory)52, and a bus 53; wherein,
the processor 51 and the memory 52 are communicated with each other through a bus 53;
the processor 51 is configured to call program instructions in the memory 52 to execute the container cloud-based soft load resource processing method provided by the above-described method embodiments.
Furthermore, the logic instructions in the memory 52 may be implemented in software functional units and stored in a computer readable storage medium when sold or used as a stand-alone product. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The present embodiments provide a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the container cloud based soft load resource processing method provided by the above-mentioned method embodiments.
The present embodiments provide a non-transitory computer-readable storage medium storing computer instructions that cause the computer to execute the container cloud-based soft load resource processing method provided by the above method embodiments.
According to the soft load resource processing method and device based on the container cloud, provided by the embodiment of the invention, the soft load queue lengths of a soft load resource pool at multiple moments are obtained, wherein the soft load queue lengths at the multiple moments at least comprise the soft load queue length at the current moment; acquiring queue mutation information according to the soft load queue lengths at the multiple moments; and processing the soft load resources by taking the soft load container as a unit according to the queue mutation information. The embodiment of the invention is based on a containerization technology, integrates bottom resources, and shares resources with soft load service and application service, thereby improving the resource utilization rate; the containerized soft load service overcomes the defect that the soft load service cannot be rapidly deployed in the prior art, automatically performs dynamic capacity expansion or capacity reduction on soft load resources by taking a soft load container as a unit, and reduces service interruption caused by high concurrent high flow or burst flow of a system.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It is to be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
In the description of the present invention, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description. Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
The above examples are only for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.