#5010 -- Add "Performance Mode" option for Liquidsoap advanced config.
This commit is contained in:
parent
63d10b00c9
commit
98ca050190
|
@ -232,16 +232,16 @@
|
|||
</template>
|
||||
|
||||
<b-form-row>
|
||||
<b-wrapped-form-group class="col-md-6" id="edit_form_backend_telnet_port"
|
||||
:field="form.backend_config.telnet_port" input-type="number"
|
||||
:input-attrs="{ min: '0' }" advanced>
|
||||
<b-wrapped-form-checkbox class="col-md-6"
|
||||
id="edit_form_backend_use_manual_autodj"
|
||||
:field="form.backend_config.use_manual_autodj" advanced>
|
||||
<template #label="{lang}">
|
||||
<translate :key="lang">Customize Internal Request Processing Port</translate>
|
||||
<translate :key="lang">Manual AutoDJ Mode</translate>
|
||||
</template>
|
||||
<template #description="{lang}">
|
||||
<translate :key="lang">This port is not used by any external process. Only modify this port if the assigned port is in use. Leave blank to automatically assign a port.</translate>
|
||||
<translate :key="lang">This mode disables AzuraCast's AutoDJ management, using Liquidsoap itself to manage song playback. "Next Song" and some other features will not be available.</translate>
|
||||
</template>
|
||||
</b-wrapped-form-group>
|
||||
</b-wrapped-form-checkbox>
|
||||
|
||||
<b-wrapped-form-checkbox class="col-md-6"
|
||||
id="edit_form_backend_enable_replaygain_metadata"
|
||||
|
@ -254,6 +254,17 @@
|
|||
</template>
|
||||
</b-wrapped-form-checkbox>
|
||||
|
||||
<b-wrapped-form-group class="col-md-6" id="edit_form_backend_telnet_port"
|
||||
:field="form.backend_config.telnet_port" input-type="number"
|
||||
:input-attrs="{ min: '0' }" advanced>
|
||||
<template #label="{lang}">
|
||||
<translate :key="lang">Customize Internal Request Processing Port</translate>
|
||||
</template>
|
||||
<template #description="{lang}">
|
||||
<translate :key="lang">This port is not used by any external process. Only modify this port if the assigned port is in use. Leave blank to automatically assign a port.</translate>
|
||||
</template>
|
||||
</b-wrapped-form-group>
|
||||
|
||||
<b-wrapped-form-group class="col-md-6" id="edit_form_backend_autodj_queue_length"
|
||||
:field="form.backend_config.autodj_queue_length" input-type="number"
|
||||
:input-attrs="{ min: '2', max: '25' }" advanced>
|
||||
|
@ -265,17 +276,6 @@
|
|||
</template>
|
||||
</b-wrapped-form-group>
|
||||
|
||||
<b-wrapped-form-checkbox class="col-md-6"
|
||||
id="edit_form_backend_use_manual_autodj"
|
||||
:field="form.backend_config.use_manual_autodj" advanced>
|
||||
<template #label="{lang}">
|
||||
<translate :key="lang">Manual AutoDJ Mode</translate>
|
||||
</template>
|
||||
<template #description="{lang}">
|
||||
<translate :key="lang">This mode disables AzuraCast's AutoDJ management, using Liquidsoap itself to manage song playback. "Next Song" and some other features will not be available.</translate>
|
||||
</template>
|
||||
</b-wrapped-form-checkbox>
|
||||
|
||||
<b-wrapped-form-group class="col-md-6" id="edit_form_backend_charset"
|
||||
:field="form.backend_config.charset" advanced>
|
||||
<template #label="{lang}">
|
||||
|
@ -291,6 +291,21 @@
|
|||
</template>
|
||||
</b-wrapped-form-group>
|
||||
|
||||
<b-wrapped-form-group class="col-md-6" id="edit_form_backend_performance_mode"
|
||||
:field="form.backend_config.performance_mode" advanced>
|
||||
<template #label="{lang}">
|
||||
<translate :key="lang">Liquidsoap Performance Tuning</translate>
|
||||
</template>
|
||||
<template #description="{lang}">
|
||||
<translate :key="lang">If your installation is constrained by CPU or memory, you can change this setting to tune the resources used by Liquidsoap.</translate>
|
||||
</template>
|
||||
<template #default="props">
|
||||
<b-form-radio-group stacked :id="props.id" :options="performanceModeOptions"
|
||||
v-model="props.field.$model">
|
||||
</b-form-radio-group>
|
||||
</template>
|
||||
</b-wrapped-form-group>
|
||||
|
||||
<b-wrapped-form-group class="col-md-6" id="edit_form_backend_duplicate_prevention_time_range"
|
||||
:field="form.backend_config.duplicate_prevention_time_range"
|
||||
input-type="number" :input-attrs="{ min: '0', max: '1440' }" advanced>
|
||||
|
@ -398,6 +413,22 @@ export default {
|
|||
{text: 'UTF-8', value: 'UTF-8'},
|
||||
{text: 'ISO-8859-1', value: 'ISO-8859-1'}
|
||||
];
|
||||
},
|
||||
performanceModeOptions() {
|
||||
return [
|
||||
{
|
||||
text: this.$gettext('Use Less Memory (Uses More CPU)'),
|
||||
value: 'less_memory'
|
||||
},
|
||||
{
|
||||
text: this.$gettext('Balanced'),
|
||||
value: 'balanced'
|
||||
},
|
||||
{
|
||||
text: this.$gettext('Use Less CPU (Uses More Memory)'),
|
||||
value: 'less_cpu'
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -155,6 +155,7 @@ export default {
|
|||
autodj_queue_length: {},
|
||||
use_manual_autodj: {},
|
||||
charset: {},
|
||||
performance_mode: {},
|
||||
duplicate_prevention_time_range: {},
|
||||
},
|
||||
},
|
||||
|
@ -291,6 +292,7 @@ export default {
|
|||
autodj_queue_length: 3,
|
||||
use_manual_autodj: false,
|
||||
charset: 'UTF-8',
|
||||
performance_mode: 'balanced',
|
||||
duplicate_prevention_time_range: 120,
|
||||
},
|
||||
};
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
// phpcs:ignoreFile
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Entity\Enums;
|
||||
|
||||
enum StationBackendPerformanceModes: string
|
||||
{
|
||||
case LessMemory = 'less_memory';
|
||||
case LessCpu = 'less_cpu';
|
||||
case Balanced = 'balanced';
|
||||
|
||||
public static function default(): self
|
||||
{
|
||||
return self::Balanced;
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Entity\Enums\StationBackendPerformanceModes;
|
||||
use App\Radio\Enums\StreamFormats;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
|
@ -208,4 +209,27 @@ class StationBackendConfiguration extends ArrayCollection
|
|||
{
|
||||
$this->set(self::DUPLICATE_PREVENTION_TIME_RANGE, $duplicatePreventionTimeRange);
|
||||
}
|
||||
|
||||
public const PERFORMANCE_MODE = 'performance_mode';
|
||||
|
||||
public function getPerformanceMode(): string
|
||||
{
|
||||
return $this->getPerformanceModeEnum()->value;
|
||||
}
|
||||
|
||||
public function getPerformanceModeEnum(): StationBackendPerformanceModes
|
||||
{
|
||||
return StationBackendPerformanceModes::tryFrom($this->get(self::PERFORMANCE_MODE) ?? '')
|
||||
?? StationBackendPerformanceModes::default();
|
||||
}
|
||||
|
||||
public function setPerformanceMode(?string $performanceMode): void
|
||||
{
|
||||
$perfModeEnum = StationBackendPerformanceModes::tryFrom($performanceMode ?? '');
|
||||
if (null === $perfModeEnum) {
|
||||
$this->set(self::PERFORMANCE_MODE, null);
|
||||
} else {
|
||||
$this->set(self::PERFORMANCE_MODE, $perfModeEnum->value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,6 +135,14 @@ class ConfigWriter implements EventSubscriberInterface
|
|||
->withPath('/api/internal/' . $station->getId())
|
||||
);
|
||||
|
||||
$backendConfig = $station->getBackendConfig();
|
||||
|
||||
$gcSpaceOverhead = match ($backendConfig->getPerformanceModeEnum()) {
|
||||
Entity\Enums\StationBackendPerformanceModes::LessMemory => 20,
|
||||
Entity\Enums\StationBackendPerformanceModes::LessCpu => 140,
|
||||
Entity\Enums\StationBackendPerformanceModes::Balanced => 80
|
||||
};
|
||||
|
||||
$event->appendBlock(
|
||||
<<<EOF
|
||||
init.daemon.set(false)
|
||||
|
@ -158,6 +166,12 @@ class ConfigWriter implements EventSubscriberInterface
|
|||
autodj_ping_attempts = ref(0)
|
||||
ignore(autodj_ping_attempts)
|
||||
|
||||
# Performance Mode
|
||||
runtime.gc.set(runtime.gc.get().{
|
||||
space_overhead = ${gcSpaceOverhead},
|
||||
allocation_policy = 2
|
||||
})
|
||||
|
||||
# Track live-enabled status script-wide for fades.
|
||||
live_enabled = ref(false)
|
||||
ignore(live_enabled)
|
||||
|
|
Loading…
Reference in New Issue