Rework cpuShares into cpuQuota

cpuShares is the relative weight wrt other apps. This is used when
there is contention for CPU. If we want this, maybe we implement
a UI where we show all the apps and let the user re-order them.
As it stands, it is confusing.

cpuQuota is a more straightforward "hard limit" of the CPU% that you
want the app to consume.

Can be tested with : stress -c 8 -t 20s
This commit is contained in:
Girish Ramakrishnan
2024-04-10 17:38:49 +02:00
parent 2afaf1f36d
commit b4e4f26361
15 changed files with 265 additions and 91 deletions

View File

@@ -543,8 +543,8 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
memoryLimit: 0, // RAM
memoryTicks: [],
currentCpuShares: 0,
cpuShares: 0,
currentCpuQuota: 0,
cpuQuota: 0,
show: function () {
var app = $scope.app;
@@ -569,7 +569,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
// for firefox widget update
$timeout(function() {
$scope.resources.currentCpuShares = $scope.resources.cpuShares = app.cpuShares;
$scope.resources.currentCpuQuota = $scope.resources.cpuQuota = app.cpuQuota;
$scope.resources.memoryLimit = $scope.resources.currentMemoryLimit;
$scope.resources.busy = false;
}, 500);
@@ -600,14 +600,14 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
});
},
submitCpuShares: function () {
submitCpuQuota: function () {
$scope.resources.busy = true;
$scope.resources.error = {};
Client.configureApp($scope.app.id, 'cpu_shares', { cpuShares: parseInt($scope.resources.cpuShares) }, function (error) {
Client.configureApp($scope.app.id, 'cpu_quota', { cpuQuota: parseInt($scope.resources.cpuQuota) }, function (error) {
if (error) return Client.error(error);
$scope.resources.currentCpuShares = $scope.resources.cpuShares;
$scope.resources.currentCpuQuota = $scope.resources.cpuQuota;
refreshApp($scope.app.id, function (error) {
if (error) return Client.error(error);