CN111880898A - Service scheduling method based on micro-service architecture and implementation system thereof - Google Patents

Service scheduling method based on micro-service architecture and implementation system thereof Download PDF

Info

Publication number
CN111880898A
CN111880898A CN202010731894.7A CN202010731894A CN111880898A CN 111880898 A CN111880898 A CN 111880898A CN 202010731894 A CN202010731894 A CN 202010731894A CN 111880898 A CN111880898 A CN 111880898A
Authority
CN
China
Prior art keywords
sub
service
services
scheduling
host
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010731894.7A
Other languages
Chinese (zh)
Other versions
CN111880898B (en
Inventor
张虎
厉承轩
郭莹
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shandong Ruichuang Education Technology Co.,Ltd.
Original Assignee
Shandong Computer Science Center National Super Computing Center in Jinan
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 Shandong Computer Science Center National Super Computing Center in Jinan filed Critical Shandong Computer Science Center National Super Computing Center in Jinan
Priority to CN202010731894.7A priority Critical patent/CN111880898B/en
Publication of CN111880898A publication Critical patent/CN111880898A/en
Application granted granted Critical
Publication of CN111880898B publication Critical patent/CN111880898B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects

Abstract

The invention relates to a service scheduling method based on a micro-service architecture and an implementation system thereof, wherein the method comprises the following steps: (1) first-stage scheduling: scheduling the sub-services with calling relations among different copies to the same host according to the resource conditions of a plurality of hosts and the basic information of the service application to be scheduled; (2) and (3) second-level scheduling: in the running process of the business application, the calling relation among the sub-services is counted, the sub-services meeting the conditions are periodically checked and migrated according to the calling relation coefficient, and the sub-services frequently called are migrated to the same host machine. The invention ensures that the sub-services of the business application service are dispatched to the proper host machine after two-stage dispatching, and finally, the sub-services with calling relation are dispatched to the same host machine as much as possible on the premise of meeting the high availability of the business application service, thereby reducing the time delay caused by cross-server and cross-region calling and improving the calling performance among the sub-services.

Description

Service scheduling method based on micro-service architecture and implementation system thereof
Technical Field
The present invention relates to a service scheduling method for a micro-service architecture and an implementation system thereof, and more particularly, to a scheduling method for improving multi-service cooperative work performance on the premise of satisfying high availability of services under a micro-service architecture and an implementation system thereof.
Background
With the continuous maturity of container virtualization technologies represented by Docker and the rise of DevOps culture, the concept of micro services is continuously and deeply integrated and widely applied to various fields. The architecture of the microservice enables decoupling of functionality and solutions by splitting a traditional monolithic application service into a set of sub-services. Each sub-service can be deployed independently and in multiple copies, occupying a single process and performing only one specific business function. By carrying out micro-service processing on the single application service, the fault tolerance of the whole service can be improved, the utilization rate of resources is improved, and the efficiency of development, test, deployment and upgrading of the service is improved. However, because each service is split into a plurality of sub-services under the micro-service architecture, in a complex multi-service cooperative work scenario, how to effectively schedule the sub-services to different resources for operation, and ensuring high availability of the whole service and high performance of cooperative work between services is a very big challenge for micro-service development.
At present, high availability of services is realized under a micro-service framework, and multiple copies of sub-services are mainly deployed, and each copy of the sub-service is scheduled to a different server, so that the high availability of the whole service is ensured; the high performance of the service is realized under the micro-service architecture, and usually, a load balancing or API gateway is set for the sub-services, so that the response speed of the request is improved by shunting different requests to different sub-services. Under the condition that only one single application service exists, the method can better realize high availability and high performance of the service. However, in a complex scenario of multi-service mutual invocation and cooperative work, if different sub-services of each service are simply scheduled to different servers, and a layer of load balancing or API gateway is added to each sub-service, not only is the time and resource overhead of load balancing and API gateway forwarding increased, but also the sub-services between different services are invoked across servers and even across data centers during the mutual invocation process, which may reduce the cooperative work performance between the sub-services, thereby reducing the performance of the whole service application.
As can be seen from the above summary of the existing micro-service scheduling methods, the existing service scheduling methods basically consider the high availability of the self-service and the high performance of the service separately, and cannot effectively consider the high availability of the sub-service and the high performance of the whole service application.
Disclosure of Invention
In order to overcome the defects of the technical problems, the invention provides a scheduling method which gives consideration to high service availability and multi-service cooperative performance under a micro-service architecture.
The invention also provides a system for realizing the scheduling method.
The technical scheme of the invention is as follows:
a service scheduling method based on micro-service architecture, the physical resource environment realized by the method comprises a plurality of host machines, the service application to be scheduled comprises a plurality of copies to be scheduled, each copy comprises a plurality of services, and each service comprises a plurality of sub-services; the method comprises the following steps:
(1) first-stage scheduling: scheduling the sub-services with calling relations among different copies to the same host according to the resource conditions of a plurality of hosts and the basic information of the service application to be scheduled; and the high availability is ensured, and meanwhile, the calling performance between the sub-services is ensured.
(2) And (3) second-level scheduling: in the running process of the business application, the calling relation among the sub-services is counted, the sub-services meeting the conditions are periodically checked and migrated according to the calling relation coefficient, and the sub-services frequently called are migrated to the same host machine.
The invention ensures that the sub-services of the business application service are dispatched to the proper host machine after two-stage dispatching, and finally, the sub-services with calling relation are dispatched to the same host machine as much as possible on the premise of meeting the high availability of the business application service, thereby reducing the time delay caused by cross-server and cross-region calling and improving the calling performance among the sub-services.
According to the optimization of the invention, before the step (1) is executed, host machine information and service information of the business application are initialized;
initializing host information including a host set PH and a resource amount set R that each host can provide, PH ═ PH1,PH2,PH3,...,PHm...,PHMTotal M host machines, PHmRefers to the mth host machine; r denotes the number of quantifiable standard resources that a host can provide, R ═ { R ═ R1,R2,R3,...,Rm...,RM},RmMeans the amount of resources that the mth host can provide;
initializing service information of the business application, wherein the service information comprises the copy number N of the business application to be scheduled, a service set S included by the business application to be scheduled, and a sub-service set S included by each serviceiA set of call relations CI between the sub-services, and a standard amount of virtual resources CR that each sub-service needs to reserveijThe relation coefficient C between the sub-servicesij,klA timing scheduling period AT and a sub-service scheduling state matrix SL; s ═ S1,S2,S3,...,Si...,SIH, total I services, SiRepresents the ith service; si={SSi1,SSi2,SSi3,...,SSij...,SSiJEach service contains J sub-services, SSijRepresents a jth sub-service included in the ith service; CI { (SS)ij,SSkl),...|i,j,k,l=1,2,...,m},(SSij,SSkl) The jth sub-service representing the ith service calls the ith sub-service of the kth service, and the CI is sorted according to the length descending order of the calling relationship; CRijRepresenting a virtual resource abstraction value required by a jth sub-service of the ith service; relation coefficient C between sub-servicesij,klRepresenting the frequency of the j sub-service in the i service calling the l sub-service in the k service; the more frequent the calls, the larger the value; relation coefficient C between sub-servicesij,klAre all initialized to 0; the scheduling system can count the times of calling among the sub-services in the timing scheduling period AT, and trigger automatic scheduling when the period is over, and transfer the sub-services which are called more frequently to the same host machine; the sub-service scheduling state matrix SL is implemented using a nested list for finding the scheduling state, SSI, of the sub-serviceijkRefers to the kth sub-service scheduling state in the jth service of the ith copyThe degree status includes whether the host is scheduled or not and the host to which the scheduling is performed.
Preferably, in the step (1), the sub-services having a call relationship between different copies are dispatched to the same host according to the resource conditions of a plurality of hosts and the basic information of the service application to be dispatched, and the method includes the following steps:
step a: judging whether the total amount of resources which can be provided by all the host machines can bear the business application services of all the copies, if not, scheduling fails, and ending; otherwise, starting scheduling and entering the step b;
step b: traversing the host machine, judging whether a single host machine can bear all sub-services under the business application service of a single copy, and if the single host machine can not bear the sub-services, switching to the next host machine; if the service can be borne, scheduling a copy of the service application service to the host machine, and updating the host machine information and the service information of the service application until the host machine is traversed;
step c: according to the resource amount which can be provided by the host machine, the host machine is sorted in a descending order again;
step d: sequentially traversing a call relation set (CI) among the sub-services under the unscheduled copy, scheduling the sub-services with the call relation to the same host with sufficient resources, and updating the information of the host and the service information of the service application;
step e: traversing a sub-service scheduling state matrix (SL), searching unscheduled sub-services, scheduling the unscheduled sub-services to a host machine which is the same as other sub-services under a copy of the unscheduled sub-services, and updating host machine information and service information of service application;
step f: and confirming that all the sub-services are scheduled to be completed, and finishing the first-level scheduling.
More preferably, step a means: judging the total amount of resources T which can be provided by all host machinesPHBusiness application service T capable of bearing all copiesS
Figure BDA0002603475030000031
If T isPH<TSIf the load cannot be carried, the scheduling fails, and the process is finished; otherwise, starting scheduling and entering the step b.
Through the first-level scheduling, the following effects can be achieved: first, a single copy of the application traffic service is dispatched in its entirety to a host capable of carrying it. Therefore, the sub-services under one copy are in the same host machine when being called mutually, and the calling performance of the sub-services is improved; meanwhile, different copies are in different host machines, so that the high availability of the whole business application is ensured. And secondly, dispatching the sub-services with the calling relation in the rest copies to the same host, wherein the sub-services without the calling relation need to be selected and dispatched to the same host or other hosts according to the current resources of the hosts. Therefore, the method can meet the condition that the sub-services with the calling relation are dispatched to the same host machine under the condition of the same copy as much as possible, and improve the performance of sub-service calling under the condition of high availability.
Preferably, in step (2), in the running process of the service application, the call relationship between the sub-services is counted, the sub-services meeting the condition are periodically checked and migrated according to the call relationship coefficient, and the sub-services frequently invoked are migrated to the same host, where the call relationship is: generating a sub-service calling relation coefficient list C according to the number of times of calling between the sub-services counted in the timing scheduling period ATsortAnd dispatching the sub-service with larger sub-service calling relation coefficient under the same copy to the same host.
Further preferably, the sub-service invocation relation coefficient list C is generated according to the invocation times between the sub-services counted in the timing scheduling period ATsortThe method comprises the following steps: assuming that in a timing scheduling period AT, CI is arranged in descending order according to the calling times among the sub-services, and the ordered list is CIsortAfter sorting, calculating the relation coefficient between the sub-services: suppose that F is invoked within one cycle of group 1 sub-service relationships1Secondly, the 1 st group of sub-service call relation coefficient is 1; group 2 calls F in one cycle2Then, the 2 nd group sub-service call relation coefficient is F2/F1(ii) a Group n in one weekWithin period call FnThen, the nth group of sub-service call relation coefficient is Fn/F1Sequentially calculating to obtain a sorted sub-service call relation coefficient list as Csort
Further preferably, the specific implementation steps are as follows:
step A: when a periodic scheduling time node is reached, starting periodic scheduling to obtain a sub-service call relation coefficient list counted in the previous period;
and B: sequentially traversing sub-service call relation coefficient lists under all the copy lists of the service application;
and C: judging whether the sub-service calling relation coefficient is larger than the sub-service calling relation coefficient average value or not, and switching to the next pair of sub-service calling relations if the current relation coefficient is smaller than the relation coefficient average value; if the current relation coefficient is larger than the average value of the relation coefficients, starting the migration of the sub-services in the calling relation, and updating the host information and the service information of the service application;
step D: judging whether two sub-services in the calling relationship are in the same host machine or not, and if so, switching to the next pair of calling relationships; if the sub-services are located in different hosts, the sub-services occupying less resources are migrated to the host where the sub-services occupying more resources are located, and host information and service information of the service application are updated;
step E: and confirming that all calling relations have been traversed, and finishing the second-stage scheduling.
And scheduling the sub-services frequently called among the sub-services to the same host machine through the second-level periodic scheduling, so that the high performance of communication among the sub-services frequently called can be ensured as much as possible.
The system for realizing the scheduling method comprises an initialization module, a first scheduling module and a second scheduling module which are connected in sequence;
the initialization module is configured to: initializing host machine information and service information of business application; the first scheduling module is to: scheduling the sub-services with calling relations among different copies to the same host according to the resource conditions of a plurality of hosts and the basic information of the service application to be scheduled; the second scheduling module is to: in the running process of the business application, the calling relation among the sub-services is counted, the sub-services meeting the conditions are periodically checked and migrated according to the calling relation coefficient, and the sub-services frequently called are migrated to the same host machine.
The invention has the beneficial effects that:
1. the invention integrally dispatches the application service of a single copy to the host machine capable of bearing. Therefore, the sub-services under one copy are in the same host machine when being called mutually, and the calling performance of the sub-services is improved; meanwhile, different copies are in different host machines, so that the high availability of the whole business application is ensured. The invention also dispatches the sub-services with the calling relation in the rest copies to the same host, and the sub-services without the calling relation need to be selectively dispatched to the same host or other hosts according to the current resources of the hosts. Therefore, the method can meet the condition that the sub-services with the calling relation are dispatched to the same host machine under the condition of the same copy as much as possible, and improve the performance of sub-service calling under the condition of high availability.
2. The invention can transfer the sub-services with frequent intermodulation to the same host machine by periodically executing the second-stage scheduling method. The calling performance between the sub-services calling frequently mutually is preferentially ensured.
Drawings
FIG. 1 is a block diagram of an implementation of a micro-service architecture based service scheduling method according to the present invention;
FIG. 2 is a schematic flow chart of a first-level scheduling in the micro-service architecture based service scheduling method according to the present invention;
FIG. 3 is a schematic flow chart of the second-level scheduling in the method for scheduling services based on the micro-service architecture according to the present invention;
FIG. 4 is a diagram illustrating the distribution of sub-services on a host after a first level of scheduling adjustment according to the present invention;
FIG. 5 is a diagram illustrating the distribution of sub-services on a host after a second level of scheduling adjustment according to the present invention;
FIG. 6 is a diagram illustrating the distribution of sub-services on a host after being scheduled by a conventional scheduling method;
fig. 7 is a block diagram of a system for implementing the service scheduling method according to the present invention.
Detailed Description
The invention is further defined in the following, but not limited to, the figures and examples in the description.
Example 1
A service scheduling method based on micro-service architecture, the physical resource environment realized by the method comprises a plurality of host machines, the service application to be scheduled comprises a plurality of copies to be scheduled, each copy comprises a plurality of services, and each service comprises a plurality of sub-services; specifically, as shown in fig. 1, the physical resource environment includes M hosts, and resources that can be provided by each host are different, where gray represents resources that have been used, and white represents resources that can be provided. The business application to be scheduled comprises N service copies to be scheduled, each copy comprises the same service and sub-services, and the sub-services have calling relations.
The method comprises the following steps:
(1) first-stage scheduling: scheduling the sub-services with calling relations among different copies to the same host according to the resource conditions of a plurality of hosts and the basic information of the service application to be scheduled; and the high availability is ensured, and meanwhile, the calling performance between the sub-services is ensured.
(2) And (3) second-level scheduling: in the running process of the business application, the calling relation among the sub-services is counted, the sub-services meeting the conditions are periodically checked and migrated according to the calling relation coefficient, and the sub-services frequently called are migrated to the same host machine.
The invention ensures that the sub-services of the business application service are dispatched to the proper host machine after two-stage dispatching, and finally, the sub-services with calling relation are dispatched to the same host machine as much as possible on the premise of meeting the high availability of the business application service, thereby reducing the time delay caused by cross-server and cross-region calling and improving the calling performance among the sub-services.
Example 2
The method for scheduling services based on micro-service architecture according to embodiment 1 is characterized in that:
initializing host machine information and service information of business application before executing the step (1);
initializing host information including a host set PH and a resource amount set R that each host can provide, PH ═ PH1,PH2,PH3,...,PHm...,PHMTotal M host machines, PHmRefers to the mth host machine; r denotes the number of quantifiable standard resources that a host can provide, R ═ { R ═ R1,R2,R3,...,Rm...,RM},RmMeans the amount of resources that the mth host can provide;
initializing service information of the business application, wherein the service information comprises the copy number N of the business application to be scheduled, a service set S included by the business application to be scheduled, and a sub-service set S included by each serviceiA set of call relations CI between the sub-services, and a standard amount of virtual resources CR that each sub-service needs to reserveijThe relation coefficient C between the sub-servicesij,klA timing scheduling period AT and a sub-service scheduling state matrix SL; s ═ S1,S2,S3,...,Si...,SIH, total I services, SiRepresents the ith service; si={SSi1,SSi2,SSi3,...,SSij...,SSiJEach service contains J sub-services, SSijRepresents a jth sub-service included in the ith service; CI { (SS)ij,SSkl),...|i,j,k,l=1,2,...,m},(SSij,SSkl) The jth sub-service representing the ith service calls the ith sub-service of the kth service, and the CI is sorted according to the length descending order of the calling relationship; CRijRepresenting a virtual resource abstraction value required by a jth sub-service of the ith service; relation coefficient C between sub-servicesij,klIndicating the jth sub-service call in the ith serviceFrequency of the l sub-service in the k service; the more frequent the calls, the larger the value; relation coefficient C between sub-servicesij,klAre all initialized to 0; the scheduling system can count the times of calling among the sub-services in the timing scheduling period AT, and trigger automatic scheduling when the period is over, and transfer the sub-services which are called more frequently to the same host machine; the sub-service scheduling state matrix SL is implemented using a nested list for finding the scheduling state, SSI, of the sub-serviceijkThe scheduling state of the kth sub-service in the jth service of the ith copy comprises whether the host is scheduled or not and the host is scheduled.
Example 3
The method for scheduling services based on the micro-service architecture according to embodiment 2 is characterized in that:
in step (1), according to the resource condition of a plurality of hosts and the basic information of the service application to be scheduled, the sub-services having a calling relationship between different copies are scheduled to the same host, as shown in fig. 2, the scheduler completes the scheduling process of the service application service according to the information of the resources that the hosts can provide, the calling relationship of each sub-service in the service application service, the resources occupied by each sub-service, and the like, and includes the following steps:
step a: judging whether the total amount of resources which can be provided by all the host machines can bear the business application services of all the copies, if not, scheduling fails, and ending; otherwise, starting scheduling and entering the step b;
step b: traversing the host machine, judging whether a single host machine can bear all sub-services under the business application service of a single copy, and if the single host machine can not bear the sub-services, switching to the next host machine; if the service can be borne, scheduling a copy of the service application service to the host machine, and updating the host machine information and the service information of the service application until the host machine is traversed;
step c: according to the resource amount which can be provided by the host machine, the host machine is sorted in a descending order again;
step d: sequentially traversing a call relation set (CI) among the sub-services under the unscheduled copy, scheduling the sub-services with the call relation to the same host with sufficient resources, and updating the information of the host and the service information of the service application;
step e: traversing a sub-service scheduling state matrix (SL), searching unscheduled sub-services, scheduling the unscheduled sub-services to a host machine which is the same as other sub-services under a copy of the unscheduled sub-services, and updating host machine information and service information of service application;
step f: and confirming that all the sub-services are scheduled to be completed, and finishing the first-level scheduling.
In the step a, the following steps are included: judging the total amount of resources T which can be provided by all host machinesPHBusiness application service T capable of bearing all copiesS
Figure BDA0002603475030000071
If T isPH<TSIf the load cannot be carried, the scheduling fails, and the process is finished; otherwise, starting scheduling and entering the step b.
As can be seen from fig. 2 and the description of the steps, the first-stage scheduling mainly completes three main tasks, namely, integrally scheduling the business application service copies to the hosts capable of bearing; scheduling the sub-services with scheduling relation in the same copy to the same host as much as possible; and scheduling other residual sub-services in the copy to the same host machine as other sub-services under the copy as much as possible. After the first-level scheduling, the business application service copies can be distributed to different host machines in a scattered manner, so that the high availability of the business application is ensured, and the calling performance among the sub-services is improved.
The first-stage scheduling method specifically comprises the following steps:
Figure BDA0002603475030000072
Figure BDA0002603475030000081
Figure BDA0002603475030000091
Figure BDA0002603475030000101
note: (1) the function update () function is to update the sub-service scheduling state matrix;
(2) the function length () functions to calculate the length of the list;
(3) the function count () function is to calculate the amount of resources occupied by the sub-service;
in the above scheme, the host provides the total amount of resources TPHRepresenting the total amount of resources that all hosts can provide. Total amount of resources occupied by business application service TSRepresenting the total amount of resources occupied by the single-copy business application service.
Through the first-level scheduling, the following effects can be achieved: first, a single copy of the application traffic service is dispatched in its entirety to a host capable of carrying it. Therefore, the sub-services under one copy are in the same host machine when being called mutually, and the calling performance of the sub-services is improved; meanwhile, different copies are in different host machines, so that the high availability of the whole business application is ensured. And secondly, dispatching the sub-services with the calling relation in the rest copies to the same host, wherein the sub-services without the calling relation need to be selected and dispatched to the same host or other hosts according to the current resources of the hosts. Therefore, the method can meet the condition that the sub-services with the calling relation are dispatched to the same host machine under the condition of the same copy as much as possible, and improve the performance of sub-service calling under the condition of high availability.
The distribution of the sub-services on the hosts after the first-level scheduling adjustment is shown in fig. 4, where fig. 4 shows an example in which 4 copies exist below one business application, and the 4 copies are scheduled to 5 hosts. As can be seen in fig. 4, after performing the first-level scheduling on the sub-services in the 4 copies of the business application service, the first two copies are separately scheduled to the host 1 and the host 2; the third copy is dispatched to hosts 3 and 4, respectively; the first three sub-services of the first service of the fourth copy are dispatched to the host 4; the other sub-services of the fourth copy are dispatched to host 5. After the first-level scheduling, the sub-services with the calling relationship can be scheduled to the same host as much as possible under the condition that the business application service is guaranteed to be highly available.
The distribution of the sub-services on the host after the scheduling by the conventional scheduling method is shown in fig. 6, and fig. 6 also shows that four copies exist below one business application, and the access to each sub-service is distributed by using load balancing. Meanwhile, in order to ensure high availability of the whole business application, the sub-services of different copies need to be dispatched to different host machines. To better illustrate the problem, all load balancing is dispatched to host 1, and the sub-services of four different copies are respectively dispatched to the other four hosts. As can be seen from fig. 6, the invocation between the sub-services not only increases the flow of load balancing forwarding, but also requests the sub-services across the hosts when the load balancing distributes the requests, which is equivalent to a request for performing services across the virtual network. Therefore, the traditional sub-service scheduling method can slow down the calling performance of the whole service application. By scheduling the sub-service of the business application by the scheduling method, the sub-service calling performance of the business application is expected to be improved by more than 10 percent compared with the traditional scheduling method.
Example 4
The method for scheduling services based on micro-service architecture according to embodiment 3 is characterized in that:
in the step (2), in the service application running process, counting the call relationship among the sub-services, periodically checking and migrating the sub-services meeting the conditions according to the call relationship coefficients, and migrating the frequently-called sub-services to the same host, where the step is as follows: generating a sub-service calling relation coefficient list C according to the number of times of calling between the sub-services counted in the timing scheduling period ATsortAnd dispatching the sub-service with larger sub-service calling relation coefficient under the same copy to the same host.
Generating sub-service call according to the number of times of call between sub-services counted in the timing scheduling period ATRelation coefficient list CsortThe method comprises the following steps: assuming that in a timing scheduling period AT, CI is arranged in descending order according to the calling times among the sub-services, and the ordered list is CIsortAfter sorting, calculating the relation coefficient between the sub-services: suppose that F is invoked within one cycle of group 1 sub-service relationships1Secondly, the 1 st group of sub-service call relation coefficient is 1; group 2 calls F in one cycle2Then, the 2 nd group sub-service call relation coefficient is F2/F1(ii) a The nth group calls F in one cyclenThen, the nth group of sub-service call relation coefficient is Fn/F1Sequentially calculating to obtain a sorted sub-service call relation coefficient list as Csort
As shown in fig. 3, the method comprises the following steps:
step A: when a periodic scheduling time node is reached, starting periodic scheduling to obtain a sub-service call relation coefficient list counted in the previous period;
and B: sequentially traversing sub-service call relation coefficient lists under all the copy lists of the service application;
and C: judging whether the sub-service calling relation coefficient is larger than the sub-service calling relation coefficient average value or not, and switching to the next pair of sub-service calling relations if the current relation coefficient is smaller than the relation coefficient average value; if the current relation coefficient is larger than the average value of the relation coefficients, starting the migration of the sub-services in the calling relation, and updating the host information and the service information of the service application;
step D: judging whether two sub-services in the calling relationship are in the same host machine or not, and if so, switching to the next pair of calling relationships; if the sub-services are located in different hosts, the sub-services occupying less resources are migrated to the host where the sub-services occupying more resources are located, and host information and service information of the service application are updated;
step E: and confirming that all calling relations have been traversed, and finishing the second-stage scheduling.
The periodic second level scheduling method is as follows:
Figure BDA0002603475030000121
Figure BDA0002603475030000131
note: the is _ on _ same _ ph () function functions to determine whether two sub-services are in the same host. Returning True in the same physical service; false is not returned in the same host.
In the above scheme, the relation coefficient average value CaveRefers to the average of all sub-service invocation relationship coefficients during a period. When the sub-service invocation relation coefficient is larger than the value, the migration of the sub-service is started in the periodic scheduling process. Cave<1. The queue Q to be scheduled is a global object, and is initialized when the scheduler starts. Attributes of nodes in the queue include: sub-service name, amount of occupied resources, and host to which the plan is scheduled. The scheduler will periodically read the queue and schedule the sub-services of each node in the queue to the designated host. The calculation methods of the R value and the CR value are consistent and are both numerical values obtained after various resources are quantized and weighted. A comparison of the R and CR values may be used to determine whether a container of a sub-service can be successfully dispatched to a physical machine.
And scheduling the sub-services frequently called among the sub-services to the same host machine through the second-level periodic scheduling, so that the high performance of communication among the sub-services frequently called can be ensured as much as possible.
The distribution of the sub-services on the hosts after the second-level scheduling adjustment is shown in fig. 5, and in the example of fig. 4, it is assumed that the sub-service 3 in the service 1 calls the sub-service 4 most frequently, and the sub-service 4 occupies a larger amount of resources than the sub-service 3. Fig. 4 shows the host where the sub-service of the business application service copy is located and the call relationship between the sub-services after the second-level scheduling. As can be seen from fig. 5, after the second-level scheduling, the sub-service 3 in the service 1 in the copy 4 is migrated to the host 5, so that the sub-service 3 and the sub-service 4 are ensured to be in the same host, and the invocation performance of the sub-service is improved.
Example 5
The system for implementing a method for scheduling a service based on a micro-service architecture according to any one of embodiments 1 to 4, as shown in fig. 7, includes an initialization module, a first scheduling module, and a second scheduling module, which are connected in sequence;
the initialization module is to: initializing host machine information and service information of business application; the first scheduling module is to: scheduling the sub-services with calling relations among different copies to the same host according to the resource conditions of a plurality of hosts and the basic information of the service application to be scheduled; executing the steps a-f through a scheduler; the second scheduling module is to: in the running process of the business application, counting the calling relationship among the sub-services, periodically checking and transferring the sub-services meeting the conditions according to the calling relationship coefficient, and transferring the sub-services frequently called to the same host machine; the above steps a-E are performed by the scheduler.
It is obvious that the examples set forth in the detailed description are only some examples of the invention, and not all examples. All other examples, which can be obtained by the skilled person without inventive labour on the basis of the examples of the present invention, shall fall within the scope of protection of the present invention.

Claims (10)

1. A service scheduling method based on micro-service architecture, the physical resource environment realized by the method comprises a plurality of host machines, the service application to be scheduled comprises a plurality of copies to be scheduled, each copy comprises a plurality of services, and each service comprises a plurality of sub-services; the method is characterized by comprising the following steps:
(1) first-stage scheduling: scheduling the sub-services with calling relations among different copies to the same host according to the resource conditions of a plurality of hosts and the basic information of the service application to be scheduled;
(2) and (3) second-level scheduling: in the running process of the business application, the calling relation among the sub-services is counted, the sub-services meeting the conditions are periodically checked and migrated according to the calling relation coefficient, and the sub-services frequently called are migrated to the same host machine.
2. The method for scheduling services based on microservice architecture according to claim 1, wherein before step (1) is executed, host information and service information of service application are initialized;
initializing host information including a host set PH and a resource amount set R that each host can provide, PH ═ PH1,PH2,PH3,...,PHm...,PHMTotal M host machines, PHmRefers to the mth host machine; r denotes the number of quantifiable standard resources that a host can provide, R ═ { R ═ R1,R2,R3,...,Rm...,RM},RmMeans the amount of resources that the mth host can provide;
initializing service information of the business application, wherein the service information comprises the copy number N of the business application to be scheduled, a service set S included by the business application to be scheduled, and a sub-service set S included by each serviceiA set of call relations CI between the sub-services, and a standard amount of virtual resources CR that each sub-service needs to reserveijThe relation coefficient C between the sub-servicesij,klA timing scheduling period AT and a sub-service scheduling state matrix SL; s ═ S1,S2,S3,...,Si...,SIH, total I services, SiRepresents the ith service; si={SSi1,SSi2,SSi3,...,SSij...,SSiJEach service contains J sub-services, SSijRepresents a jth sub-service included in the ith service;
CI={(SSij,SSkl),...|i,j,k,l=1,2,...,m},(SSij,SSkl) The jth sub-service representing the ith service calls the ith sub-service of the kth service, and the CI is sorted according to the length descending order of the calling relationship; CRijRepresenting a virtual resource abstraction value required by a jth sub-service of the ith service; relation coefficient C between sub-servicesij,klIndicating that the jth sub-service in the ith service calls the kth serviceThe frequency of the first sub-service in a transaction; the more frequent the calls, the larger the value; relation coefficient C between sub-servicesij,klAre all initialized to 0; counting the calling times among the sub-services in the timing scheduling period AT, triggering automatic scheduling when the period is over, and transferring the frequently called sub-services to the same host machine; the sub-service scheduling state matrix SL is implemented using a nested list for finding the scheduling state, SSI, of the sub-serviceijkThe scheduling state of the kth sub-service in the jth service of the ith copy comprises whether the host is scheduled or not and the host is scheduled.
3. The method for service scheduling based on micro-service architecture as claimed in claim 2, wherein in step (1), the sub-services having call relations between different copies are scheduled to the same host according to the resource situation of several hosts and the basic information of the service application to be scheduled, comprising the steps of:
step a: judging whether the total amount of resources which can be provided by all the host machines can bear the business application services of all the copies, if not, scheduling fails, and ending; otherwise, starting scheduling and entering the step b;
step b: traversing the host machine, judging whether a single host machine can bear all sub-services under the business application service of a single copy, and if the single host machine can not bear the sub-services, switching to the next host machine; if the service can be borne, scheduling a copy of the service application service to the host machine, and updating the host machine information and the service information of the service application until the host machine is traversed;
step c: according to the resource amount which can be provided by the host machine, the host machine is sorted in a descending order again;
step d: sequentially traversing the call relation sets among the sub-services under the unscheduled copies, scheduling the sub-services with the call relation to the same host with sufficient resources, and updating the host information and the service information of the service application;
step e: traversing the sub-service scheduling state matrix, searching the non-scheduled sub-service, scheduling the non-scheduled sub-service to the host machine which is the same as other sub-services under the copy of the non-scheduled sub-service, and updating the host machine information and the service information of the service application;
step f: and confirming that all the sub-services are scheduled to be completed, and finishing the first-level scheduling.
4. The method according to claim 3, wherein in the step (2), in the running process of the service application, the call relationship between the sub-services is counted, the sub-services meeting the condition are periodically checked and migrated according to the call relationship coefficient, and the sub-services frequently called are migrated to the same host, and the method comprises the following steps:
step A: when a periodic scheduling time node is reached, starting periodic scheduling to obtain a sub-service call relation coefficient list counted in the previous period;
and B: sequentially traversing sub-service call relation coefficient lists under all the copy lists of the service application;
and C: judging whether the sub-service calling relation coefficient is larger than the sub-service calling relation coefficient average value or not, and switching to the next pair of sub-service calling relations if the current relation coefficient is smaller than the relation coefficient average value; if the current relation coefficient is larger than the average value of the relation coefficients, starting the migration of the sub-services in the calling relation, and updating the host information and the service information of the service application;
step D: judging whether two sub-services in the calling relationship are in the same host machine or not, and if so, switching to the next pair of calling relationships; if the sub-services are located in different hosts, the sub-services occupying less resources are migrated to the host where the sub-services occupying more resources are located, and host information and service information of the service application are updated;
step E: and confirming that all calling relations have been traversed, and finishing the second-stage scheduling.
5. The method for scheduling services based on microservice architecture as claimed in claim 3, wherein the step a is defined as: judging the total amount of resources T which can be provided by all host machinesPHBusiness application service T capable of bearing all copiesS
Figure FDA0002603475020000021
Figure FDA0002603475020000022
If T isPH<TSIf the load cannot be carried, the scheduling fails, and the process is finished; otherwise, starting scheduling and entering the step b.
6. The method according to claim 1, wherein in step (2), in the running process of the service application, the call relationship between the sub-services is counted, the sub-services meeting the condition are periodically checked and migrated according to the call relationship coefficient, and the sub-services frequently invoked are migrated to the same host, where the moving refers to: generating a sub-service calling relation coefficient list C according to the number of times of calling between the sub-services counted in the timing scheduling period ATsortAnd dispatching the sub-service with larger sub-service calling relation coefficient under the same copy to the same host.
7. The method according to claim 6, wherein the sub-service invocation relation coefficient list C is generated according to the invocation times between sub-services counted in the timing scheduling period ATsortThe method comprises the following steps: assuming that in a timing scheduling period AT, CI is arranged in descending order according to the calling times among the sub-services, and the ordered list is CIsortAfter sorting, calculating the relation coefficient between the sub-services: suppose that F is invoked within one cycle of group 1 sub-service relationships1Secondly, the 1 st group of sub-service call relation coefficient is 1; group 2 calls F in one cycle2Then, the 2 nd group sub-service call relation coefficient is F2/F1(ii) a The nth group calls F in one cyclenThen, the nth group of sub-service call relation coefficient is Fn/F1Sequentially calculating to obtain a sorted sub-service call relation coefficient list as Csort
8. The system for implementing the scheduling method of claim 4, comprising an initialization module, a first scheduling module, and a second scheduling module connected in sequence;
the initialization module is configured to: initializing host machine information and service information of business application; the first scheduling module is to: scheduling the sub-services with calling relations among different copies to the same host according to the resource conditions of a plurality of hosts and the basic information of the service application to be scheduled; the second scheduling module is to: in the running process of the business application, the calling relation among the sub-services is counted, the sub-services meeting the conditions are periodically checked and migrated according to the calling relation coefficient, and the sub-services frequently called are migrated to the same host machine.
9. The system for implementing the scheduling method of claim 8, wherein the first scheduling module and the second scheduling module are both schedulers.
10. The system for implementing the scheduling method according to claim 8 or 9, wherein the first scheduling module performs the steps a to f; and the second scheduling module executes the steps A to E.
CN202010731894.7A 2020-07-27 2020-07-27 Service scheduling method based on micro-service architecture and implementation system thereof Active CN111880898B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010731894.7A CN111880898B (en) 2020-07-27 2020-07-27 Service scheduling method based on micro-service architecture and implementation system thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010731894.7A CN111880898B (en) 2020-07-27 2020-07-27 Service scheduling method based on micro-service architecture and implementation system thereof

Publications (2)

Publication Number Publication Date
CN111880898A true CN111880898A (en) 2020-11-03
CN111880898B CN111880898B (en) 2022-04-05

Family

ID=73201698

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010731894.7A Active CN111880898B (en) 2020-07-27 2020-07-27 Service scheduling method based on micro-service architecture and implementation system thereof

Country Status (1)

Country Link
CN (1) CN111880898B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104199724A (en) * 2014-09-10 2014-12-10 山东省计算中心(国家超级计算济南中心) Virtual resource dispatching and optimizing method based on cost performance
CN104765640A (en) * 2014-01-02 2015-07-08 中国科学院声学研究所 Intelligent service scheduling method
CN106101212A (en) * 2016-06-08 2016-11-09 四川新环佳科技发展有限公司 Big data access method under cloud platform
CN108712464A (en) * 2018-04-13 2018-10-26 中国科学院信息工程研究所 A kind of implementation method towards cluster micro services High Availabitity
US20190066116A1 (en) * 2017-08-29 2019-02-28 Verint Americas Inc. System and method for organizing and integrating electronic customer service resources
CN110704165A (en) * 2019-10-08 2020-01-17 浪潮云信息技术有限公司 High-availability deployment method for container
CN111158895A (en) * 2018-11-08 2020-05-15 中国电信股份有限公司 Micro-service resource scheduling method and system
US20200195528A1 (en) * 2018-12-17 2020-06-18 Cisco Technology, Inc. Time sensitive networking in a microservice environment

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104765640A (en) * 2014-01-02 2015-07-08 中国科学院声学研究所 Intelligent service scheduling method
CN104199724A (en) * 2014-09-10 2014-12-10 山东省计算中心(国家超级计算济南中心) Virtual resource dispatching and optimizing method based on cost performance
CN106101212A (en) * 2016-06-08 2016-11-09 四川新环佳科技发展有限公司 Big data access method under cloud platform
US20190066116A1 (en) * 2017-08-29 2019-02-28 Verint Americas Inc. System and method for organizing and integrating electronic customer service resources
CN108712464A (en) * 2018-04-13 2018-10-26 中国科学院信息工程研究所 A kind of implementation method towards cluster micro services High Availabitity
CN111158895A (en) * 2018-11-08 2020-05-15 中国电信股份有限公司 Micro-service resource scheduling method and system
US20200195528A1 (en) * 2018-12-17 2020-06-18 Cisco Technology, Inc. Time sensitive networking in a microservice environment
CN110704165A (en) * 2019-10-08 2020-01-17 浪潮云信息技术有限公司 High-availability deployment method for container

Also Published As

Publication number Publication date
CN111880898B (en) 2022-04-05

Similar Documents

Publication Publication Date Title
CN107992359B (en) Task scheduling method for cost perception in cloud environment
US5504894A (en) Workload manager for achieving transaction class response time goals in a multiprocessing system
Sullivan et al. A large scale, homogeneous, fully distributed parallel machine, I
CA2471594C (en) Method and apparatus for web farm traffic control
Tindell Using offset information to analyse static priority pre-emptively scheduled task sets
CN107545338B (en) Service data processing method and service data processing system
CN109814998A (en) A kind of method and device of multi-process task schedule
CN109445802A (en) The method of privatization Paas platform and its publication application based on container
CN109857535B (en) Spark JDBC-oriented task priority control implementation method and device
CN112068943B (en) Micro-service scheduling method based on complex heterogeneous environment and implementation system thereof
US20030028640A1 (en) Peer-to-peer distributed mechanism
CN115237568A (en) Mixed weight task scheduling method and system for edge heterogeneous equipment
CN104346220B (en) A kind of method for scheduling task and system
CN110048966B (en) Coflow scheduling method for minimizing system overhead based on deadline
EP1131704A1 (en) Processing system scheduling
CN110287006A (en) A kind of data dispatching method and system
CN111880898B (en) Service scheduling method based on micro-service architecture and implementation system thereof
CN108319501A (en) A kind of flexible resource supply method and system based on micro services gateway
CN109446641B (en) Multi-stage reliability modeling analysis method of cloud computing service system
Huang et al. AutoVNF: An Automatic Resource Sharing Schema for VNF Requests.
CN111625414A (en) Method for realizing automatic scheduling monitoring system of data conversion integration software
CN116010051A (en) Federal learning multitasking scheduling method and device
CN111444183B (en) Distributed self-adaptive user request scheduling method in key value storage system
US7639618B2 (en) System and method for recognition and cyclic service of partial sequences of communication requests
CN112506658B (en) Dynamic resource allocation and task scheduling method in service chain

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20230316

Address after: 6th Floor, Main Building, Jinan Supercomputing Center Science Park, 28666 Jingshi East Road, Caishi Street, Licheng District, Jinan City, Shandong Province, 250000

Patentee after: Shandong Ruichuang Education Technology Co.,Ltd.

Address before: No.19 Keyuan Road, Jinan, Shandong 250013

Patentee before: SHANDONG COMPUTER SCIENCE CENTER(NATIONAL SUPERCOMPUTER CENTER IN JINAN)

TR01 Transfer of patent right