Detailed Description
As shown in fig. 6, the present embodiment relates to a serverless computation scheduling system based on function intermediate expression, including: the device comprises a function characteristic acquisition module, a function aggregation module, a mapping module and an adjustment module, wherein: the function characteristic acquisition module acquires programming language characteristics of the function, runtime stage characteristics of the function and micro-architecture characteristics of the function; the function aggregation module aggregates the functions into different function sets according to different characteristics; the mapping module divides the CPU core into an initialization stage CPU core, a runtime stage CPU core and a hybrid CPU core according to different function sets; the adjusting module deploys the function to the specified core according to the feature of the function and the classification of the CPU core, and periodically migrates the function according to the change of the feature of the function and adjusts the frequency of each core.
As shown in fig. 2 to 5, the function feature acquisition means: firstly, acquiring the identification of a function, and then respectively: obtaining micro-architectural features of functions from a hardware level of serverless computing functions
Collecting runtime phase features of an application from an operating system level
Collecting programming language features of an application from the application software level
And inducing the acquired multidimensional characteristics to form a triple with function identification
The function aggregation refers to: aggregating functions into different function sets according to different characteristics, and aggregating according to function characteristics, specifically: first run-time phase characterization by function
The method comprises the steps of aggregating functions, and classifying the function aggregation into an initialization stage function and a runtime stage function; then further initializing the phase function programming language
Aggregating to obtain a function set
Per-microarchitectural characterization of runtime phase functions
Aggregating functions to obtain function set
The initialization stage CPU core refers to: according to a set
In the function condition, marking all the CPU cores which can deploy the functions of the same programming language as the CPU cores in the initialization stage; initializing the functions to be run on each of the CPU cores is in the initialization phase and their programming languages are the same.
The run-time stage CPU core refers to: according to a set
In the function condition, marking all the CPU cores which can deploy the functions with the same micro-architecture characteristics as the CPU cores in the runtime stage; the functions to be run on each of the run-time CPU cores are in the run-time phase and their microarchitectural features are the same.
The mixed CPU core is as follows: because the number of the functions which can be deployed on each CPU core is limited, all the functions with the same characteristics can not be deployed on the same CPU core, and the functions which can not be deployed completely according to the characteristics can be deployed on the mixed CPU core; the hybrid CPU core includes: an initialization hybrid CPU core, a runtime hybrid CPU core, and an initialization/runtime hybrid CPU core, wherein: initializing the hybrid CPU core means: some functions in the initialized CPU core are in an initialization stage, but there is no way to deploy the functions with the same programming language on the same CPU core, and at this time, the remaining CPU cores, which can be deployed by the functions in the initialization stage, are marked as initialized hybrid CPU cores, and the functions to be run on each core in the initialized hybrid CPU cores are in the initialization stage but the programming languages are different; run-time hybrid CPU core means: the function still existing in the CPU core during operation can not be deployed on the same CPU core according to the same micro-architecture characteristics; marking the rest CPU core which can be deployed by the function in the runtime stage as a runtime mixed CPU core; the function to be run on each core in the run-time hybrid CPU core is in the run-time stage but the micro-architecture features are different; the initialization/runtime hybrid CPU core refers to: the rest of functions cannot be deployed on the same CPU core according to the initialization phase and the runtime phase, and at this time, the rest of functions with the initialization phase and the runtime phase are deployed on the CPU core in a mixed manner, and the cores are marked as initialization/runtime mixed CPU cores.
The regulation refers to that: the method comprises the steps of firstly deploying a function to a specified core according to the characteristics of the function and the classification of CPU cores, sensing the function characteristics of the operation of the CPU cores as the optimal operation frequency of the function, periodically transferring the function according to the change of the function characteristics to ensure that the confusion factor of the CPU core is minimum, and periodically adjusting the frequency of the CPU core to ensure that the frequency of the CPU core meets the optimal operation frequency of the function.
The periodically migrating the function is that: along with the running of functions, the characteristics of partial functions can be changed, and simultaneously, with the arrival of new access functions, more and more functions on the CPU cores cannot be guaranteed to have the same characteristics, so that more and more mixed CPU cores are provided. The invention periodically carries out migration adjustment on the functions operated on the CPU core, and ensures that the confusion factor of the CPU core in the server-free computing system is minimum.
The CPU core confusion factor is as follows: the hybrid CPU core occupies a proportion of all active CPU cores in a serverless computing system, i.e.
The functions deployed on the CPU core hardly meet the optimal operating frequency of the functions, so that the energy efficiency of the system can be improved by reducing the chaos factors of the CPU core, and more functions can be operated according to the optimal operating frequency.
As shown in fig. 1, when a user sends a function trigger request to a serverless computing system, a specific scheduling method of the serverless computing scheduling system includes:
step 1, a function feature extraction module acquires multi-dimensional features of a function, specifically: when the function runs in the server-free computing system, the function feature extraction module obtains the identifier of the container corresponding to the function, and obtains the features of the server-free computing function from three different layers: micro-architectural feature for fetching functions from hardware level
Acquiring runtime stage characteristics of a function from an operating system level; and acquiring the programming language characteristics of the function from the function software layer. And inducing the obtained multidimensional characteristics to form a ternary system with function identificationGroup of
1) When the function accesses the serverless computing system, the function feature extraction module first obtains the programming language of the function from the function software level. The method for acquiring the function language is to analyze the output of the function language by using a docker ps command so as to acquire the realization language of the function. And stored in a unary group
. The operation of acquiring the function programming language only needs to be performed once in the stage of accessing the system by the function.
2) Periodically (100ms), a function feature extraction module acquires the micro-architectural features of the function from a hardware level, and the function feature extraction module uses a perf command to count specific events on a specific core, wherein the events comprise: task-clock is used to express CPU utilization, cache-reference is used to express memory usage bandwidth and block _ rq _ insert is used to express IO bandwidth of an application. And store the hardware information into triplets
Utilization ratio, memory bandwidth, IO bandwidth>。
3) The function feature extraction module periodically (100ms) acquires the runtime stage features of the function from the operating system level, and acquires whether the function is in the initialization stage or the runtime stage currently by analyzing log information output by the docker log. And storing the runtime information in a tuple
< initialization phase/runtime phase>。
The function feature extraction module generalizes the collected three-aspect feature information and stores the information as a triple with function identification
Step 2, the function aggregation module aggregates the functions into different function sets according to different characteristics, specifically: firstly, according to the runtime stage characteristics of the functions, the functions are divided into two major categories: integrating all functions in the initialization stage into an initialization stage function set; all functions in the runtime phase are aggregated into a runtime phase function set.
1) The function aggregation module further aggregates the initialization stage function sets according to the programming language, and aggregates functions with the same programming language (python, java, go, ruby, swift, php, rust, etc.) in the initialization stage function sets into a new function set
I.e. a set of function identifications all having the same programming language.
2) The function aggregation module further aggregates the function sets in the runtime stage according to the micro-architecture characteristics, and aggregates the functions with the same micro-architecture characteristics (CPU intensive, memory intensive, IO intensive and the like) in the runtime stage into a new function set
I.e. the set of function identifications all having the same micro-architectural features.
The functions in the server-free computing system can be divided into different sets with the same characteristics through the function aggregation module, and then the functions are deployed into the server-free computing system according to the characteristics of the sets.
And 3, classifying the CPU cores on the server-free computing system by the function mapping module to ensure that the server-free computing function can have better mapping with the CPU cores, and dividing the CPU cores on the server-free computing platform into the following parts by the function mapping module according to the characteristics and the number of different function sets obtained in the function aggregation module: 1) a CPU core in an initialization stage; 2) a runtime phase CPU core; and 3) a hybrid CPU core. Each CPU core on a serverless computing platform can deploy a maximum of 4 functions simultaneously.
1) SaidThe initialization phase CPU core refers to: to the collection
The statistical number of the function sets corresponding to each programming language is obtained
Will be provided with
Each CPU core is marked as an initialization CPU core in the corresponding programming language. The serverless computing functions deployed on the initializing CPU core all have the same programming language.
2) The run-time stage CPU core refers to: to the collection
The statistical number of the function set corresponding to each micro-architecture feature in the system is obtained
Respectively to be provided with
Each CPU core is marked as a runtime CPU core under the corresponding micro-architectural feature. Serverless computing functions deployed on runtime CPU cores all have the same microarchitectural features.
3) The mixed CPU core is as follows: because the number of functions that can be deployed on each CPU core is limited, all functions with the same characteristics cannot be deployed on the same CPU core, and functions that cannot be deployed completely according to the characteristics are deployed on a hybrid CPU core. Hybrid CPU cores can be further divided into three categories: 1) initializing a hybrid CPU core; 2) run-time hybrid CPU cores; and 3) initialize/run-time hybrid CPU cores.
The mixed CPU core is further divided according to the following modes:
the initialization of the hybrid CPU core refers to: marking part of the CPU core as an initialization CPU core according to a programming language, but also part of the function
Are all in the initialization phase, but there is no way to deploy functions with the same programming language on the same CPU core. Then the remaining functions are shared
Individual functions cannot be deployed on the same CPU core as functions having the same programming language. At this moment will
Each CPU core is marked as an initialization hybrid CPU core.
The run-time mixed CPU core is as follows: marking a deployment CPU core as a runtime CPU core in terms of microarchitectural features, but still existing
The functions cannot be deployed on the same CPU core exactly according to the same micro-architectural features. At this moment will
Individual CPU cores are marked as runtime hybrid CPU cores.
The initialization/runtime mixed CPU core is as follows: the remaining functions cannot be deployed on the same CPU core in both the initialization phase and the runtime phase. The function mixture with initialization phase and runtime phase left at this time is deployed on the CPU core, and this is doneThese cores are labeled as initialization/runtime hybrid CPU cores.
Step 4, the adjusting module adjusts the operating environment of the function, specifically: the method comprises the steps of firstly deploying functions to appointed cores according to the characteristics of the functions and the classification of CPU cores, and setting the frequency of each CPU core as the optimal operation frequency of the functions according to a function-frequency table. And periodically transferring the function according to the change of the function characteristics to ensure that the chaotic factor of the CPU core is minimum, and periodically adjusting the frequency of the CPU core to ensure that the frequency of the CPU core meets the optimal operation frequency of the function.
The function-frequency table refers to: and counting functions operated on the server-free computing platform to obtain the energy efficiency of the functions operated at different frequencies under each function characteristic. The method comprises the following specific steps: binding functions with different characteristics to a CPU core, setting the frequency of the CPU core to be 0.8GHz, 0.9GHz, … GHz and 2.2GHz, and recording the energy efficiency of the functions under each frequency setting. And stores the resulting structure in a function-frequency table.
The function-frequency table includes: function characteristics and energy efficiency corresponding to 0.8 GHz-2.2 GHz every 0.1 GHz.
The method for setting the frequency of the CPU core as the optimal operation frequency of the function comprises the following specific steps:
1) the CPU cores are marked as different classes according to the function mapping module. The adjustment module uses the Cgroup command to bind the function to the CPU core corresponding to the feature tag.
2) For the CPU core in the initialization stage and the CPU core in the runtime stage, the adjusting module queries the function-frequency table, selects the optimal running frequency corresponding to the function characteristics, and then adjusts the frequency of the corresponding CPU core by using the DVFS.
3) For a hybrid CPU core, the frequency of the CPU core is set using an energy efficiency maximization algorithm. For each hybrid CPU on-core function, the energy efficiency of the function at each frequency setting is obtained from a function-frequency table. At each frequency setting, the energy efficiency of all functions on the CPU core are added, and the overall energy efficiency of the functions at each frequency is compared. The frequency chosen to maximize the overall energy efficiency of the function is set to the frequency of the hybrid CPU core.
The periodically migrating the function is that: along with the running of functions, the characteristics of partial functions can be changed, and simultaneously, with the arrival of new access functions, more and more functions on the CPU cores cannot be guaranteed to have the same characteristics, so that more and more mixed CPU cores are provided. The invention periodically carries out migration adjustment on the functions operated on the CPU core, and ensures that the confusion factor of the CPU core in the server-free computing system is minimum.
The CPU core confusion factor is as follows: the hybrid CPU core occupies a proportion of all active CPU cores in a serverless computing system, i.e.
The functions deployed on the CPU core hardly meet the optimal operating frequency of the functions, so that the energy efficiency of the system can be improved by reducing the chaos factors of the CPU core, and more functions can be operated according to the optimal operating frequency.
In order to perform function migration, according to the characteristics of the functions in the current system, the CPU core is marked again every 100ms, and according to the marks, the functions are migrated, and the functions with the same characteristics are migrated to the corresponding CPU core. And simultaneously, deploying the newly accessed function to the corresponding CPU core according to the characteristics.
The migration specifically comprises the following steps:
detecting all CPU cores, judging whether the function characteristics on the CPU cores are the same or not, when the function characteristics are the same, the CPU cores do not need to be adjusted, when the function characteristics on the CPU cores are different, the CPU cores need to be adjusted at the moment, and when no function runs on the CPU cores, the CPU cores are put into an idle CPU core queue Q
freeThe following adjustments are only for the CPU cores that need to be adjusted;
performing characteristic analysis on the newly accessed function, and storing the newly accessed function into a queue Q
new.
Counting all functions on the CPU core needing to be adjusted and newly accessed functions, and counting the number { N } of the functions corresponding to each characteristic
f1,N
f2,., determining the number of CPU cores corresponding to each feature and how many mixed CPU cores need to be allocated to deploy the function which cannot be deployed in the initialization stage CPU core and the runtime stage CPU core;
finding the leading features, counting the functions on one CPU core, counting the number of functions corresponding to different features, taking the function feature with the highest number as the leading feature of the CPU core, and putting the CPU core into the queue Q corresponding to the leading feature
fnIf the function is not a function of the feature, the throttling module removes the CPU core affinity of the function by using cgroup and inserts the function into a queue Q to be deployed
motion;
Determining a classification of the CPU core based on the steps
Obtaining the CPU core corresponding to the function of each characteristic and how many mixed CPU cores to obtain the function of each characteristic
The CPU core and the idle CPU core corresponding to the obtained dominant feature are redistributed: when the number of CPU cores required for a feature is greater than or equal to the number of CPU cores dominated by the feature, N is
fn≥len(Q
fn) Then, the slave Q is required
freeExtracting idle CPU cores to deploy the function of the characteristic; CPU core required when a feature is requiredIs less than the number of CPU cores dominated by the feature, i.e., N
fn<len(Q
fn) It is explained that the number of the CPU cores dominated by the feature is too large, functions on a part of the CPU cores need to be migrated, and the system transfers Q
fnIn the method, each CPU core is sorted in descending order according to the number of the dominant functions of the CPU core, and is arranged in N
fnAll function removals on subsequent CPU cores put Q into
motionAnd add these CPU cores into Q
free;
Function deployment is carried out, and Q is processed according to the classified CPU cores
motionAnd a new function is deployed on the CPU core with the corresponding characteristic according to the characteristic, and firstly, the function is judged not to be Q
motionAnd Q
newThen the function does not need to be adjusted, then for Q
motionAnd Q
newThe functions in the method are bound with the affinity among the CPU cores by using the cgroup until the corresponding CPU cores are completely deployed, when all the functions are completely deployed, all the functions are perfectly bound on the corresponding CPU cores according to the characteristics, otherwise, for the functions which cannot be deployed on the CPU cores with similar characteristics, Q is bound on the corresponding CPU cores
freeThe CPU core in the system is configured as a mixed CPU core, and the redundant functions are mixed and deployed.
Through specific practical experiments, the CPU is Intel (R) Xeon (R) Silver4114, the function without server computing is selected from ALUpy, ALUJS, ALUGo, ALUwigft, ALUpthp, ALUruby and FileIO, the regulation period is 100ms, and the maximum number of the functions which can be deployed on each CPU core is 2 or 4. The experimental data that can be obtained are: the invention can reduce the chaos degree of the CPU core deployment function in the serverless computing system and improve the overall energy efficiency of the system by 14-53%.
Compared with the prior art, the method obviously relieves the gap between the upper-layer request-level scheduling and the bottom-layer instruction-level dynamic scheduling. The intermediate expression of the function can describe multi-dimensional characteristics of the server-free computing function, and the server-free computing function can be better scheduled and distributed by utilizing the multi-dimensional characteristics. And the element scheduling is used for acquiring and aggregating the multi-dimensional characteristics of the functions, and mapping and adjusting the CPU core, so that the server-free calculation functions can be operated according to respective optimal operation frequency. The invention can better deploy and manage the server-free computing system and optimize the overall operation energy efficiency of the system.
The foregoing embodiments may be modified in many different ways by those skilled in the art without departing from the spirit and scope of the invention, which is defined by the appended claims and all changes that come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein.