Add CPU Thread assignments

Added CPU Thread assignments for each server
This commit is contained in:
AreYouScared 2020-03-29 14:41:55 -04:00
parent ab4c4e7e9e
commit 2561e3e8d5
9 changed files with 28 additions and 2 deletions

View file

@ -262,7 +262,7 @@ class ServersController extends Controller
{ {
$this->buildModificationService->handle($server, $request->only([ $this->buildModificationService->handle($server, $request->only([
'allocation_id', 'add_allocations', 'remove_allocations', 'allocation_id', 'add_allocations', 'remove_allocations',
'memory', 'swap', 'io', 'cpu', 'disk', 'memory', 'swap', 'io', 'cpu', 'threads', 'disk',
'database_limit', 'allocation_limit', 'oom_disabled', 'database_limit', 'allocation_limit', 'oom_disabled',
])); ]));
$this->alert->success(trans('admin/server.alerts.build_updated'))->flash(); $this->alert->success(trans('admin/server.alerts.build_updated'))->flash();

View file

@ -49,6 +49,7 @@ class StoreServerRequest extends ApplicationApiRequest
'limits.swap' => $rules['swap'], 'limits.swap' => $rules['swap'],
'limits.disk' => $rules['disk'], 'limits.disk' => $rules['disk'],
'limits.io' => $rules['io'], 'limits.io' => $rules['io'],
'limits.threads' => $rules['threads'],
'limits.cpu' => $rules['cpu'], 'limits.cpu' => $rules['cpu'],
// Application Resource Limits // Application Resource Limits
@ -96,6 +97,7 @@ class StoreServerRequest extends ApplicationApiRequest
'disk' => array_get($data, 'limits.disk'), 'disk' => array_get($data, 'limits.disk'),
'io' => array_get($data, 'limits.io'), 'io' => array_get($data, 'limits.io'),
'cpu' => array_get($data, 'limits.cpu'), 'cpu' => array_get($data, 'limits.cpu'),
'threads' => array_get($data, 'limits.threads'),
'skip_scripts' => array_get($data, 'skip_scripts', false), 'skip_scripts' => array_get($data, 'skip_scripts', false),
'allocation_id' => array_get($data, 'allocation.default'), 'allocation_id' => array_get($data, 'allocation.default'),
'allocation_additional' => array_get($data, 'allocation.additional'), 'allocation_additional' => array_get($data, 'allocation.additional'),

View file

@ -25,6 +25,7 @@ class UpdateServerBuildConfigurationRequest extends ServerWriteRequest
'limits.swap' => $this->requiredToOptional('swap', $rules['swap'], true), 'limits.swap' => $this->requiredToOptional('swap', $rules['swap'], true),
'limits.io' => $this->requiredToOptional('io', $rules['io'], true), 'limits.io' => $this->requiredToOptional('io', $rules['io'], true),
'limits.cpu' => $this->requiredToOptional('cpu', $rules['cpu'], true), 'limits.cpu' => $this->requiredToOptional('cpu', $rules['cpu'], true),
'limits.threads' => $this->requiredToOptional('threads', $rules['threads'], true),
'limits.disk' => $this->requiredToOptional('disk', $rules['disk'], true), 'limits.disk' => $this->requiredToOptional('disk', $rules['disk'], true),
// Legacy rules to maintain backwards compatable API support without requiring // Legacy rules to maintain backwards compatable API support without requiring
@ -35,6 +36,7 @@ class UpdateServerBuildConfigurationRequest extends ServerWriteRequest
'swap' => $this->requiredToOptional('swap', $rules['swap']), 'swap' => $this->requiredToOptional('swap', $rules['swap']),
'io' => $this->requiredToOptional('io', $rules['io']), 'io' => $this->requiredToOptional('io', $rules['io']),
'cpu' => $this->requiredToOptional('cpu', $rules['cpu']), 'cpu' => $this->requiredToOptional('cpu', $rules['cpu']),
'threads' => $this->requiredToOptional('threads', $rules['threads']),
'disk' => $this->requiredToOptional('disk', $rules['disk']), 'disk' => $this->requiredToOptional('disk', $rules['disk']),
'add_allocations' => 'bail|array', 'add_allocations' => 'bail|array',

View file

@ -98,6 +98,7 @@ class BuildModificationService
'swap' => array_get($data, 'swap'), 'swap' => array_get($data, 'swap'),
'io' => array_get($data, 'io'), 'io' => array_get($data, 'io'),
'cpu' => array_get($data, 'cpu'), 'cpu' => array_get($data, 'cpu'),
'threads' => array_get($data, 'threads'),
'disk' => array_get($data, 'disk'), 'disk' => array_get($data, 'disk'),
'allocation_id' => array_get($data, 'allocation_id'), 'allocation_id' => array_get($data, 'allocation_id'),
'database_limit' => array_get($data, 'database_limit'), 'database_limit' => array_get($data, 'database_limit'),

View file

@ -81,6 +81,7 @@ class ServerConfigurationStructureService
'swap' => $server->swap, 'swap' => $server->swap,
'io_weight' => $server->io, 'io_weight' => $server->io,
'cpu_limit' => $server->cpu, 'cpu_limit' => $server->cpu,
'cpu_threads' => $server->threads,
'disk_space' => $server->disk, 'disk_space' => $server->disk,
], ],
'service' => [ 'service' => [
@ -130,6 +131,7 @@ class ServerConfigurationStructureService
'swap' => (int) $server->swap, 'swap' => (int) $server->swap,
'io' => (int) $server->io, 'io' => (int) $server->io,
'cpu' => (int) $server->cpu, 'cpu' => (int) $server->cpu,
'threads' => $server->threads,
'disk' => (int) $server->disk, 'disk' => (int) $server->disk,
'image' => $server->image, 'image' => $server->image,
], ],

View file

@ -242,6 +242,7 @@ class ServerCreationService
'disk' => Arr::get($data, 'disk'), 'disk' => Arr::get($data, 'disk'),
'io' => Arr::get($data, 'io'), 'io' => Arr::get($data, 'io'),
'cpu' => Arr::get($data, 'cpu'), 'cpu' => Arr::get($data, 'cpu'),
'threads' => Arr::get($data, 'threads'),
'oom_disabled' => Arr::get($data, 'oom_disabled', true), 'oom_disabled' => Arr::get($data, 'oom_disabled', true),
'allocation_id' => Arr::get($data, 'allocation_id'), 'allocation_id' => Arr::get($data, 'allocation_id'),
'nest_id' => Arr::get($data, 'nest_id'), 'nest_id' => Arr::get($data, 'nest_id'),

View file

@ -160,6 +160,13 @@
<span class="input-group-addon">%</span> <span class="input-group-addon">%</span>
</div> </div>
</div> </div>
<div class="form-group col-sm-4">
<label for="pThreads">CPU Threads</label>
<div class="input-group">
<input type="text" class="form-control" value="{{ old('threads') }}" name="threads" id="pThreads" />
<span class="input-group-addon"></span>
</div>
</div>
<div class="form-group col-sm-4"> <div class="form-group col-sm-4">
<label for="pIO">Block IO Weight</label> <label for="pIO">Block IO Weight</label>
<div class="input-group"> <div class="input-group">

View file

@ -26,7 +26,7 @@
<div class="col-sm-5"> <div class="col-sm-5">
<div class="box"> <div class="box">
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title">System Resources</h3> <h3 class="box-title">Resource Management</h3>
</div> </div>
<div class="box-body"> <div class="box-body">
<div class="form-group"> <div class="form-group">
@ -53,6 +53,13 @@
</div> </div>
<p class="text-muted small">Each <em>physical</em> core on the system is considered to be <code>100%</code>. Setting this value to <code>0</code> will allow a server to use CPU time without restrictions.</p> <p class="text-muted small">Each <em>physical</em> core on the system is considered to be <code>100%</code>. Setting this value to <code>0</code> will allow a server to use CPU time without restrictions.</p>
</div> </div>
<div class="form-group">
<label for="threads" class="control-label">CPU Threads</label>
<div class="input-group">
<input type="text" name="threads" class="form-control" value="{{ old('threads', $server->threads) }}"/>
<span class="input-group-addon"></span>
</div>
</div>
<div class="form-group"> <div class="form-group">
<label for="io" class="control-label">Block IO Proportion</label> <label for="io" class="control-label">Block IO Proportion</label>
<div> <div>

View file

@ -73,6 +73,10 @@
<td>CPU Limit</td> <td>CPU Limit</td>
<td><code>{{ $server->cpu }}%</code></td> <td><code>{{ $server->cpu }}%</code></td>
</tr> </tr>
<tr>
<td>CPU Threads</td>
<td><code>{{ $server->threads }}</code></td>
</tr>
<tr> <tr>
<td>Default Connection</td> <td>Default Connection</td>
<td><code>{{ $server->allocation->ip }}:{{ $server->allocation->port }}</code></td> <td><code>{{ $server->allocation->ip }}:{{ $server->allocation->port }}</code></td>