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([
'allocation_id', 'add_allocations', 'remove_allocations',
'memory', 'swap', 'io', 'cpu', 'disk',
'memory', 'swap', 'io', 'cpu', 'threads', 'disk',
'database_limit', 'allocation_limit', 'oom_disabled',
]));
$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.disk' => $rules['disk'],
'limits.io' => $rules['io'],
'limits.threads' => $rules['threads'],
'limits.cpu' => $rules['cpu'],
// Application Resource Limits
@ -96,6 +97,7 @@ class StoreServerRequest extends ApplicationApiRequest
'disk' => array_get($data, 'limits.disk'),
'io' => array_get($data, 'limits.io'),
'cpu' => array_get($data, 'limits.cpu'),
'threads' => array_get($data, 'limits.threads'),
'skip_scripts' => array_get($data, 'skip_scripts', false),
'allocation_id' => array_get($data, 'allocation.default'),
'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.io' => $this->requiredToOptional('io', $rules['io'], 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),
// Legacy rules to maintain backwards compatable API support without requiring
@ -35,6 +36,7 @@ class UpdateServerBuildConfigurationRequest extends ServerWriteRequest
'swap' => $this->requiredToOptional('swap', $rules['swap']),
'io' => $this->requiredToOptional('io', $rules['io']),
'cpu' => $this->requiredToOptional('cpu', $rules['cpu']),
'threads' => $this->requiredToOptional('threads', $rules['threads']),
'disk' => $this->requiredToOptional('disk', $rules['disk']),
'add_allocations' => 'bail|array',

View File

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

View File

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

View File

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

View File

@ -160,6 +160,13 @@
<span class="input-group-addon">%</span>
</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">
<label for="pIO">Block IO Weight</label>
<div class="input-group">

View File

@ -26,7 +26,7 @@
<div class="col-sm-5">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">System Resources</h3>
<h3 class="box-title">Resource Management</h3>
</div>
<div class="box-body">
<div class="form-group">
@ -53,6 +53,13 @@
</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>
</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">
<label for="io" class="control-label">Block IO Proportion</label>
<div>

View File

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