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:
@@ -27,7 +27,7 @@ exports = module.exports = {
|
||||
setTurn,
|
||||
setRedis,
|
||||
setMemoryLimit,
|
||||
setCpuShares,
|
||||
setCpuQuota,
|
||||
setAutomaticBackup,
|
||||
setAutomaticUpdate,
|
||||
setReverseProxyConfig,
|
||||
@@ -281,13 +281,13 @@ async function setMemoryLimit(req, res, next) {
|
||||
next(new HttpSuccess(202, { taskId: result.taskId }));
|
||||
}
|
||||
|
||||
function setCpuShares(req, res, next) {
|
||||
function setCpuQuota(req, res, next) {
|
||||
assert.strictEqual(typeof req.body, 'object');
|
||||
assert.strictEqual(typeof req.app, 'object');
|
||||
|
||||
if (typeof req.body.cpuShares !== 'number') return next(new HttpError(400, 'cpuShares is not a number'));
|
||||
if (typeof req.body.cpuQuota !== 'number') return next(new HttpError(400, 'cpuQuota is not a number'));
|
||||
|
||||
apps.setCpuShares(req.app, req.body.cpuShares, AuditSource.fromRequest(req), function (error, result) {
|
||||
apps.setCpuQuota(req.app, req.body.cpuQuota, AuditSource.fromRequest(req), function (error, result) {
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(202, { taskId: result.taskId }));
|
||||
|
||||
Reference in New Issue
Block a user