WO2020164265A1 - Method and related device for adjusting deployment of docker component on basis of affinity - Google Patents

Method and related device for adjusting deployment of docker component on basis of affinity Download PDF

Info

Publication number
WO2020164265A1
WO2020164265A1 PCT/CN2019/116704 CN2019116704W WO2020164265A1 WO 2020164265 A1 WO2020164265 A1 WO 2020164265A1 CN 2019116704 W CN2019116704 W CN 2019116704W WO 2020164265 A1 WO2020164265 A1 WO 2020164265A1
Authority
WO
WIPO (PCT)
Prior art keywords
components
docker
affinity
component
information
Prior art date
Application number
PCT/CN2019/116704
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 WO2020164265A1 publication Critical patent/WO2020164265A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines

Definitions

  • This application relates to the field of distributed deployment technology, and in particular to a method and related equipment for adjusting the deployment of Docker components based on affinity.
  • the affinity relationship refers to the affinity relationship between components. Affinity is used to show whether the internal connection between components is close, for example, according to whether the mutual calls and resource sharing between components and components are frequent, so Determine the affinity between components.
  • k8s an internal container management system
  • affinity of each component requires the user to manually set a very detailed label and configuration, and then k8s can determine the affinity between components based on the label and configuration of each component.
  • the affinity between the components cannot be adjusted, unless the system is restarted to complete the deployment of the components again.
  • the main purpose of this application is to provide a method and related equipment for adjusting the deployment of Docker components based on affinity, which aims to solve the disadvantages that the affinity relationship between existing Docker components needs to be manually set and the deployment of Docker components is not instantaneous.
  • this application provides a method for adjusting the deployment of Docker components based on affinity.
  • the Docker components are deployed in a host cluster, which is a cluster formed by all the hosts located in the same region.
  • the method includes:
  • the operating information between the Docker components and the operating occupation information corresponding to each of the Docker components in the time period corresponding to the preset frequency are acquired, where the operating information is each Docker
  • the present application also provides a device for adjusting the deployment of Docker components based on affinity.
  • the Docker components are deployed in a host group, and the host group is a cluster formed by all the hosts located in the same area, and the device includes :
  • the obtaining module is configured to obtain the operation information among the Docker components within the time period corresponding to the preset frequency and the operation occupation information corresponding to each of the Docker components according to the preset frequency, wherein the operation information Is the calling relationship information and resource sharing information between the Docker components, the calling relationship information is the calling relationship and the number of calls corresponding to each other between the components, and the resource sharing information is the common calling between the components and the components at runtime The corresponding information of the resource;
  • the parsing module is used to analyze the operation information between the Docker components and the operation occupation information of the Docker components to obtain the affinity relationship between the Docker components;
  • the first generation module is used to call the Apriori algorithm to analyze the affinity relationship between the Docker components and generate a frequent item set of components, wherein the frequent item set of the component is a set containing the affinity relationship between the Docker components ;
  • the adjustment module is used to adjust the deployment of each Docker component on each host group according to the affinity relationship between each Docker component and the frequent item set of the component.
  • the present application also provides a computer device, including a memory and a processor, the memory stores a computer program, and the processor implements the steps of any one of the above methods when the computer program is executed by the processor.
  • the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of any one of the above methods are implemented.
  • This application provides a method, device and computer equipment for adjusting the deployment of Docker components based on affinity.
  • FIG. 1 is a schematic diagram of the method steps for affinity adjustment of Docker component deployment in an embodiment of the present application
  • Fig. 2 is a block diagram of the overall structure of an apparatus for affinity adjustment of Docker component deployment in an embodiment of the present application
  • FIG. 3 is a schematic block diagram of the structure of a computer device according to an embodiment of the present application.
  • an embodiment of the present application provides a method for adjusting the deployment of Docker components based on affinity.
  • the Docker components are deployed in a host group formed by all the hosts located in the same area.
  • the method includes:
  • S1 According to the preset frequency, obtain the operation information among the Docker components within the time period corresponding to the preset frequency and the operation occupation information corresponding to each of the Docker components, where the operation information is each The calling relationship information and resource sharing information between the Docker components, the calling relationship information is the calling relationship and the number of calls between the components and the components, and the resource sharing information is the resource sharing between the components and the components at runtime.
  • the operation information is each The calling relationship information and resource sharing information between the Docker components
  • the calling relationship information is the calling relationship and the number of calls between the components and the components
  • the resource sharing information is the resource sharing between the components and the components at runtime.
  • S3 Invoke the Apriori algorithm to analyze the affinity relationship between the Docker components to generate a frequent item set of components, where the frequent item set of the component is a set containing the affinity relationship between the Docker components;
  • S4 Adjust the deployment of each Docker component on each host group according to the affinity relationship between each Docker component and the frequent item set of the component.
  • the monitoring service in each host group monitors in real time the operation information between the docker components in the docker container and the operation occupation information corresponding to each docker component.
  • the operation information includes the calling relationship information and resource sharing information between the docker components; the calling relationship information includes the calling relationship and the number of calls between the docker components.
  • the API Gateway component is responsible for forwarding the call request to the service of the destination component, so the adjustment system can monitor the forwarding of the call request in the API Gateway component to obtain the corresponding call request Initiating component and destination component of each component, so as to obtain the corresponding calling relationship between each component, and by counting the number of forwarding of the calling request with the calling relationship, the number of calls corresponding to the two components with the calling relationship is obtained; resource sharing Information is the information of the resources that are commonly called between components and components at runtime.
  • the adjustment system can obtain service access resources in the docker container component through network monitoring, and obtain two components with resource sharing based on the requesting end of the accessed resources. That is, the corresponding information of the resources commonly called between components and components at runtime; the operating occupation information includes the CPU occupancy rate and memory occupancy of the component service at runtime, and the adjustment system can be monitored in real time through the monitoring service in the docker container.
  • the adjustment system adjusts the deployment of each docker component on each host group according to the preset frequency. Therefore, according to the preset frequency, the adjustment system intercepts all the information of the real-time monitoring of each host group from the operating information of each docker component in the time period corresponding to the preset frequency and the operating occupation information corresponding to each docker component for the next analysis .
  • the operation occupancy information corresponding to each docker component is the average value in the time period corresponding to the preset frequency.
  • the adjustment system first calculates the calling frequency of each docker component according to the number of calls between each docker component and the time period corresponding to the preset frequency. Then, input the calling frequency between each docker component, the resource sharing information between each docker component, and the operation occupation information of each docker component into the pre-built affinity library.
  • the affinity relationship library stores the calling frequency between components, the resource sharing information between components, the operation occupation information of the components and the affinity relationship mapping relationship table. The calling system obtains the affinity between each docker component according to the mapping relationship table. relationship.
  • the affinity relationship includes affinity information and two components corresponding to the affinity information, and the affinity information includes affinity, closer affinity, violation of affinity, and anti-affinity.
  • the adjustment system filters each component to obtain each first component that has a definite affinity relationship with other components, that is, removes the "non-affinity" from all components Part of the components, get each first component.
  • the adjustment system generates an affinity set corresponding to the affinity relationship of each first component according to each first component obtained through screening and the affinity relationship between each component.
  • the affinity set is a set composed of two first components with a certain affinity relationship and corresponding affinity information, for example, [component 1, component 2, affinity].
  • the adjustment system analyzes all affinity sets through the Apriori algorithm, and obtains statistics on the number of appearances of each first component and the number of appearances corresponding to each affinity information of the first component, and according to the appearance times of each first component and each first component And the number of occurrences corresponding to each affinity information of the first component to generate a component frequent item set.
  • the affinity set of each first component is: ⁇ [component 1, component 2, affinity], [component 2, component 3, anti-affinity], [component 2, component 4, more affinity] ⁇
  • the component frequent itemset generated after analysis is: ⁇ [component 1, occurrences: 1, affinity: 1, relatively affinity: 0, violation of affinity: 0, anti-affinity: 0], [Component 2, number of occurrences: 3 times, affinity: 1 time, more affinity: 1 time, violation of affinity: 0 times, anti-affinity: 1 time], [component 3, number of occurrences: 1 time, affinity : 0 times, more affinity: 0 times, violation of affinity: 0 times, anti-affinity: 1 time], [component 4, number of occurrences: 1 time, affinity: 0 times, more affinity: 1 time, violation Affinity: 0 times, anti-affinity: 0 times] ⁇ .
  • the adjustment system first selects the first component with the first priority from the component frequent item set according to the preset priority, and deploys the first component with the first priority in the first host group.
  • the preset priority is: number of occurrences> affinity> relatively affinity> violation of affinity> anti affinity, and each item is arranged in descending order of the corresponding value; the first host group is each host group Any one of Then, the adjustment system screens out the first component with the second priority from the component frequent item set according to the priority, and judges whether the first component with the second priority and the first component with the first priority are connected according to the affinity relationship. It is affinity or more affinity, that is, whether the preset conditions are met to complete the judgment action of the preset conditions.
  • the first component with the second priority is deployed in the first host group; if it does not, the first component with the second priority is deployed in the second host group, and the component deployment action has been completed.
  • the second host group is any host group excluding the first host group in each host group, and the same host group is a cluster formed by all host groups set up in the same area.
  • the adjustment system sequentially selects the first component from the component frequent item set in descending order of priority, and executes the judgment action of the preset conditions with the first component deployed in the host group one by one, until all the first components in the component frequent item set are deployed carry out.
  • the operation occupation information includes CPU occupancy rate and memory occupancy
  • the operation information among the Docker components and the operation occupation information of the Docker components are analyzed to obtain the affinity between the Docker components.
  • the steps of the relationship include:
  • S202 Input the calling frequency among the Docker components, the resource sharing information among the Docker components, and the operation occupation information of each Docker component into a pre-built affinity library, and match each Docker component to obtain The affinity relationship between the components, wherein the affinity relationship library stores the calling frequency between the components, the resource sharing information between the components, the operation occupation information of the components and the affinity relationship mapping relationship table.
  • the adjustment system inputs the number of calls between the Docker components and the time period corresponding to the preset frequency into the preset calculation formula, and calculates the call frequency between the Docker components.
  • the adjustment system inputs the calling frequency between each Docker component, the resource sharing information between each Docker component, and the operation occupancy information of each Docker component into the pre-built affinity library. Match the calling frequency between the components, the resource sharing information between the components, the operation occupancy information of the components and the affinity relationship mapping relationship table stored in the relationship library, and obtain the affinity relationship between the components.
  • the mapping table is:
  • the affinity relationship between the Docker components includes the affinity information corresponding to two Docker components
  • the step of invoking the Apriori algorithm to analyze the affinity relationship between the Docker components and generating a frequent item set of components includes:
  • S304 Generate the component frequent item set according to each of the first components, the number of appearances of each of the first components, and the number of appearances corresponding to each affinity information of each of the first components.
  • the affinity relationship between the Docker components obtained by the adjustment system according to the matching includes the affinity information corresponding to the two Docker components.
  • the affinity relationship is: component 1, component 2, affinity, where " "Affinity” is the information of affinity.
  • the adjustment system filters each Docker component to obtain each first component that has a definite affinity with other Docker components, that is, removes the "non-affinity" part of the Docker components from all Docker components to obtain each first component.
  • the adjustment system generates an affinity set corresponding to the affinity relationship of each first component according to each first component obtained through screening and the affinity relationship between each Docker component.
  • the affinity set is a set composed of two first components with a definite affinity relationship and corresponding affinity information.
  • the affinity set is: [component 1, component 2, affinity].
  • the adjustment system analyzes all affinity sets through the Apriori algorithm, and obtains statistics on the number of appearances of each first component and the number of appearances corresponding to each affinity information of the first component, and according to the appearance times of each first component and each first component And the number of occurrences corresponding to each affinity information of the first component to generate a component frequent item set.
  • the affinity set of each first component is: ⁇ [component 1, component 2, affinity], [component 2, component 3, anti-affinity], [component 2, component 4, more affinity] ⁇
  • the component frequent itemset generated after analysis is: ⁇ [component 1, occurrences: 1, affinity: 1, relatively affinity: 0, violation of affinity: 0, anti-affinity: 0], [Component 2, number of occurrences: 3 times, affinity: 1 time, more affinity: 1 time, violation of affinity: 0 times, anti-affinity: 1 time], [component 3, number of occurrences: 1 time, affinity : 0 times, more affinity: 0 times, violation of affinity: 0 times, anti-affinity: 1 time], [component 4, number of occurrences: 1 time, affinity: 0 times, more affinity: 1 time, violation Affinity: 0 times, anti-affinity: 0 times] ⁇ .
  • the affinity information includes affinity, relative affinity, violation of affinity, and anti-affinity. According to the affinity relationship between the Docker components and the frequent item set of the components, each Docker is adjusted.
  • the steps to deploy components on each host cluster include:
  • S401 According to a preset priority, filter out the first component with the first priority from the frequent item set of components, and deploy the first component with the first priority in a first host group, and A host group is any host group in each of the host groups;
  • S402 According to the preset priority, filter out the first component with the second priority from the component frequent item set, and determine the first component with the second priority and the first component with the first priority Whether the affinity relationship between the components meets the preset condition to complete the judgment action of the preset condition, wherein the preset condition is that the affinity relationship between the components is affinity or more affinity;
  • S404 Filter the first component from the component frequent item set in descending order of priority, and execute the judgment action of the preset condition and the deployment component action one by one with each first component currently deployed in the host group, until All the first components in the component frequent item set are deployed.
  • the adjustment system first selects the first component with the first priority from the component frequent item set according to the preset priority, and deploys the first component with the first priority in the first host group.
  • the preset priority is: number of occurrences> affinity> relatively affinity> violation of affinity> anti affinity, and each item is arranged in descending order of the corresponding value; the first host group is each host group Any one of Then, the adjustment system screens out the first component with the second priority from the component frequent item set according to the priority, and judges whether the first component with the second priority and the first component with the first priority are connected according to the affinity relationship. It is affinity or more affinity, that is, whether the preset conditions are met to complete the judgment action of the preset conditions.
  • the second host group is any host group excluding the first host group in each host group.
  • the adjustment system sequentially filters the first component from the component frequent item set in descending order of priority, and executes the judgment action of the preset conditions and the deployment component action with each first component currently deployed in the host group, until the component frequent item set All the first components are deployed.
  • the component frequent item set is: ⁇ [Component 1, Occurrence: 1, Affinity: 1, Relative Affinity: 0, Violation Affinity: 0, Anti-Affinity: 0], [Component 2 , Occurrences: 3 times, Affinity: 1 time, Relative affinity: 1 time, Affinity violation: 0 times, Anti-affinity: 1 time], [Component 3, Occurrences: 1 time, Affinity: 0 times , More affinity: 0 times, violation of affinity: 0 times, anti-affinity: 1 time], [component 4, occurrences: 1 time, affinity: 0 times, more affinity: 1 time, violation of affinity: 0 times, anti-affinity: 0 times] ⁇ .
  • Component 2 appears 3 times and has 1 affinity.
  • the priority is first.
  • Component 2 is first deployed to host group 1.
  • the number of occurrences of component 1 is the second, the number of affinity is more, and the priority is second, so component 1 is deployed next.
  • component 1 is also deployed to host group 1.
  • the number of occurrences of component 4 and component 3 is 1, and the number of affinity is 0, component 4 is more affinity, and component 3 is anti-affinity, so component 4 is deployed first.
  • Component 4 is not related to component 1 that has been deployed on host cluster 1, and is more compatible with component 2, so it can be deployed on host cluster 1. And if there is an association that violates affinity and anti-affinity, they cannot be deployed together, and they must be deployed independently on a new host group.
  • component 3 is deployed.
  • Component 3 and component 2 deployed in host cluster 1 are anti-affinity and cannot be deployed to host cluster 1, but must be deployed to new host cluster 2.
  • step of deploying the first component with the second priority in the first host group includes:
  • S4011 Determine whether the affinity relationship between the first component with the second priority and the first component with the first priority is an affinity
  • the host group includes multiple hosts.
  • the adjustment system determines that the first component with the second priority needs to be deployed in the same host group as the first component with the first priority, it also needs to determine whether the relationship between the two first components is affinity, that is, the highest affinity. And degree. If so, deploy the first component with the second priority and the first component with the first priority on the same host, so that the data communication transmission and execution efficiency between the two are higher. If the relationship between the two first components is not relatively close, the first component with the second priority is randomly deployed on any host in the first host group.
  • the first component with the second priority is filtered out from the frequent item set of the components, and the first component with the second priority and the first component with the first priority are determined.
  • the step of determining whether the affinity relationship between the first components meets the preset condition to complete the preset condition includes:
  • S40201 Determine whether the number of host groups currently deployed with the first component is not less than 2;
  • S40202 If it is not less than 2, determine one by one whether the affinity relationship between the first component currently deployed and each Docker component in the host group on which the first component is currently deployed meets the preset Condition to complete the judgment action of the preset condition;
  • S40301 Randomly deploy the first component that is currently deployed to any one of the host groups where the first component is currently deployed.
  • the first component currently deployed is randomly deployed in any one of the host groups where the first component is currently deployed.
  • the host group currently deployed with the first component is: host group A, the first deployed component is a; host group B, the first deployed component is b; host group C, the first deployed component Is c.
  • the first component currently deployed is d, and the affinity with the first components a, b, and c are all affinity or more affinity, then adjust the system to randomly deploy the first component d in host group A and host group Any one of B and host group C.
  • the step of obtaining the operation information between the Docker components and the operation occupancy information corresponding to each Docker component in the time period corresponding to the preset frequency according to the preset frequency includes:
  • S5 Real-time monitoring of the call data of the call request in the API Gateway, where the call request is a request initiated when the Docker components call each other, and the call data includes the request-side component, the destination-side component, and the number of call requests ;
  • S6 According to the request-end component and the destination-end component, generate the corresponding invocation relationship between the component and the component, and update the number of invocations corresponding to the request-end component and the destination-end component according to the number of invocation requests ;
  • S7 Generate the calling relationship information according to the calling relationship corresponding to each other between the components and the updated calling times.
  • the call request needs to be sent to the API Gateway component first, and then the API Gateway component is responsible for forwarding the call request to the service of the destination component.
  • the adjustment system monitors and collects interactive call data between Docker container services from the API Gateway component through the monitoring service agent installed in each host.
  • the call data includes the request-side component, the destination-side component, and the number of invocation requests.
  • the adjustment system generates a corresponding calling relationship between the component and the component based on the request-side component and the destination-side component, and the two components in each group with the calling relationship record the corresponding number of calls.
  • Adjust the system according to the number of call requests add the number of call requests this time to the original call times of the two components that have a call relationship in the group, so as to complete the corresponding call to the two components of the group.
  • Update of the number of calls The adjustment system obtains the calling relationship information of the two components with the calling relationship in the group according to the corresponding calling relationship between the components and the component and the updated calling times.
  • This embodiment provides a method for adjusting the deployment of Docker components based on affinity.
  • affinity relationship between the components is automatically analyzed.
  • the deployment of each component on the host groups in different regions is dynamically adjusted, so that the components with higher affinity can be deployed on the host groups in the same region , Conducive to data communication transmission and execution efficiency.
  • an embodiment of the present application also provides an apparatus for adjusting the deployment of Docker components based on affinity.
  • the Docker components are deployed in a host group, and the host group is all the hosts set in the same area. Formed cluster, the device includes:
  • the obtaining module 1 is configured to obtain, according to a preset frequency, the operation information among the Docker components within a time period corresponding to the preset frequency and the operation occupation information corresponding to each of the Docker components, wherein the operation
  • the information is the calling relationship information and resource sharing information between each of the Docker components, the calling relationship information is the calling relationship and the number of calls corresponding to each other between the components, and the resource sharing information is that the components and the components are shared at runtime The corresponding information of the called resource;
  • the parsing module 2 is used to analyze the operation information between the Docker components and the operation occupation information of the Docker components to obtain the affinity relationship between the Docker components;
  • the first generation module 3 is used to call the Apriori algorithm to analyze the affinity relationship between each of the Docker components, and generate a frequent item set of components, wherein the frequent item set of the component includes the affinity relationship between the Docker components set;
  • the adjustment module 4 is configured to adjust the deployment of each Docker component on each host group according to the affinity relationship between each Docker component and the frequent item set of the component.
  • This embodiment provides an apparatus for adjusting the deployment of Docker components based on affinity.
  • affinity relationship between the components is automatically analyzed.
  • the deployment of each component on the host groups in different regions is dynamically adjusted, so that the components with higher affinity can be deployed on the host groups in the same region , Conducive to data communication transmission and execution efficiency.
  • an embodiment of the present application also provides a computer device.
  • the computer device may be a server, and its internal structure may be as shown in FIG. 3.
  • the computer equipment includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the computer designed processor is used to provide calculation and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system, computer readable instructions, and a database.
  • the internal memory provides an environment for the operation of the operating system and computer-readable instructions in the non-volatile storage medium.
  • the database of the computer equipment is used to store data such as the affinity relationship database.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection.
  • FIG. 3 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied.
  • An embodiment of the present application further provides a computer-readable storage medium.
  • the readable storage medium may be a volatile readable storage medium or a non-volatile readable storage medium on which computer-readable instructions are stored.
  • the processes of the above-mentioned method embodiments are executed.
  • the above are only the preferred embodiments of this application, and do not limit the scope of this application. Any equivalent structure or equivalent process transformation made using the content of this application description and drawings, or directly or indirectly applied to other related The technical field is equally included in the scope of patent protection of this application.

Abstract

The present application provides a method, apparatus, computer device, and readable storage medium for adjusting the deployment of a Docker component on the basis of affinity, relating to the technical field of distributed deployment, said method comprising: according to a preset frequency, obtaining run information and run occupancy information between Docker components within a time period corresponding to the preset frequency; analyzing the run information between each component and the run occupancy information of each component to obtain an affinity relationship; generating a frequent item set of components according to each affinity relationship; according to each affinity relationship and the frequent item set of components, adjusting the deployment of each component in each host group. In the present application, the run information and run occupancy information of each Docker component in a system is monitored according to a preset frequency, and the affinity relationship between each component is automatically parsed; according to the priority and the affinity between the components, the deployment of various components on each host group is adjusted such that components having higher affinity may be deployed on the same geographical host group, thus facilitating data communication transmission and execution efficiency.

Description

基于亲和性调整Docker组件部署的方法和相关设备Method and related equipment for adjusting Docker component deployment based on affinity
本申请要求于2019年2月11日提交中国专利局、申请号为201910110281.9,发明名称为“基于亲和性调整Docker组件部署的方法和相关设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on February 11, 2019, the application number is 201910110281.9, and the invention title is "Methods and Related Equipment for Adjusting Docker Component Deployment Based on Affinity". The reference is incorporated in this application.
技术领域Technical field
本申请涉及分布式部署技术领域,特别涉及一种基于亲和性调整Docker组件部署的方法和相关设备。This application relates to the field of distributed deployment technology, and in particular to a method and related equipment for adjusting the deployment of Docker components based on affinity.
背景技术Background technique
在大型的金融系统中,常常使用Docker容器来部署微服务的分布式系统。分布式系统中常常涉及到十几个,甚至是几十个组件,各组件设置在Docker容器中,基于Docker容器来运行分布式系统。各Docker组件的运行需要高效的交互以及合理的资源利用。因此,需要解析出各组件间的亲和关系,以便用于管理哪些Docker组件部署在一起,哪些Docker组件在部署时需要相互隔离。其中,亲和关系是指组件间的亲和性的关系,亲和性用以表现组件间的内在联系是否密切,比如根据组件与组件间运行时的相互调用和资源共享等情况是否频繁,从而判断组件间的亲和性。现有用户通过k8s(Kubernetes)这一内部容器管理系统来实现根据亲和关系对Docker组件的部署。但是,通过k8s进行Docker组件部署时,各组件的亲和关系需要用户通过手动设置非常详细的标签和配置,然后k8s才能根据各组件的标签和配置进行组件间亲和关系的确定。并且,配置和标签一旦确定后,组件间的亲和关系将不能被调整,除非对系统进行重启,才能再次完成组件的部署。In large financial systems, Docker containers are often used to deploy micro-service distributed systems. A dozen or even dozens of components are often involved in a distributed system. Each component is set in a Docker container, and the distributed system is run based on the Docker container. The operation of each Docker component requires efficient interaction and reasonable resource utilization. Therefore, it is necessary to parse out the affinity relationship between the components in order to manage which Docker components are deployed together and which Docker components need to be isolated from each other during deployment. Among them, the affinity relationship refers to the affinity relationship between components. Affinity is used to show whether the internal connection between components is close, for example, according to whether the mutual calls and resource sharing between components and components are frequent, so Determine the affinity between components. Existing users use k8s (Kubernetes), an internal container management system, to deploy Docker components based on affinity. However, when deploying Docker components through k8s, the affinity of each component requires the user to manually set a very detailed label and configuration, and then k8s can determine the affinity between components based on the label and configuration of each component. Moreover, once the configuration and label are determined, the affinity between the components cannot be adjusted, unless the system is restarted to complete the deployment of the components again.
技术问题technical problem
本申请的主要目的为提供一种基于亲和性调整Docker组件部署的方法和相关设备,旨在解决现有Docker组件间的亲和关系需要手动设置以及Docker组件的部署不具有即时性的弊端。The main purpose of this application is to provide a method and related equipment for adjusting the deployment of Docker components based on affinity, which aims to solve the disadvantages that the affinity relationship between existing Docker components needs to be manually set and the deployment of Docker components is not instantaneous.
技术解决方案Technical solutions
为实现上述目的,本申请提供了一种基于亲和性调整Docker组件部署的方法,所述Docker组件部署于主机群中,所述主机群为设置在同一地区的所有所述主机形成的集群,所述方法包括:In order to achieve the above objective, this application provides a method for adjusting the deployment of Docker components based on affinity. The Docker components are deployed in a host cluster, which is a cluster formed by all the hosts located in the same region. The method includes:
根据预设频率,获取所述预设频率对应的时间段内的各所述Docker组件间的运行信息以及各所述Docker组件分别对应的运行占用信息,其中,所述运行 信息为各所述Docker组件间的调用关系信息和资源共享信息,所述调用关系信息为组件与组件间相互对应的调用关系和调用次数,所述资源共享信息为组件与组件间在运行时共同调用的资源的对应信息;According to a preset frequency, the operating information between the Docker components and the operating occupation information corresponding to each of the Docker components in the time period corresponding to the preset frequency are acquired, where the operating information is each Docker The calling relationship information and resource sharing information between components, the calling relationship information is the calling relationship and the number of calls corresponding to each other between the components, and the resource sharing information is the corresponding information of the resources commonly called between the components and the components at runtime ;
解析各所述Docker组件间的运行信息和各所述Docker组件的运行占用信息,得到各所述Docker组件间的亲和关系;Parse the operating information between the Docker components and the operating occupation information of each Docker component to obtain the affinity relationship between the Docker components;
调用Apriori算法解析各所述Docker组件间的亲和关系,生成组件频繁项集,其中,所述组件频繁项集为包含各所述Docker组件间的亲和关系的集合;Invoke the Apriori algorithm to analyze the affinity relationship between the Docker components, and generate a frequent item set of components, where the frequent item set of the component is a set containing the affinity relationship between the Docker components;
根据各所述Docker组件间的亲和关系和所述组件频繁项集,调整各所述Docker组件在各主机群上的部署。Adjust the deployment of each Docker component on each host group according to the affinity relationship between the Docker components and the frequent item set of the components.
本申请还提供了一种基于亲和性调整Docker组件部署的装置,所述Docker组件部署于主机群中,所述主机群为设置在同一地区的所有所述主机形成的集群,所述装置包括:The present application also provides a device for adjusting the deployment of Docker components based on affinity. The Docker components are deployed in a host group, and the host group is a cluster formed by all the hosts located in the same area, and the device includes :
获取模块,用于根据预设频率,获取所述预设频率对应的时间段内的各所述Docker组件间的运行信息以及各所述Docker组件分别对应的运行占用信息,其中,所述运行信息为各所述Docker组件间的调用关系信息和资源共享信息,所述调用关系信息为组件与组件间相互对应的调用关系和调用次数,所述资源共享信息为组件与组件间在运行时共同调用的资源的对应信息;The obtaining module is configured to obtain the operation information among the Docker components within the time period corresponding to the preset frequency and the operation occupation information corresponding to each of the Docker components according to the preset frequency, wherein the operation information Is the calling relationship information and resource sharing information between the Docker components, the calling relationship information is the calling relationship and the number of calls corresponding to each other between the components, and the resource sharing information is the common calling between the components and the components at runtime The corresponding information of the resource;
解析模块,用于解析各所述Docker组件间的运行信息和各所述Docker组件的运行占用信息,得到各所述Docker组件间的亲和关系;The parsing module is used to analyze the operation information between the Docker components and the operation occupation information of the Docker components to obtain the affinity relationship between the Docker components;
第一生成模块,用于调用Apriori算法解析各所述Docker组件间的亲和关系,生成组件频繁项集,其中,所述组件频繁项集为包含各所述Docker组件间的亲和关系的集合;The first generation module is used to call the Apriori algorithm to analyze the affinity relationship between the Docker components and generate a frequent item set of components, wherein the frequent item set of the component is a set containing the affinity relationship between the Docker components ;
调整模块,用于根据各所述Docker组件间的亲和关系和所述组件频繁项集,调整各所述Docker组件在各主机群上的部署。The adjustment module is used to adjust the deployment of each Docker component on each host group according to the affinity relationship between each Docker component and the frequent item set of the component.
本申请还提供一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机程序,所述处理器执行所述计算机程序时实现上述任一项所述方法的步骤。The present application also provides a computer device, including a memory and a processor, the memory stores a computer program, and the processor implements the steps of any one of the above methods when the computer program is executed by the processor.
本申请还提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述任一项所述的方法的步骤。The present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of any one of the above methods are implemented.
有益效果Beneficial effect
本申请中提供的一种基于亲和性调整Docker组件部署的方法、装置和计算 机设备,通过根据预设频率监控系统中各Docker组件的运行信息和运行占用信息,从而自动解析得到各组件间的亲和关系。再根据预设的优先级和组件间的亲和关系,动态调整各组件在各不同地区的主机群上的部署,从而使得具有较高亲和性的组件可以部署在相同的地域的主机群上,有利于数据通信传输和执行效率。This application provides a method, device and computer equipment for adjusting the deployment of Docker components based on affinity. By monitoring the operation information and operation occupancy information of each Docker component in the system according to a preset frequency, it automatically analyzes and obtains the information between the components. Affinity. Then according to the preset priority and the affinity relationship between the components, the deployment of each component on the host groups in different regions is dynamically adjusted, so that the components with higher affinity can be deployed on the host groups in the same region , Conducive to data communication transmission and execution efficiency.
附图说明Description of the drawings
图1是本申请一实施例中亲和性调整Docker组件部署的方法步骤示意图;FIG. 1 is a schematic diagram of the method steps for affinity adjustment of Docker component deployment in an embodiment of the present application;
图2是本申请一实施例中亲和性调整Docker组件部署的装置整体结构框图;Fig. 2 is a block diagram of the overall structure of an apparatus for affinity adjustment of Docker component deployment in an embodiment of the present application;
图3是本申请一实施例的计算机设备的结构示意框图。FIG. 3 is a schematic block diagram of the structure of a computer device according to an embodiment of the present application.
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization, functional characteristics, and advantages of the purpose of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings.
本发明的最佳实施方式The best mode of the invention
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions, and advantages of this application clearer, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the application, and not used to limit the application.
参照图1,本申请一实施例中提供了一种基于亲和性调整Docker组件部署的方法,所述Docker组件部署于主机群中,所述主机群为设置在同一地区的所有所述主机形成的集群,所述方法包括:1, an embodiment of the present application provides a method for adjusting the deployment of Docker components based on affinity. The Docker components are deployed in a host group formed by all the hosts located in the same area. , The method includes:
S1:根据预设频率,获取所述预设频率对应的时间段内的各所述Docker组件间的运行信息以及各所述Docker组件分别对应的运行占用信息,其中,所述运行信息为各所述Docker组件间的调用关系信息和资源共享信息,所述调用关系信息为组件与组件间相互对应的调用关系和调用次数,所述资源共享信息为组件与组件间在运行时共同调用的资源的对应信息;S1: According to the preset frequency, obtain the operation information among the Docker components within the time period corresponding to the preset frequency and the operation occupation information corresponding to each of the Docker components, where the operation information is each The calling relationship information and resource sharing information between the Docker components, the calling relationship information is the calling relationship and the number of calls between the components and the components, and the resource sharing information is the resource sharing between the components and the components at runtime. Corresponding information
S2:解析各所述Docker组件间的运行信息和各所述Docker组件的运行占用信息,得到各所述Docker组件间的亲和关系;S2: Parse the operation information between the Docker components and the operation occupation information of each Docker component to obtain the affinity relationship between the Docker components;
S3:调用Apriori算法解析各所述Docker组件间的亲和关系,生成组件频繁项集,其中,所述组件频繁项集为包含各所述Docker组件间的亲和关系的集合;S3: Invoke the Apriori algorithm to analyze the affinity relationship between the Docker components to generate a frequent item set of components, where the frequent item set of the component is a set containing the affinity relationship between the Docker components;
S4:根据各所述Docker组件间的亲和关系和所述组件频繁项集,调整各所述Docker组件在各主机群上的部署。S4: Adjust the deployment of each Docker component on each host group according to the affinity relationship between each Docker component and the frequent item set of the component.
本实施例中,各主机群中的监控服务实时监控docker容器中各docker组件间的运行信息和各docker组件分别对应的运行占用信息。其中,运行信息包括各d ocker组件间的调用关系信息和资源共享信息;调用关系信息包括各docker组件间相互对应的调用关系和调用次数,由于docker容器组件,即docker组件中的服务在相互调用时,需要将调用请求先发送到API Gateway组件,由API Gateway组件负责将调用请求转发到目的端组件的服务,因此调整系统可以通过监控API Gateway组件中调用请求的转发情况,得到各调用请求对应的发起端组件和目的端组件,从而得到各组件间的相互对应的调用关系,并且通过统计各具有调用关系的调用请求的转发数量,得到具有调用关系的两个组件对应的调用次数;资源共享信息为组件与组件间在运行时共同调用的资源的信息,调整系统通过网络监控可以获取docker容器组件中服务访问资源,并根据访问的资源的请求端得到具有资源共享的情况的两个组件,即组件与组件间在运行时公共调用的资源的对应信息;运行占用信息包括组件服务在运行时的CPU占用率和内存占用量,调整系统通过docker容器中的监控服务可以实时监控得到。调整系统根据预设频率调整各docker组件在各主机群上的部署。因此,调整系统根据预设频率,从各主机群实时监控的所有信息中截取预设频率对应的时间段的各docker组件间的运行信息和各docker组件分别对应的运行占用信息进行下一步的解析。其中,各docker组件分别对应的运行占用信息为预设频率对应的时间段内的平均值。调整系统首先根据各docker组件间的调用次数和预设频率对应的时间段,计算得到各docker组件的调用频率。然后,将各docker组件间的调用频率、各docker组件间的资源共享信息和各docker组件的运行占用信息输入预先构建的亲和关系库中。其中,亲和关系库中存储有组件间的调用频率、组件间的资源共享信息、组件的运行占用信息与亲和关系映射关系表,调用系统根据映射关系表匹配得到各docker组件间的亲和关系。其中,亲和关系包括亲和信息以及亲和信息对应的两个组件,亲和信息包括亲和、较亲和、违亲和和反亲和。在进行匹配的过程中,部分组件与其它组件不具有任何的亲和关系,具体表示为“无亲和关系”。调整系统根据匹配后得到的各docker组件间的亲和关系,从各组件中筛选得到与其它组件具有确定的亲和关系的各个第一组件,即从所有组件中除去“无亲和关系”的部分组件,得到各个第一组件。调整系统根据筛选得到的各个第一组件以及各组件间的亲和关系,生成各第一组件的亲和关系对应过的亲和性集。其中,亲和性集为具有确定的亲和关系的两个第一组件和对应的亲和信息组成的集合,比如,[组件1,组件2,亲和]。调整系统通过Apriori算法解析所有的亲和性集,统计得到各个第一组件的出现次数以及第一组 件的各个亲和信息对应的出现次数,并根据各个第一组件、各个第一组件的出现次数以及第一组件的各亲和信息对应过的出现次数,生成组件频繁项集。比如,各第一组件的亲和性集为:{[组件1,组件2,亲和],[组件2,组件3,反亲和],[组件2,组件4,较亲和]},经过解析后生成的组件频繁项集为:{[组件1,出现次数:1次,亲和:1次,较亲和:0次,违亲和:0次,反亲和:0次],[组件2,出现次数:3次,亲和:1次,较亲和:1次,违亲和:0次,反亲和:1次],[组件3,出现次数:1次,亲和:0次,较亲和:0次,违亲和:0次,反亲和:1次],[组件4,出现次数:1次,亲和:0次,较亲和:1次,违亲和:0次,反亲和:0次]}。调整系统首先根据预先设定的优先级,从组件频繁项集中筛选出优先级第一的第一组件,并将优先级第一的第一组件部署在第一主机群。其中,预先设定的优先级为:出现次数>亲和>较亲和>违亲和>反亲和,各项中又以对应的数值的大小降序排列;第一主机群为各主机群中的任意一台。然后,调整系统根据优先级,从组件频繁项集中筛选出优先级第二的第一组件,并根据亲和关系判断优先级第二的第一组件和优先级第一的第一组件之间是否为亲和或较亲和,即是否符合预设条件,以完成预设条件的判断动作。若符合,则将优先级第二的第一组件部署在第一主机群;若不符合,则将优先级第二的第一组件部署在第二主机群,已完成部署组件动作。其中,第二主机群为各主机群中除去第一主机群之外的任一主机群,同一主机群为设置在同一地区的所有主机群形成的集群。调整系统依次按照优先级降序从组件频繁项集中筛选第一组件,并逐一与已部署在主机群中的第一组件执行预设条件的判断动作,直至组件频繁项集中的所有第一组件均部署完成。In this embodiment, the monitoring service in each host group monitors in real time the operation information between the docker components in the docker container and the operation occupation information corresponding to each docker component. Among them, the operation information includes the calling relationship information and resource sharing information between the docker components; the calling relationship information includes the calling relationship and the number of calls between the docker components. Because the docker container component, that is, the services in the docker component are calling each other When you need to send the call request to the API Gateway component first, the API Gateway component is responsible for forwarding the call request to the service of the destination component, so the adjustment system can monitor the forwarding of the call request in the API Gateway component to obtain the corresponding call request Initiating component and destination component of each component, so as to obtain the corresponding calling relationship between each component, and by counting the number of forwarding of the calling request with the calling relationship, the number of calls corresponding to the two components with the calling relationship is obtained; resource sharing Information is the information of the resources that are commonly called between components and components at runtime. The adjustment system can obtain service access resources in the docker container component through network monitoring, and obtain two components with resource sharing based on the requesting end of the accessed resources. That is, the corresponding information of the resources commonly called between components and components at runtime; the operating occupation information includes the CPU occupancy rate and memory occupancy of the component service at runtime, and the adjustment system can be monitored in real time through the monitoring service in the docker container. The adjustment system adjusts the deployment of each docker component on each host group according to the preset frequency. Therefore, according to the preset frequency, the adjustment system intercepts all the information of the real-time monitoring of each host group from the operating information of each docker component in the time period corresponding to the preset frequency and the operating occupation information corresponding to each docker component for the next analysis . Among them, the operation occupancy information corresponding to each docker component is the average value in the time period corresponding to the preset frequency. The adjustment system first calculates the calling frequency of each docker component according to the number of calls between each docker component and the time period corresponding to the preset frequency. Then, input the calling frequency between each docker component, the resource sharing information between each docker component, and the operation occupation information of each docker component into the pre-built affinity library. Among them, the affinity relationship library stores the calling frequency between components, the resource sharing information between components, the operation occupation information of the components and the affinity relationship mapping relationship table. The calling system obtains the affinity between each docker component according to the mapping relationship table. relationship. Among them, the affinity relationship includes affinity information and two components corresponding to the affinity information, and the affinity information includes affinity, closer affinity, violation of affinity, and anti-affinity. During the matching process, some components do not have any affinity with other components, which is specifically expressed as "no affinity". According to the affinity relationship between the docker components obtained after the matching, the adjustment system filters each component to obtain each first component that has a definite affinity relationship with other components, that is, removes the "non-affinity" from all components Part of the components, get each first component. The adjustment system generates an affinity set corresponding to the affinity relationship of each first component according to each first component obtained through screening and the affinity relationship between each component. Among them, the affinity set is a set composed of two first components with a certain affinity relationship and corresponding affinity information, for example, [component 1, component 2, affinity]. The adjustment system analyzes all affinity sets through the Apriori algorithm, and obtains statistics on the number of appearances of each first component and the number of appearances corresponding to each affinity information of the first component, and according to the appearance times of each first component and each first component And the number of occurrences corresponding to each affinity information of the first component to generate a component frequent item set. For example, the affinity set of each first component is: {[component 1, component 2, affinity], [component 2, component 3, anti-affinity], [component 2, component 4, more affinity]}, The component frequent itemset generated after analysis is: {[component 1, occurrences: 1, affinity: 1, relatively affinity: 0, violation of affinity: 0, anti-affinity: 0], [Component 2, number of occurrences: 3 times, affinity: 1 time, more affinity: 1 time, violation of affinity: 0 times, anti-affinity: 1 time], [component 3, number of occurrences: 1 time, affinity : 0 times, more affinity: 0 times, violation of affinity: 0 times, anti-affinity: 1 time], [component 4, number of occurrences: 1 time, affinity: 0 times, more affinity: 1 time, violation Affinity: 0 times, anti-affinity: 0 times]}. The adjustment system first selects the first component with the first priority from the component frequent item set according to the preset priority, and deploys the first component with the first priority in the first host group. Among them, the preset priority is: number of occurrences> affinity> relatively affinity> violation of affinity> anti affinity, and each item is arranged in descending order of the corresponding value; the first host group is each host group Any one of Then, the adjustment system screens out the first component with the second priority from the component frequent item set according to the priority, and judges whether the first component with the second priority and the first component with the first priority are connected according to the affinity relationship. It is affinity or more affinity, that is, whether the preset conditions are met to complete the judgment action of the preset conditions. If it does, the first component with the second priority is deployed in the first host group; if it does not, the first component with the second priority is deployed in the second host group, and the component deployment action has been completed. Wherein, the second host group is any host group excluding the first host group in each host group, and the same host group is a cluster formed by all host groups set up in the same area. The adjustment system sequentially selects the first component from the component frequent item set in descending order of priority, and executes the judgment action of the preset conditions with the first component deployed in the host group one by one, until all the first components in the component frequent item set are deployed carry out.
进一步的,所述运行占用信息包括CPU占用率和内存占用量,所述解析各所述Docker组件间的运行信息和各所述Docker组件的运行占用信息,得到各所述Docker组件间的亲和关系的步骤,包括:Further, the operation occupation information includes CPU occupancy rate and memory occupancy, and the operation information among the Docker components and the operation occupation information of the Docker components are analyzed to obtain the affinity between the Docker components. The steps of the relationship include:
S201:根据各所述Docker组件间的调用次数和所述预设频率对应的时间段,计算得到各Docker组件间的调用频率;S201: Calculate the calling frequency between the Docker components according to the number of calls between the Docker components and the time period corresponding to the preset frequency;
S202:将各所述Docker组件间的调用频率、各所述Docker组件间的资源共享信息和各所述Docker组件的运行占用信息输入预先构建的亲和关系库中,匹配得到各所述Docker组件间的亲和关系,其中,所述亲和关系库中存储有组件间的调用频率、组件间的资源共享信息、组件的运行占用信息与亲和关系映射关系表。S202: Input the calling frequency among the Docker components, the resource sharing information among the Docker components, and the operation occupation information of each Docker component into a pre-built affinity library, and match each Docker component to obtain The affinity relationship between the components, wherein the affinity relationship library stores the calling frequency between the components, the resource sharing information between the components, the operation occupation information of the components and the affinity relationship mapping relationship table.
本实施例中,调整系统将各Docker组件间的调用次数和预设频率对应的时间段输入预设的计算公式中,计算得到各Docker组件间的调用频率。其中,计算公式为F=N/S,F为调用频率,N为调用次数,S为预设频率对应的时间段,比如,预设频率为30分钟/次,则S为30分钟。在得到各Docker组件间的调用频率后,调整系统将各Docker组件间的调用频率、各Docker组件间的资源共享信息和各Docker组件的运行占用信息输入预先构建的亲和关系库中,根据亲和关系库中存储的组件间的调用频率、组件间的资源共享信息、组件的运行占用信息与亲和关系映射关系表,匹配得到各组件间的亲和关系。其中,映射关系表为:In this embodiment, the adjustment system inputs the number of calls between the Docker components and the time period corresponding to the preset frequency into the preset calculation formula, and calculates the call frequency between the Docker components. The calculation formula is F=N/S, F is the calling frequency, N is the number of calls, and S is the time period corresponding to the preset frequency. For example, if the preset frequency is 30 minutes/time, then S is 30 minutes. After obtaining the calling frequency between each Docker component, the adjustment system inputs the calling frequency between each Docker component, the resource sharing information between each Docker component, and the operation occupancy information of each Docker component into the pre-built affinity library. Match the calling frequency between the components, the resource sharing information between the components, the operation occupancy information of the components and the affinity relationship mapping relationship table stored in the relationship library, and obtain the affinity relationship between the components. Among them, the mapping table is:
Figure PCTCN2019116704-appb-000001
Figure PCTCN2019116704-appb-000001
进一步的,所述Docker组件间的亲和关系包括两个Docker组件对应的亲和信息,所述调用Apriori算法解析各所述Docker组件间的亲和关系,生成组件频繁项集的步骤,包括:Further, the affinity relationship between the Docker components includes the affinity information corresponding to two Docker components, and the step of invoking the Apriori algorithm to analyze the affinity relationship between the Docker components and generating a frequent item set of components includes:
S301:根据各所述Docker组件间的亲和关系,从各所述Docker组件中筛选得到与其他Docker组件具有确定的亲和关系的各个第一组件;S301: According to the affinity relationship between the Docker components, filter each Docker component to obtain each first component that has a definite affinity relationship with other Docker components;
S302:根据各所述第一组件以及各所述Docker组件间的亲和关系,生成各所述第一组件间的亲和关系对应的亲和性集;S302: According to each of the first components and the affinity relationship between each of the Docker components, generate an affinity set corresponding to the affinity relationship between each of the first components;
S303:根据各所述亲和性集,统计得到各所述第一组件的出现次数以及各所述第一组件对应的各亲和信息对应的出现次数;S303: According to each of the affinity sets, statistically obtain the number of appearances of each of the first components and the number of appearances of each affinity information corresponding to each of the first components;
S304:根据各所述第一组件、各所述第一组件的出现次数以及各所述第一组件的各亲和信息对应的出现次数,生成所述组件频繁项集。S304: Generate the component frequent item set according to each of the first components, the number of appearances of each of the first components, and the number of appearances corresponding to each affinity information of each of the first components.
本实施例中,调整系统根据匹配得到的各Docker组件间的亲和关系中,包括两个Docker组件对应的亲和信息,比如,亲和关系为:组件1,组件2,亲和,其中“亲和”为亲和信息。调整系统从各Docker组件中筛选得到与其它Docker组件具有确定的亲和关系的各个第一组件,即从所有Docker组件中除去“无亲和关系”的部分Docker组件,得到各个第一组件。调整系统根据筛选得到的各个第一组件以及各Docker组件间的亲和关系,生成各第一组件的亲和关系对应的亲和性集。其中,亲和性集为具有确定的亲和关系的两个第一组件和对应的亲和信息组成的集合,比如,亲和性集为:[组件1,组件2,亲和]。调整系统通过Apriori算法解析所有的亲和性集,统计得到各个第一组件的出现次数以及第一组件的各个亲和信息对应的出现次数,并根据各个第一组件、各个第一组件的出现次数以及第一组件的各亲和信息对应过的出现次数,生成组件频繁项集。比如,各第一组件的亲和性集为:{[组件1,组件2,亲和],[组件2,组件3,反亲和],[组件2,组件4,较亲和]},经过解析后生成的组件频繁项集为:{[组件1,出现次数:1次,亲和:1次,较亲和:0次,违亲和:0次,反亲和:0次],[组件2,出现次数:3次,亲和:1次,较亲和:1次,违亲和:0次,反亲和:1次],[组件3,出现次数:1次,亲和:0次,较亲和:0次,违亲和:0次,反亲和:1次],[组件4,出现次数:1次,亲和:0次,较亲和:1次,违亲和:0次,反亲和:0次]}。In this embodiment, the affinity relationship between the Docker components obtained by the adjustment system according to the matching includes the affinity information corresponding to the two Docker components. For example, the affinity relationship is: component 1, component 2, affinity, where " "Affinity" is the information of affinity. The adjustment system filters each Docker component to obtain each first component that has a definite affinity with other Docker components, that is, removes the "non-affinity" part of the Docker components from all Docker components to obtain each first component. The adjustment system generates an affinity set corresponding to the affinity relationship of each first component according to each first component obtained through screening and the affinity relationship between each Docker component. Among them, the affinity set is a set composed of two first components with a definite affinity relationship and corresponding affinity information. For example, the affinity set is: [component 1, component 2, affinity]. The adjustment system analyzes all affinity sets through the Apriori algorithm, and obtains statistics on the number of appearances of each first component and the number of appearances corresponding to each affinity information of the first component, and according to the appearance times of each first component and each first component And the number of occurrences corresponding to each affinity information of the first component to generate a component frequent item set. For example, the affinity set of each first component is: {[component 1, component 2, affinity], [component 2, component 3, anti-affinity], [component 2, component 4, more affinity]}, The component frequent itemset generated after analysis is: {[component 1, occurrences: 1, affinity: 1, relatively affinity: 0, violation of affinity: 0, anti-affinity: 0], [Component 2, number of occurrences: 3 times, affinity: 1 time, more affinity: 1 time, violation of affinity: 0 times, anti-affinity: 1 time], [component 3, number of occurrences: 1 time, affinity : 0 times, more affinity: 0 times, violation of affinity: 0 times, anti-affinity: 1 time], [component 4, number of occurrences: 1 time, affinity: 0 times, more affinity: 1 time, violation Affinity: 0 times, anti-affinity: 0 times]}.
进一步的,所述亲和信息包括亲和、较亲和、违亲和以及反亲和,所述根据各所述Docker组件间的亲和关系和所述组件频繁项集,调整各所述Docker组 件在各主机群上的部署的步骤,包括:Further, the affinity information includes affinity, relative affinity, violation of affinity, and anti-affinity. According to the affinity relationship between the Docker components and the frequent item set of the components, each Docker is adjusted. The steps to deploy components on each host cluster include:
S401:根据预先设定的优先级,从所述组件频繁项集中筛选出优先级第一的第一组件,并将所述优先级第一的第一组件部署在第一主机群,所述第一主机群为各所述主机群中的任一主机群;S401: According to a preset priority, filter out the first component with the first priority from the frequent item set of components, and deploy the first component with the first priority in a first host group, and A host group is any host group in each of the host groups;
S402:根据预先设定的优先级,从所述组件频繁项集中筛选出优先级第二的第一组件,并判断所述优先级第二的第一组件和所述优先级第一的第一组件之间的亲和关系是否符合预设条件,以完成预设条件的判断动作,其中,所述预设条件为组件之间的亲和关系为亲和或较亲和;S402: According to the preset priority, filter out the first component with the second priority from the component frequent item set, and determine the first component with the second priority and the first component with the first priority Whether the affinity relationship between the components meets the preset condition to complete the judgment action of the preset condition, wherein the preset condition is that the affinity relationship between the components is affinity or more affinity;
S403:若符合,则将所述优先级第二的第一组件部署在所述第一主机群;若不符合,则将优先级第二的第一组件部署在第二主机群,以完成部署组件动作,其中,所述第二主机群为各所述主机群中除所述第一主机群之外的任一主机群;S403: If it meets, deploy the first component with the second priority in the first host group; if it does not meet, deploy the first component with the second priority in the second host group to complete the deployment Component action, wherein the second host group is any host group in each of the host groups except the first host group;
S404:依次按照优先级降序从所述组件频繁项集中筛选第一组件,并与当前已部署在主机群的各第一组件逐一执行所述预设条件的判断动作和所述部署组件动作,直至所述组件频繁项集中的所有第一组件均部署完成。S404: Filter the first component from the component frequent item set in descending order of priority, and execute the judgment action of the preset condition and the deployment component action one by one with each first component currently deployed in the host group, until All the first components in the component frequent item set are deployed.
本实施例中,调整系统首先根据预先设定的优先级,从组件频繁项集中筛选出优先级第一的第一组件,并将优先级第一的第一组件部署在第一主机群。其中,预先设定的优先级为:出现次数>亲和>较亲和>违亲和>反亲和,各项中又以对应的数值的大小降序排列;第一主机群为各主机群中的任意一台。然后,调整系统根据优先级,从组件频繁项集中筛选出优先级第二的第一组件,并根据亲和关系判断优先级第二的第一组件和优先级第一的第一组件之间是否为亲和或较亲和,即是否符合预设条件,以完成预设条件的判断动作。若符合,则将优先级第二的第一组件部署在第一主机群;若不符合,则将优先级第二的第一组件部署在第二主机群,以完成部署组件动作。其中,第二主机群为各主机群中除去第一主机群之外的任一主机群。调整系统依次按照优先级降序从组件频繁项集中筛选第一组件,并与当前已部署在主机群中的各个第一组件逐一执行预设条件的判断动作和部署组件动作,直至组件频繁项集中的所有第一组件均部署完成。比如,组件频繁项集为:{[组件1,出现次数:1次,亲和:1次,较亲和:0次,违亲和:0次,反亲和:0次],[组件2,出现次数:3次,亲和:1次,较亲和:1次,违亲和:0次,反亲和:1次],[组件3,出现次数:1次,亲和:0次,较亲和:0次,违亲和:0次,反亲和:1次],[组件4,出现次数: 1次,亲和:0次,较亲和:1次,违亲和:0次,反亲和:0次]}。组件2出现了3次还有1次亲和,优先级第一,首先部署组件2到主机群1上。组件1的出现次数第2,亲和次数相比较多,优先级第二,所以接下来部署组件1。由于组件1和组件2亲和,则将组件1也部署到主机群1中。组件4和组件3,虽然出现次数都是1次,亲和次数都为0,但是组件4是较亲和,组件3是反亲和,所以优先部署组件4。组件4和主机群1上已经部署的组件1没有关联,和组件2是较亲和,所以可以部署在主机群1上。而如果出现违亲和和反亲和的关联,则不能部署在一起,要在新的主机群上独立部署。最后部署组件3,组件3和主机群1中部署的组件2是反亲和的,不能部署到主机群1中,要部署到新的主机群2中。In this embodiment, the adjustment system first selects the first component with the first priority from the component frequent item set according to the preset priority, and deploys the first component with the first priority in the first host group. Among them, the preset priority is: number of occurrences> affinity> relatively affinity> violation of affinity> anti affinity, and each item is arranged in descending order of the corresponding value; the first host group is each host group Any one of Then, the adjustment system screens out the first component with the second priority from the component frequent item set according to the priority, and judges whether the first component with the second priority and the first component with the first priority are connected according to the affinity relationship. It is affinity or more affinity, that is, whether the preset conditions are met to complete the judgment action of the preset conditions. If it matches, deploy the first component with the second priority in the first host group; if it does not match, deploy the first component with the second priority in the second host group to complete the component deployment action. The second host group is any host group excluding the first host group in each host group. The adjustment system sequentially filters the first component from the component frequent item set in descending order of priority, and executes the judgment action of the preset conditions and the deployment component action with each first component currently deployed in the host group, until the component frequent item set All the first components are deployed. For example, the component frequent item set is: {[Component 1, Occurrence: 1, Affinity: 1, Relative Affinity: 0, Violation Affinity: 0, Anti-Affinity: 0], [Component 2 , Occurrences: 3 times, Affinity: 1 time, Relative affinity: 1 time, Affinity violation: 0 times, Anti-affinity: 1 time], [Component 3, Occurrences: 1 time, Affinity: 0 times , More affinity: 0 times, violation of affinity: 0 times, anti-affinity: 1 time], [component 4, occurrences: 1 time, affinity: 0 times, more affinity: 1 time, violation of affinity: 0 times, anti-affinity: 0 times]}. Component 2 appears 3 times and has 1 affinity. The priority is first. Component 2 is first deployed to host group 1. The number of occurrences of component 1 is the second, the number of affinity is more, and the priority is second, so component 1 is deployed next. Because component 1 and component 2 are compatible, component 1 is also deployed to host group 1. Although the number of occurrences of component 4 and component 3 is 1, and the number of affinity is 0, component 4 is more affinity, and component 3 is anti-affinity, so component 4 is deployed first. Component 4 is not related to component 1 that has been deployed on host cluster 1, and is more compatible with component 2, so it can be deployed on host cluster 1. And if there is an association that violates affinity and anti-affinity, they cannot be deployed together, and they must be deployed independently on a new host group. Finally, component 3 is deployed. Component 3 and component 2 deployed in host cluster 1 are anti-affinity and cannot be deployed to host cluster 1, but must be deployed to new host cluster 2.
进一步的,所述将所述优先级第二的第一组件部署在所述第一主机群的步骤,包括:Further, the step of deploying the first component with the second priority in the first host group includes:
S4011:判断所述优先级第二的第一组件与所述优先级第一的第一组件之间的亲和关系是否为亲和;S4011: Determine whether the affinity relationship between the first component with the second priority and the first component with the first priority is an affinity;
S4012:若是亲和,则将所述优先级第二的第一组件与所述优先级第一的第一组件部署在同一主机;若是较亲和,则将所述优先级第二的第一组件部署在所述第一主机群中的任一主机。S4012: If it is affinity, deploy the first component with the second priority and the first component with the first priority on the same host; if it is more affinity, deploy the first component with the second priority The component is deployed on any host in the first host group.
本实施例中,主机群包括多个主机。调整系统在判定优先级第二的第一组件需要与优先级第一的第一组件部署在同一主机群时,还需要判断两个第一组件之间的关系是否为亲和,即为最高亲和度。如果是,则将优先级第二的第一组件与优先级第一的第一组件部署在同一主机上,以便两者之间的数据通信传输和执行效率更高。若不是两个第一组件间的关系为较亲和,则将优先级第二的第一组件随机部署在第一主机群中的任一主机上。In this embodiment, the host group includes multiple hosts. When the adjustment system determines that the first component with the second priority needs to be deployed in the same host group as the first component with the first priority, it also needs to determine whether the relationship between the two first components is affinity, that is, the highest affinity. And degree. If so, deploy the first component with the second priority and the first component with the first priority on the same host, so that the data communication transmission and execution efficiency between the two are higher. If the relationship between the two first components is not relatively close, the first component with the second priority is randomly deployed on any host in the first host group.
进一步的,所述根据预先设定的优先级,从所述组件频繁项集中筛选出优先级第二的第一组件,并判断所述优先级第二的第一组件和所述优先级第一的第一组件之间的亲和关系是否符合预设条件,以完成预设条件的判断动作的步骤中,包括:Further, according to the preset priority, the first component with the second priority is filtered out from the frequent item set of the components, and the first component with the second priority and the first component with the first priority are determined The step of determining whether the affinity relationship between the first components meets the preset condition to complete the preset condition includes:
S40201:判断当前已部署有第一组件的主机群数量是否不小于2;S40201: Determine whether the number of host groups currently deployed with the first component is not less than 2;
S40202:若不小于2,则逐一判断当前次进行部署的第一组件与各所述当前已部署有第一组件的主机群中的各Docker组件之间的亲和关系是否均符合所述预设条件,以完成预设条件的判断动作;S40202: If it is not less than 2, determine one by one whether the affinity relationship between the first component currently deployed and each Docker component in the host group on which the first component is currently deployed meets the preset Condition to complete the judgment action of the preset condition;
所述若符合,则将所述优先级第二的第一组件部署在所述第一主机群;若 不符合,则将优先级第二的第一组件部署在第二主机群,以完成部署组件动作的步骤中,包括:If it matches, deploy the first component with the second priority in the first host group; if it does not match, deploy the first component with the second priority in the second host group to complete the deployment The steps of component actions include:
S40301:将所述当前次进行部署的第一组件随机部署在各所述当前已部署有第一组件的主机群中的任意一个。S40301: Randomly deploy the first component that is currently deployed to any one of the host groups where the first component is currently deployed.
本实施例中,在当前已部署有第一组件的主机群的数量不小于2时,如果当前次进行部署的第一组件与各个当前已部署有第一组件的主机群中的各组件之间的亲和关系均符合预设条件,则将当前次进行部署的第一组件随机部署在各个当前已部署有第一组件的主机群中的任意一个。比如,当前已部署有第一组件的主机群为:主机群A,已部署的第一组件为a;主机群B,已部署的第一组件为b;主机群C,已部署的第一组件为c。当前次进行部署的第一组件为d,与第一组件a、b、c的亲和关系均为亲和或较亲和,则调整系统将第一组件d随机部署在主机群A、主机群B和主机群C中任意一个。In this embodiment, when the number of host clusters currently deployed with the first component is not less than 2, if the current deployment of the first component and each component in the host cluster currently deployed with the first component If the affinity relationship of both meets the preset condition, the first component currently deployed is randomly deployed in any one of the host groups where the first component is currently deployed. For example, the host group currently deployed with the first component is: host group A, the first deployed component is a; host group B, the first deployed component is b; host group C, the first deployed component Is c. The first component currently deployed is d, and the affinity with the first components a, b, and c are all affinity or more affinity, then adjust the system to randomly deploy the first component d in host group A and host group Any one of B and host group C.
进一步的,所述根据预设频率,获取所述预设频率对应的时间段内的各所述Docker组件间的运行信息以及各所述Docker组件分别对应的运行占用信息的步骤之前,包括:Further, before the step of obtaining the operation information between the Docker components and the operation occupancy information corresponding to each Docker component in the time period corresponding to the preset frequency according to the preset frequency, the step includes:
S5:实时监控API Gateway中调用请求的调用数据,其中,所述调用请求为各所述Docker组件间相互调用时发起的请求,所述调用数据包括请求端组件、目的端组件和调用请求的数量;S5: Real-time monitoring of the call data of the call request in the API Gateway, where the call request is a request initiated when the Docker components call each other, and the call data includes the request-side component, the destination-side component, and the number of call requests ;
S6:根据所述请求端组件和目的端组件生成所述组件与组件间相互对应的调用关系,并根据所述调用请求的数量,更新所述请求端组件和所述目的端组件对应的调用次数;S6: According to the request-end component and the destination-end component, generate the corresponding invocation relationship between the component and the component, and update the number of invocations corresponding to the request-end component and the destination-end component according to the number of invocation requests ;
S7:根据所述组件与组件间相互对应的调用关系和更新后的所述调用次数,生成所述调用关系信息。S7: Generate the calling relationship information according to the calling relationship corresponding to each other between the components and the updated calling times.
本实施例中,docker容器中的组件的服务在相互调用时,需要将调用请求先发送到API Gateway组件,然后由API Gateway组件负责将调用请求转发到目的端组件的服务。调整系统通过各主机中安装的监控服务Agent,监控并从API Gateway组件采集Docker容器服务之间的交互调用数据,其中,调用数据包括请求端组件、目的端组件和调用请求的数量。调整系统根据请求端组件和目的端组件,生成组件与组件间相互对应的调用关系,各组具有调用关系的两个组件记录有对应的调用次数。调整系统根据调用请求的数量,在该组具有调用关系的两个组件原来的调用次数的基础上,再次加上本次调用请求的数量,从而完 成对该组具有调用关系的两个组件对应的调用次数的更新。调整系统根据组件与组件间相互对应的调用关系,以及更新后的调用次数,得到该组具有调用关系的两个组件的调用关系信息。In this embodiment, when the services of the components in the docker container call each other, the call request needs to be sent to the API Gateway component first, and then the API Gateway component is responsible for forwarding the call request to the service of the destination component. The adjustment system monitors and collects interactive call data between Docker container services from the API Gateway component through the monitoring service agent installed in each host. The call data includes the request-side component, the destination-side component, and the number of invocation requests. The adjustment system generates a corresponding calling relationship between the component and the component based on the request-side component and the destination-side component, and the two components in each group with the calling relationship record the corresponding number of calls. Adjust the system according to the number of call requests, add the number of call requests this time to the original call times of the two components that have a call relationship in the group, so as to complete the corresponding call to the two components of the group. Update of the number of calls. The adjustment system obtains the calling relationship information of the two components with the calling relationship in the group according to the corresponding calling relationship between the components and the component and the updated calling times.
本实施例提供的一种基于亲和性调整Docker组件部署的方法,通过根据预设频率监控系统中各Docker组件的运行信息和运行占用信息,从而自动解析得到各组件间的亲和关系。再根据预设的优先级和组件间的亲和关系,动态调整各组件在各不同地区的主机群上的部署,从而使得具有较高亲和性的组件可以部署在相同的地域的主机群上,有利于数据通信传输和执行效率。This embodiment provides a method for adjusting the deployment of Docker components based on affinity. By monitoring the operating information and operating occupancy information of each Docker component in the system according to a preset frequency, the affinity relationship between the components is automatically analyzed. Then according to the preset priority and the affinity relationship between the components, the deployment of each component on the host groups in different regions is dynamically adjusted, so that the components with higher affinity can be deployed on the host groups in the same region , Conducive to data communication transmission and execution efficiency.
参照图2,本申请一实施例中还提供了一种基于亲和性调整Docker组件部署的装置,所述Docker组件部署于主机群中,所述主机群为设置在同一地区的所有所述主机形成的集群,所述装置包括:2, an embodiment of the present application also provides an apparatus for adjusting the deployment of Docker components based on affinity. The Docker components are deployed in a host group, and the host group is all the hosts set in the same area. Formed cluster, the device includes:
获取模块1,用于根据预设频率,获取所述预设频率对应的时间段内的各所述Docker组件间的运行信息以及各所述Docker组件分别对应的运行占用信息,其中,所述运行信息为各所述Docker组件间的调用关系信息和资源共享信息,所述调用关系信息为组件与组件间相互对应的调用关系和调用次数,所述资源共享信息为组件与组件间在运行时共同调用的资源的对应信息;The obtaining module 1 is configured to obtain, according to a preset frequency, the operation information among the Docker components within a time period corresponding to the preset frequency and the operation occupation information corresponding to each of the Docker components, wherein the operation The information is the calling relationship information and resource sharing information between each of the Docker components, the calling relationship information is the calling relationship and the number of calls corresponding to each other between the components, and the resource sharing information is that the components and the components are shared at runtime The corresponding information of the called resource;
解析模块2,用于解析各所述Docker组件间的运行信息和各所述Docker组件的运行占用信息,得到各所述Docker组件间的亲和关系;The parsing module 2 is used to analyze the operation information between the Docker components and the operation occupation information of the Docker components to obtain the affinity relationship between the Docker components;
第一生成模块3,用于调用Apriori算法解析各所述Docker组件间的亲和关系,生成组件频繁项集,其中,所述组件频繁项集为包含各所述Docker组件间的亲和关系的集合;The first generation module 3 is used to call the Apriori algorithm to analyze the affinity relationship between each of the Docker components, and generate a frequent item set of components, wherein the frequent item set of the component includes the affinity relationship between the Docker components set;
调整模块4,用于根据各所述Docker组件间的亲和关系和所述组件频繁项集,调整各所述Docker组件在各主机群上的部署。The adjustment module 4 is configured to adjust the deployment of each Docker component on each host group according to the affinity relationship between each Docker component and the frequent item set of the component.
本实施例中,装置各模块、单元的实施例与上述对应的方法步骤一致,在此不作详述。In this embodiment, the embodiments of the modules and units of the device are consistent with the corresponding method steps described above, and will not be described in detail here.
本实施例提供的一种基于亲和性调整Docker组件部署的装置,通过根据预设频率监控系统中各Docker组件的运行信息和运行占用信息,从而自动解析得到各组件间的亲和关系。再根据预设的优先级和组件间的亲和关系,动态调整各组件在各不同地区的主机群上的部署,从而使得具有较高亲和性的组件可以部署在相同的地域的主机群上,有利于数据通信传输和执行效率。This embodiment provides an apparatus for adjusting the deployment of Docker components based on affinity. By monitoring the operating information and operating occupancy information of each Docker component in the system according to a preset frequency, the affinity relationship between the components is automatically analyzed. Then according to the preset priority and the affinity relationship between the components, the deployment of each component on the host groups in different regions is dynamically adjusted, so that the components with higher affinity can be deployed on the host groups in the same region , Conducive to data communication transmission and execution efficiency.
参照图3,本申请实施例中还提供一种计算机设备,该计算机设备可以是服务器,其内部结构可以如图3所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设计的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机可读指令和数据库。该内存储器为非易失性存储介质中的操作系统和计算机可读指令的运行提供环境。该计算机设备的数据库用于存储亲和关系库等数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机可读指令被处理器执行时执行如上述各方法的实施例的流程。本领域技术人员可以理解,图3中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定。3, an embodiment of the present application also provides a computer device. The computer device may be a server, and its internal structure may be as shown in FIG. 3. The computer equipment includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the computer designed processor is used to provide calculation and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer readable instructions, and a database. The internal memory provides an environment for the operation of the operating system and computer-readable instructions in the non-volatile storage medium. The database of the computer equipment is used to store data such as the affinity relationship database. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer-readable instructions are executed by the processor, the processes of the foregoing method embodiments are executed. Those skilled in the art can understand that the structure shown in FIG. 3 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied.
本申请一实施例还提供一种计算机可读存储介质,该可读存储介质可以是易失性可读存储介质,也可以是非易失性可读存储介质,其上存储有计算机可读指令,计算机可读指令被处理器执行时,执行如上述各方法的实施例的流程。以上所述仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。An embodiment of the present application further provides a computer-readable storage medium. The readable storage medium may be a volatile readable storage medium or a non-volatile readable storage medium on which computer-readable instructions are stored. When the computer-readable instructions are executed by the processor, the processes of the above-mentioned method embodiments are executed. The above are only the preferred embodiments of this application, and do not limit the scope of this application. Any equivalent structure or equivalent process transformation made using the content of this application description and drawings, or directly or indirectly applied to other related The technical field is equally included in the scope of patent protection of this application.

Claims (20)

  1. 一种基于亲和性调整Docker组件部署的方法,所述Docker组件部署于主机群中,所述主机群为设置在同一地区的所有所述主机形成的集群,其特征在于,所述方法包括:A method for adjusting the deployment of Docker components based on affinity, where the Docker components are deployed in a host group, the host group being a cluster formed by all the hosts set up in the same area, characterized in that the method includes:
    根据预设频率,获取所述预设频率对应的时间段内的各所述Docker组件间的运行信息以及各所述Docker组件分别对应的运行占用信息,其中,所述运行信息为各所述Docker组件间的调用关系信息和资源共享信息,所述调用关系信息为组件与组件间相互对应的调用关系和调用次数,所述资源共享信息为组件与组件间在运行时共同调用的资源的对应信息;According to a preset frequency, the operating information between the Docker components and the operating occupation information corresponding to each of the Docker components in the time period corresponding to the preset frequency are acquired, where the operating information is each Docker The calling relationship information and resource sharing information between components, the calling relationship information is the calling relationship and the number of calls corresponding to each other between the components, and the resource sharing information is the corresponding information of the resources commonly called between the components and the components at runtime ;
    解析各所述Docker组件间的运行信息和各所述Docker组件的运行占用信息,得到各所述Docker组件间的亲和关系;Parse the operating information between the Docker components and the operating occupation information of each Docker component to obtain the affinity relationship between the Docker components;
    调用Apriori算法解析各所述Docker组件间的亲和关系,生成组件频繁项集,其中,所述组件频繁项集为包含各所述Docker组件间的亲和关系的集合;Invoke the Apriori algorithm to analyze the affinity relationship between the Docker components, and generate a frequent item set of components, where the frequent item set of the component is a set containing the affinity relationship between the Docker components;
    根据各所述Docker组件间的亲和关系和所述组件频繁项集,调整各所述Docker组件在各主机群上的部署。Adjust the deployment of each Docker component on each host group according to the affinity relationship between the Docker components and the frequent item set of the components.
  2. 根据权利要求1所述的基于亲和性调整Docker组件部署的方法,其特征在于,所述运行占用信息包括CPU占用率和内存占用量,所述解析各所述Docker组件间的运行信息和各所述Docker组件的运行占用信息,得到各所述Docker组件间的亲和关系的步骤,包括:The method for adjusting the deployment of Docker components based on affinity according to claim 1, wherein the operating occupancy information includes a CPU occupancy rate and a memory occupancy, and the analysis of the operating information and each of the Docker components The steps of obtaining the affinity relationship between the Docker components by the operation occupation information of the Docker components include:
    根据各所述Docker组件间的调用次数和所述预设频率对应的时间段,计算得到各Docker组件间的调用频率;According to the number of calls between the Docker components and the time period corresponding to the preset frequency, the call frequency between the Docker components is calculated;
    将各所述Docker组件间的调用频率、各所述Docker组件间的资源共享信息和各所述Docker组件的运行占用信息输入预先构建的亲和关系库中,匹配得到各所述Docker组件间的亲和关系,其中,所述亲和关系库中存储有组件间的调用频率、组件间的资源共享信息、组件的运行占用信息与亲和关系映射关系表。Input the calling frequency between the Docker components, the resource sharing information between the Docker components, and the operation occupation information of the Docker components into the pre-built affinity library, and match to obtain the information between the Docker components. Affinity relationship, wherein the affinity relationship library stores a calling frequency between components, resource sharing information between components, operation occupation information of components, and an affinity relationship mapping relationship table.
  3. 根据权利要求1所述的基于亲和性调整Docker组件部署的方法,其特征在于,所述Docker组件间的亲和关系包括两个Docker组件对应的亲和信息,所述调用Apriori算法解析各所述Docker组件间的亲和关系,生成组件频繁项集的步骤,包括:The method for adjusting the deployment of Docker components based on affinity according to claim 1, wherein the affinity relationship between the Docker components includes the affinity information corresponding to the two Docker components, and the Apriori algorithm is called to analyze the Describe the affinity between Docker components and the steps to generate frequent itemsets of components, including:
    根据各所述Docker组件间的亲和关系,从各所述Docker组件中筛选得到与其他Docker组件具有确定的亲和关系的各个第一组件;According to the affinity relationship between each of the Docker components, filter each of the Docker components to obtain each first component that has a certain affinity with other Docker components;
    根据各所述第一组件以及各所述Docker组件间的亲和关系,生成各所述第一组件间的亲和关系对应的亲和性集;Generating an affinity set corresponding to the affinity relationship between each of the first components according to each of the first components and the affinity relationship between each of the Docker components;
    根据各所述亲和性集,统计得到各所述第一组件的出现次数以及各所述第一组件对应的各亲和信息对应的出现次数;According to each of the affinity sets, the number of appearances of each of the first components and the number of appearances of each affinity information corresponding to each of the first components are obtained by statistics;
    根据各所述第一组件、各所述第一组件的出现次数以及各所述第一组件的各亲和信息对应的出现次数,生成所述组件频繁项集。The component frequent item set is generated according to each of the first components, the number of appearances of each of the first components, and the number of appearances corresponding to each affinity information of each of the first components.
  4. 根据权利要求3所述的基于亲和性调整Docker组件部署的方法,其特征在于,所述亲和信息包括亲和、较亲和、违亲和以及反亲和,所述根据各所述Docker组件间的亲和关系和所述组件频繁项集,调整各所述Docker组件在各主机群上的部署的步骤,包括:The method for adjusting the deployment of Docker components based on affinity according to claim 3, wherein the affinity information includes affinity, relatively affinity, violation of affinity, and anti-affinity, and the Docker The affinity relationship between the components and the frequent item set of the components, and the steps to adjust the deployment of each Docker component on each host group include:
    根据预先设定的优先级,从所述组件频繁项集中筛选出优先级第一的第一组件,并将所述优先级第一的第一组件部署在第一主机群,所述第一主机群为各所述主机群中的任一主机群;According to the preset priority, the first component with the first priority is selected from the frequent item set of the components, and the first component with the first priority is deployed in the first host group. The first host The group is any host group in each of the host groups;
    根据预先设定的优先级,从所述组件频繁项集中筛选出优先级第二的第一组件,并判断所述优先级第二的第一组件和所述优先级第一的第一组件之间的亲和关系是否符合预设条件,以完成预设条件的判断动作,其中,所述预设条件为组件之间的亲和关系为亲和或较亲和;According to the preset priority, filter out the first component with the second priority from the frequent item set of components, and determine whether the first component with the second priority and the first component with the first priority Whether the affinity relationship between the components meets the preset condition to complete the judgment action of the preset condition, wherein the preset condition is that the affinity relationship between the components is affinity or more affinity;
    若符合,则将所述优先级第二的第一组件部署在所述第一主机群;若不符合,则将优先级第二的第一组件部署在第二主机群,以完成部署组件动作,其中,所述第二主机群为各所述主机群中除所述第一主机群之外的任一主机群;If it does, the first component with the second priority is deployed in the first host group; if it does not, the first component with the second priority is deployed in the second host group to complete the component deployment action , Wherein the second host group is any host group in each of the host groups except the first host group;
    依次按照优先级降序从所述组件频繁项集中筛选第一组件,并与当前已部署在主机群的各第一组件逐一执行所述预设条件的判断动作和所述部署组件动作,直至所述组件频繁项集中的所有第一组件均部署完成。The first component is selected from the frequent item set of components in descending order of priority, and the judgment action of the preset condition and the deployment component action are executed one by one with each first component currently deployed in the host group, until the All the first components in the component frequent item set are deployed.
  5. 根据权利要求4所述的基于亲和性调整Docker组件部署的方法,其特征在于,所述将所述优先级第二的第一组件部署在所述第一主机群的步骤,包括:The method for adjusting the deployment of Docker components based on affinity according to claim 4, wherein the step of deploying the first component with the second priority in the first host group comprises:
    判断所述优先级第二的第一组件与所述优先级第一的第一组件之间的亲和关系是否为亲和;Determining whether the affinity relationship between the first component with the second priority and the first component with the first priority is an affinity;
    若是亲和,则将所述优先级第二的第一组件与所述优先级第一的第一组件部署在同一主机;若是较亲和,则将所述优先级第二的第一组件部署在所述第一主机群中的任一主机。If it is affinity, deploy the first component with the second priority and the first component with the first priority on the same host; if it is more affinity, deploy the first component with the second priority Any host in the first host group.
  6. 根据权利要求4所述的基于亲和性调整Docker组件部署的方法,其特征 在于,所述根据预先设定的优先级,从所述组件频繁项集中筛选出优先级第二的第一组件,并判断所述优先级第二的第一组件和所述优先级第一的第一组件之间的亲和关系是否符合预设条件,以完成预设条件的判断动作的步骤中,包括:The method for adjusting the deployment of Docker components based on affinity according to claim 4, wherein the first component with the second priority is selected from the frequent item set of components according to the preset priority, And judging whether the affinity relationship between the first component with the second priority and the first component with the first priority meets a preset condition, and the step of completing the judgment action of the preset condition includes:
    判断当前已部署有第一组件的主机群数量是否不小于2;Determine whether the number of host groups currently deployed with the first component is not less than 2;
    若不小于2,则逐一判断当前次进行部署的第一组件与各所述当前已部署有第一组件的主机群中的各Docker组件之间的亲和关系是否均符合所述预设条件,以完成预设条件的判断动作;If it is not less than 2, then determine one by one whether the affinity relationship between the first component currently deployed and each Docker component in each host group on which the first component is currently deployed meets the preset condition, To complete the judgment action of the preset conditions;
    所述若符合,则将所述优先级第二的第一组件部署在所述第一主机群;若不符合,则将优先级第二的第一组件部署在第二主机群,以完成部署组件动作的步骤中,包括If it matches, deploy the first component with the second priority in the first host group; if it does not match, deploy the first component with the second priority in the second host group to complete the deployment The steps of component actions include
    将所述当前次进行部署的第一组件随机部署在各所述当前已部署有第一组件的主机群中的任意一个。The first component that is currently deployed is randomly deployed on any one of the host groups where the first component is currently deployed.
  7. 根据权利要求1所述的基于亲和性调整Docker组件部署的方法,其特征在于,所述根据预设频率,获取所述预设频率对应的时间段内的各所述Docker组件间的运行信息以及各所述Docker组件分别对应的运行占用信息的步骤之前,包括:The method for adjusting the deployment of Docker components based on affinity according to claim 1, wherein the operation information between the Docker components in a time period corresponding to the preset frequency is obtained according to a preset frequency And before the steps of operating occupancy information corresponding to each of the Docker components, including:
    实时监控API Gateway中调用请求的调用数据,其中,所述调用请求为各所述Docker组件间相互调用时发起的请求,所述调用数据包括请求端组件、目的端组件和调用请求的数量;Real-time monitoring of the call data of the call request in the API Gateway, where the call request is a request initiated when the Docker components call each other, and the call data includes the request-side component, the destination-side component, and the number of call requests;
    根据所述请求端组件和目的端组件生成所述组件与组件间相互对应的调用关系,并根据所述调用请求的数量,更新所述请求端组件和所述目的端组件对应的调用次数;Generating the corresponding invocation relationship between the components and the components according to the request-end component and the destination-end component, and update the number of invocations corresponding to the request-end component and the destination-end component according to the number of invocation requests;
    根据所述组件与组件间相互对应的调用关系和更新后的所述调用次数,生成所述调用关系信息。The invocation relationship information is generated according to the invocation relationship corresponding to each other between the components and the updated invocation times.
  8. 一种基于亲和性调整Docker组件部署的装置,所述Docker组件部署于主机群中,所述主机群为设置在同一地区的所有所述主机形成的集群,其特征在于,所述装置包括:A device for adjusting the deployment of Docker components based on affinity, the Docker components being deployed in a host group, the host group being a cluster formed by all the hosts set up in the same area, characterized in that the device comprises:
    获取模块,用于根据预设频率,获取所述预设频率对应的时间段内的各所述Docker组件间的运行信息以及各所述Docker组件分别对应的运行占用信息,其中,所述运行信息为各所述Docker组件间的调用关系信息和资源共享信息, 所述调用关系信息为组件与组件间相互对应的调用关系和调用次数,所述资源共享信息为组件与组件间在运行时共同调用的资源的对应信息;The obtaining module is configured to obtain the operation information among the Docker components within the time period corresponding to the preset frequency and the operation occupation information corresponding to each of the Docker components according to the preset frequency, wherein the operation information Is the calling relationship information and resource sharing information among the Docker components, the calling relationship information is the calling relationship and the number of calls corresponding to each other between the components, and the resource sharing information is the common calling between the components and the components at runtime The corresponding information of the resource;
    解析模块,用于解析各所述Docker组件间的运行信息和各所述Docker组件的运行占用信息,得到各所述Docker组件间的亲和关系;The parsing module is used to analyze the operation information between the Docker components and the operation occupation information of the Docker components to obtain the affinity relationship between the Docker components;
    第一生成模块,用于调用Apriori算法解析各所述Docker组件间的亲和关系,生成组件频繁项集,其中,所述组件频繁项集为包含各所述Docker组件间的亲和关系的集合;The first generation module is used to call the Apriori algorithm to analyze the affinity relationship between the Docker components, and generate a frequent item set of components, wherein the frequent item set of the component is a set containing the affinity relationship between the Docker components ;
    调整模块,用于根据各所述Docker组件间的亲和关系和所述组件频繁项集,调整各所述Docker组件在各主机群上的部署。The adjustment module is used to adjust the deployment of each Docker component on each host group according to the affinity relationship between each Docker component and the frequent item set of the component.
  9. 根据权利要求8所述的基于亲和性调整Docker组件部署的装置,其特征在于,所述运行占用信息包括CPU占用率和内存占用量,所述解析模块,包括:The device for adjusting the deployment of Docker components based on affinity according to claim 8, wherein the operating occupancy information includes CPU occupancy and memory occupancy, and the analysis module includes:
    计算单元,用于根据各所述Docker组件间的调用次数和所述预设频率对应的时间段,计算得到各Docker组件间的调用频率;The calculation unit is configured to calculate the calling frequency between the Docker components according to the number of calls between the Docker components and the time period corresponding to the preset frequency;
    匹配单元,用于将各所述Docker组件间的调用频率、各所述Docker组件间的资源共享信息和各所述Docker组件的运行占用信息输入预先构建的亲和关系库中,匹配得到各所述Docker组件间的亲和关系,其中,所述亲和关系库中存储有组件间的调用频率、组件间的资源共享信息、组件的运行占用信息与亲和关系映射关系表。The matching unit is used to input the calling frequency between the Docker components, the resource sharing information between the Docker components, and the operation occupation information of the Docker components into the pre-built affinity library, and the matching is used to obtain the The affinity relationship between Docker components is described, wherein the affinity relationship library stores the calling frequency between the components, the resource sharing information between the components, the operation occupation information of the components and the affinity relationship mapping table.
  10. 根据权利要求8所述的基于亲和性调整Docker组件部署的装置,其特征在于,所述Docker组件间的亲和关系包括两个Docker组件对应的亲和信息,所述第一生成模块,包括:The device for adjusting the deployment of Docker components based on affinity according to claim 8, wherein the affinity relationship between the Docker components includes affinity information corresponding to two Docker components, and the first generation module includes :
    筛选单元,用于根据各所述Docker组件间的亲和关系,从各所述Docker组件中筛选得到与其他Docker组件具有确定的亲和关系的各个第一组件;The screening unit is configured to screen each of the Docker components to obtain each first component that has a definite affinity with other Docker components according to the affinity relationship between each of the Docker components;
    第一生成单元,用于根据各所述第一组件以及各所述Docker组件间的亲和关系,生成各所述第一组件间的亲和关系对应的亲和性集;The first generating unit is configured to generate an affinity set corresponding to the affinity relationship between each of the first components according to each of the first components and the affinity relationship between each of the Docker components;
    统计单元,用于根据各所述亲和性集,统计得到各所述第一组件的出现次数以及各所述第一组件对应的各亲和信息对应的出现次数;A statistical unit, configured to calculate the number of appearances of each of the first components and the number of appearances corresponding to each affinity information corresponding to each of the first components according to each of the affinity sets;
    第二生成单元,用于根据各所述第一组件、各所述第一组件的出现次数以及各所述第一组件的各亲和信息对应的出现次数,生成所述组件频繁项集。The second generating unit is configured to generate the component frequent item set according to each of the first components, the number of appearances of each of the first components, and the number of appearances corresponding to each affinity information of each of the first components.
  11. 根据权利要求10所述的基于亲和性调整Docker组件部署的装置,其特 征在于,所述亲和信息包括亲和、较亲和、违亲和以及反亲和,所述调整模块,包括:The device for adjusting the deployment of Docker components based on affinity according to claim 10, wherein the affinity information includes affinity, relative affinity, violation of affinity, and anti-affinity, and the adjustment module includes:
    第一部署单元,用于根据预先设定的优先级,从所述组件频繁项集中筛选出优先级第一的第一组件,并将所述优先级第一的第一组件部署在第一主机群,所述第一主机群为各所述主机群中的任一主机群;The first deployment unit is configured to filter out the first component with the first priority from the component frequent item set according to the preset priority, and deploy the first component with the first priority on the first host Group, the first host group is any host group in each of the host groups;
    判断单元,用于根据预先设定的优先级,从所述组件频繁项集中筛选出优先级第二的第一组件,并判断所述优先级第二的第一组件和所述优先级第一的第一组件之间的亲和关系是否符合预设条件,以完成预设条件的判断动作,其中,所述预设条件为组件之间的亲和关系为亲和或较亲和;The judging unit is configured to filter out the first component with the second priority from the set of frequent component items according to the preset priority, and determine the first component with the second priority and the first component with the first priority Whether the affinity relationship between the first components meets the preset condition, so as to complete the judgment action of the preset condition, where the preset condition is that the affinity relationship between the components is affinity or more affinity;
    第二部署单元,用于将所述优先级第二的第一组件部署在所述第一主机群;或者,用于将优先级第二的第一组件部署在第二主机群,以完成部署组件动作,其中,所述第二主机群为各所述主机群中除所述第一主机群之外的任一主机群;The second deployment unit is configured to deploy the first component with the second priority in the first host group; or, to deploy the first component with the second priority in the second host group to complete the deployment Component action, wherein the second host group is any host group in each of the host groups except the first host group;
    循环单元,用于依次按照优先级降序从所述组件频繁项集中筛选第一组件,并与当前已部署在主机群的各第一组件逐一执行所述预设条件的判断动作和所述部署组件动作,直至所述组件频繁项集中的所有第一组件均部署完成。The circulation unit is used to sequentially filter the first component from the component frequent item set in descending order of priority, and execute the judgment action of the preset condition and the deployment component one by one with each first component currently deployed in the host group Until all the first components in the component frequent item set are deployed.
  12. 根据权利要求11所述的基于亲和性调整Docker组件部署的装置,其特征在于,所述第二部署单元,包括:The device for adjusting deployment of Docker components based on affinity according to claim 11, wherein the second deployment unit comprises:
    第一判断子单元,用于判断所述优先级第二的第一组件与所述优先级第一的第一组件之间的亲和关系是否为亲和;A first judging subunit for judging whether the affinity relationship between the first component with the second priority and the first component with the first priority is an affinity;
    第一部署子单元,用于将所述优先级第二的第一组件与所述优先级第一的第一组件部署在同一主机;A first deployment subunit, configured to deploy the first component with the second priority and the first component with the first priority on the same host;
    第二部署子单元,用于将所述优先级第二的第一组件部署在所述第一主机群中的任一主机。The second deployment subunit is configured to deploy the first component with the second priority on any host in the first host group.
  13. 根据权利要求11所述的基于亲和性调整Docker组件部署的装置,其特征在于,所述判断单元包括:The device for adjusting the deployment of Docker components based on affinity according to claim 11, wherein the determining unit comprises:
    第二判断子单元,用于判断当前已部署有第一组件的主机群数量是否不小于2;The second judgment subunit is used to judge whether the number of host groups currently deployed with the first component is not less than 2;
    第三判断子单元,用于逐一判断当前次进行部署的第一组件与各所述当前已部署有第一组件的主机群中的各Docker组件之间的亲和关系是否均符合所述预设条件,以完成预设条件的判断动作;The third judging subunit is used to judge one by one whether the affinity relationship between the first component currently deployed and each Docker component in each of the host groups on which the first component is currently deployed meets the preset Condition to complete the judgment action of the preset condition;
    所述第二部署单元包括:The second deployment unit includes:
    第三部署子单元,用于将所述当前次进行部署的第一组件随机部署在各所述当前已部署有第一组件的主机群中的任意一个。The third deployment subunit is configured to randomly deploy the first component that is currently deployed to any one of the host groups where the first component is currently deployed.
  14. 根据权利要求8所述的基于亲和性调整Docker组件部署的装置,其特征在于,所述装置还包括:The device for adjusting Docker component deployment based on affinity according to claim 8, wherein the device further comprises:
    监控模块,用于实时监控API Gateway中调用请求的调用数据,其中,所述调用请求为各所述Docker组件间相互调用时发起的请求,所述调用数据包括请求端组件、目的端组件和调用请求的数量;The monitoring module is used to monitor the call data of the call request in the API Gateway in real time, where the call request is a request initiated when the Docker components call each other, and the call data includes the request-side component, the destination-side component, and the call The number of requests;
    第二生成模块,用于根据所述请求端组件和目的端组件生成所述组件与组件间相互对应的调用关系,并根据所述调用请求的数量,更新所述请求端组件和所述目的端组件对应的调用次数;The second generation module is configured to generate the corresponding calling relationship between the components and the components according to the request-side component and the destination-side component, and update the request-side component and the destination-side component according to the number of the call requests The number of calls corresponding to the component;
    第三生成模块,用于根据所述组件与组件间相互对应的调用关系和更新后的所述调用次数,生成所述调用关系信息。The third generation module is configured to generate the calling relationship information according to the calling relationship corresponding to each other between the components and the updated calling times.
  15. 一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机可读指令,其特征在于,所述处理器执行时实现基于亲和性调整Docker组件部署的方法,所述Docker组件部署于主机群中,所述主机群为设置在同一地区的所有所述主机形成的集群,该方法包括:A computer device includes a memory and a processor, and the memory stores computer-readable instructions, wherein the processor implements a method for adjusting the deployment of Docker components based on affinity when executed, and the Docker components are deployed in In a host group, the host group is a cluster formed by all the hosts located in the same area, and the method includes:
    根据预设频率,获取所述预设频率对应的时间段内的各所述Docker组件间的运行信息以及各所述Docker组件分别对应的运行占用信息,其中,所述运行信息为各所述Docker组件间的调用关系信息和资源共享信息,所述调用关系信息为组件与组件间相互对应的调用关系和调用次数,所述资源共享信息为组件与组件间在运行时共同调用的资源的对应信息;According to a preset frequency, the operating information between the Docker components and the operating occupation information corresponding to each of the Docker components in the time period corresponding to the preset frequency are acquired, where the operating information is each Docker The calling relationship information and resource sharing information between components, the calling relationship information is the calling relationship and the number of calls corresponding to each other between the components, and the resource sharing information is the corresponding information of the resources commonly called between the components and the components at runtime ;
    解析各所述Docker组件间的运行信息和各所述Docker组件的运行占用信息,得到各所述Docker组件间的亲和关系;Parse the operating information between the Docker components and the operating occupation information of each Docker component to obtain the affinity relationship between the Docker components;
    调用Apriori算法解析各所述Docker组件间的亲和关系,生成组件频繁项集,其中,所述组件频繁项集为包含各所述Docker组件间的亲和关系的集合;Invoke the Apriori algorithm to analyze the affinity relationship between the Docker components, and generate a frequent item set of components, where the frequent item set of the component is a set containing the affinity relationship between the Docker components;
    根据各所述Docker组件间的亲和关系和所述组件频繁项集,调整各所述Docker组件在各主机群上的部署。Adjust the deployment of each Docker component on each host group according to the affinity relationship between the Docker components and the frequent item set of the components.
  16. 根据权利要求15所述的计算机设备,其特征在于,所述运行占用信息包括CPU占用率和内存占用量,所述解析各所述Docker组件间的运行信息 和各所述Docker组件的运行占用信息;所述处理器执行所述解析各所述Docker组件间的运行信息和各所述Docker组件的运行占用信息,得到各所述Docker组件间的亲和关系的步骤,包括:The computer device according to claim 15, wherein the operating occupation information includes a CPU occupancy rate and a memory occupancy, and the analyzing the operating information among the Docker components and the operating occupation information of the Docker components The processor executes the step of parsing the operation information between the Docker components and the operation occupation information of each Docker component to obtain the affinity relationship between the Docker components, including:
    根据各所述Docker组件间的调用次数和所述预设频率对应的时间段,计算得到各Docker组件间的调用频率;According to the number of calls between the Docker components and the time period corresponding to the preset frequency, the call frequency between the Docker components is calculated;
    将各所述Docker组件间的调用频率、各所述Docker组件间的资源共享信息和各所述Docker组件的运行占用信息输入预先构建的亲和关系库中,匹配得到各所述Docker组件间的亲和关系,其中,所述亲和关系库中存储有组件间的调用频率、组件间的资源共享信息、组件的运行占用信息与亲和关系映射关系表。Input the calling frequency between the Docker components, the resource sharing information between the Docker components, and the operation occupation information of the Docker components into the pre-built affinity library, and match to obtain the information between the Docker components. Affinity relationship, wherein the affinity relationship library stores a calling frequency between components, resource sharing information between components, operation occupation information of components, and an affinity relationship mapping relationship table.
  17. 根据权利要求15所述的计算机设备,其特征在于,所述Docker组件间的亲和关系包括两个Docker组件对应的亲和信息;所述处理器执行所述调用Apriori算法解析各所述Docker组件间的亲和关系,生成组件频繁项集的步骤,包括:The computer device according to claim 15, wherein the affinity relationship between the Docker components includes affinity information corresponding to two Docker components; and the processor executes the calling Apriori algorithm to analyze each of the Docker components The affinity relationship between the components, the steps to generate frequent itemsets of components, including:
    根据各所述Docker组件间的亲和关系,从各所述Docker组件中筛选得到与其他Docker组件具有确定的亲和关系的各个第一组件;According to the affinity relationship between each of the Docker components, filter each of the Docker components to obtain each first component that has a certain affinity with other Docker components;
    根据各所述第一组件以及各所述Docker组件间的亲和关系,生成各所述第一组件间的亲和关系对应的亲和性集;Generating an affinity set corresponding to the affinity relationship between each of the first components according to each of the first components and the affinity relationship between each of the Docker components;
    根据各所述亲和性集,统计得到各所述第一组件的出现次数以及各所述第一组件对应的各亲和信息对应的出现次数;According to each of the affinity sets, the number of appearances of each of the first components and the number of appearances of each affinity information corresponding to each of the first components are obtained by statistics;
    根据各所述第一组件、各所述第一组件的出现次数以及各所述第一组件的各亲和信息对应的出现次数,生成所述组件频繁项集。The component frequent item set is generated according to each of the first components, the number of appearances of each of the first components, and the number of appearances corresponding to each affinity information of each of the first components.
  18. 一种计算机可读存储介质,其上存储有计算机可读指令,其特征在于,所述计算机可读指令被处理器执行时实现基于亲和性调整Docker组件部署的方法,所述Docker组件部署于主机群中,所述主机群为设置在同一地区的所有所述主机形成的集群,其特征在于,所述方法包括:A computer-readable storage medium having computer-readable instructions stored thereon, wherein the computer-readable instructions are executed by a processor to implement a method for adjusting the deployment of Docker components based on affinity, and the Docker components are deployed in In a host group, the host group is a cluster formed by all the hosts located in the same area, and is characterized in that the method includes:
    根据预设频率,获取所述预设频率对应的时间段内的各所述Docker组件间的运行信息以及各所述Docker组件分别对应的运行占用信息,其中,所述运行信息为各所述Docker组件间的调用关系信息和资源共享信息,所述调用关系信息为组件与组件间相互对应的调用关系和调用次数,所述资源共享信息为组件与组件间在运行时共同调用的资源的对应信息;According to a preset frequency, the operating information between the Docker components and the operating occupation information corresponding to each of the Docker components in the time period corresponding to the preset frequency are acquired, where the operating information is each Docker The calling relationship information and resource sharing information between components, the calling relationship information is the calling relationship and the number of calls corresponding to each other between the components, and the resource sharing information is the corresponding information of the resources commonly called between the components and the components at runtime ;
    解析各所述Docker组件间的运行信息和各所述Docker组件的运行占用信息,得到各所述Docker组件间的亲和关系;Parse the operating information between the Docker components and the operating occupation information of each Docker component to obtain the affinity relationship between the Docker components;
    调用Apriori算法解析各所述Docker组件间的亲和关系,生成组件频繁项集,其中,所述组件频繁项集为包含各所述Docker组件间的亲和关系的集合;Invoke the Apriori algorithm to analyze the affinity relationship between the Docker components, and generate a frequent item set of components, where the frequent item set of the component is a set containing the affinity relationship between the Docker components;
    根据各所述Docker组件间的亲和关系和所述组件频繁项集,调整各所述Docker组件在各主机群上的部署。Adjust the deployment of each Docker component on each host group according to the affinity relationship between the Docker components and the frequent item set of the components.
  19. 根据权利要求18所述的计算机可读存储介质,其特征在于,所述运行占用信息包括CPU占用率和内存占用量;所述处理器执行所述解析各所述Docker组件间的运行信息和各所述Docker组件的运行占用信息,得到各所述Docker组件间的亲和关系的步骤,包括:The computer-readable storage medium according to claim 18, wherein the operating occupancy information includes a CPU occupancy rate and a memory occupancy; the processor executes the parsing of the operating information among the Docker components and each The steps of obtaining the affinity relationship between the Docker components by the operation occupation information of the Docker components include:
    根据各所述Docker组件间的调用次数和所述预设频率对应的时间段,计算得到各Docker组件间的调用频率;According to the number of calls between the Docker components and the time period corresponding to the preset frequency, the call frequency between the Docker components is calculated;
    将各所述Docker组件间的调用频率、各所述Docker组件间的资源共享信息和各所述Docker组件的运行占用信息输入预先构建的亲和关系库中,匹配得到各所述Docker组件间的亲和关系,其中,所述亲和关系库中存储有组件间的调用频率、组件间的资源共享信息、组件的运行占用信息与亲和关系映射关系表。Input the calling frequency between the Docker components, the resource sharing information between the Docker components, and the operation occupation information of the Docker components into the pre-built affinity library, and match to obtain the information between the Docker components. Affinity relationship, wherein the affinity relationship library stores a calling frequency between components, resource sharing information between components, operation occupation information of components, and an affinity relationship mapping relationship table.
  20. 根据权利要求18所述的计算机可读存储介质,其特征在于,所述Docker组件间的亲和关系包括两个Docker组件对应的亲和信息,所述处理器执行所述调用Apriori算法解析各所述Docker组件间的亲和关系,生成组件频繁项集的步骤,包括:The computer-readable storage medium according to claim 18, wherein the affinity relationship between the Docker components includes the affinity information corresponding to the two Docker components, and the processor executes the calling Apriori algorithm to analyze each Describe the affinity between Docker components and the steps to generate frequent itemsets of components, including:
    根据各所述Docker组件间的亲和关系,从各所述Docker组件中筛选得到与其他Docker组件具有确定的亲和关系的各个第一组件;According to the affinity relationship between each of the Docker components, filter each of the Docker components to obtain each first component that has a certain affinity with other Docker components;
    根据各所述第一组件以及各所述Docker组件间的亲和关系,生成各所述第一组件间的亲和关系对应的亲和性集;Generating an affinity set corresponding to the affinity relationship between each of the first components according to each of the first components and the affinity relationship between each of the Docker components;
    根据各所述亲和性集,统计得到各所述第一组件的出现次数以及各所述第一组件对应的各亲和信息对应的出现次数;According to each of the affinity sets, the number of appearances of each of the first components and the number of appearances of each affinity information corresponding to each of the first components are obtained by statistics;
    根据各所述第一组件、各所述第一组件的出现次数以及各所述第一组件的各亲和信息对应的出现次数,生成所述组件频繁项集。The component frequent item set is generated according to each of the first components, the number of appearances of each of the first components, and the number of appearances corresponding to each affinity information of each of the first components.
PCT/CN2019/116704 2019-02-11 2019-11-08 Method and related device for adjusting deployment of docker component on basis of affinity WO2020164265A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910110281.9A CN109933406B (en) 2019-02-11 2019-02-11 Method for adjusting Docker component deployment based on affinity and related equipment
CN201910110281.9 2019-02-11

Publications (1)

Publication Number Publication Date
WO2020164265A1 true WO2020164265A1 (en) 2020-08-20

Family

ID=66985506

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/116704 WO2020164265A1 (en) 2019-02-11 2019-11-08 Method and related device for adjusting deployment of docker component on basis of affinity

Country Status (2)

Country Link
CN (1) CN109933406B (en)
WO (1) WO2020164265A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109933406B (en) * 2019-02-11 2021-07-16 平安科技(深圳)有限公司 Method for adjusting Docker component deployment based on affinity and related equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170308822A1 (en) * 2016-04-25 2017-10-26 Fair Isaac Corporation Self-contained decision logic
CN108234437A (en) * 2016-12-22 2018-06-29 航天信息股份有限公司 A kind of method and system based on the deployment OpenStack services of Docker technologies
CN109271171A (en) * 2018-09-17 2019-01-25 杭州安恒信息技术股份有限公司 A kind of method and apparatus based on mono- key of Docker deployment big data platform
CN109933406A (en) * 2019-02-11 2019-06-25 平安科技(深圳)有限公司 Method and relevant device based on compatibility adjustment Docker deployment of components

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060179116A1 (en) * 2003-10-10 2006-08-10 Speeter Thomas H Configuration management system and method of discovering configuration data
CN102360308B (en) * 2011-09-29 2013-06-12 用友软件股份有限公司 Distributed deployment system and method of components
CN104967661B (en) * 2015-05-12 2018-04-20 华南师范大学 Deployment of components method and apparatus applied to application system mixed deployment under cloud environment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170308822A1 (en) * 2016-04-25 2017-10-26 Fair Isaac Corporation Self-contained decision logic
CN108234437A (en) * 2016-12-22 2018-06-29 航天信息股份有限公司 A kind of method and system based on the deployment OpenStack services of Docker technologies
CN109271171A (en) * 2018-09-17 2019-01-25 杭州安恒信息技术股份有限公司 A kind of method and apparatus based on mono- key of Docker deployment big data platform
CN109933406A (en) * 2019-02-11 2019-06-25 平安科技(深圳)有限公司 Method and relevant device based on compatibility adjustment Docker deployment of components

Also Published As

Publication number Publication date
CN109933406A (en) 2019-06-25
CN109933406B (en) 2021-07-16

Similar Documents

Publication Publication Date Title
US11115466B2 (en) Distributed network services
US10812409B2 (en) Network multi-tenancy for cloud based enterprise resource planning solutions
US10498845B1 (en) Using agents in a data center to monitor network connections
CN108156236B (en) Service request processing method and device, computer equipment and storage medium
US10365915B2 (en) Systems and methods of monitoring a network topology
US8103769B1 (en) Dynamic isolation of shared resources
US9300523B2 (en) System and method for performance management in a multi-tier computing environment
US20160378641A1 (en) Methods and systems for internally debugging code in an on-demand service environment
US8683041B2 (en) Service level management system
EP1654648B1 (en) Hierarchical management of the dynamic allocation of resources in a multi-node system
US20070208852A1 (en) Network sniffer for performing service level management
CN105933408B (en) A kind of implementation method and device of Redis universal middleware
US10277529B2 (en) Visualization of computer resource quotas
CN111258627B (en) Interface document generation method and device
US20120117242A1 (en) Service linkage system and information processing system
CN106850549B (en) Distributed encryption service gateway and implementation method
US10999168B1 (en) User defined custom metrics
US11962599B2 (en) Techniques for automatically configuring minimal cloud service access rights for container applications
US20170272541A1 (en) Local enforcement of computer resource quotas
CN106375102B (en) A kind of service registration method, application method and relevant apparatus
CN112698952A (en) Unified management method and device for computing resources, computer equipment and storage medium
US20220182851A1 (en) Communication Method and Apparatus for Plurality of Administrative Domains
WO2020164265A1 (en) Method and related device for adjusting deployment of docker component on basis of affinity
CN110324262A (en) A kind of method and device that resource is seized
KR20090104085A (en) Method and system for a context manager for a converged services framework

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

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

Country of ref document: EP

Kind code of ref document: A1