docs: add speedups documentation

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2023-08-16 07:55:34 -04:00
parent ffbb628ce2
commit 82dd2f3c1f
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B
2 changed files with 31 additions and 0 deletions

View File

@ -23,6 +23,7 @@ The format is based on [Keep a Changelog].
- **server**: Command line options may also be specified as env variables
- **server**: Added a `route_prefix` option
- **webcam**: Webcam APIs can now specify cameras by `uid` or `name`
- **deps**: Added support for optional `msgspec` and `uvloop` packages
### Fixed

View File

@ -148,6 +148,9 @@ particularly for those upgrading:
Skips installation of [polkit rules](#policykit-permissions). This may be
necessary to install Moonraker on systems that do not have policykit
installed.
- `-s`:
Installs Moonraker's [speedup](#optional-speedups) Python packages in the
Python environment.
Additionally, installation may be customized with the following environment
variables:
@ -160,6 +163,7 @@ variables:
- `MOONRAKER_CONFIG_PATH`
- `MOONAKER_LOG_PATH`
- `MOONRAKER_DATA_PATH`
- `MOONRAKER_SPEEDUPS`
When the script completes it should start both Moonraker and Klipper. In
`klippy.log` you should find the following entry:
@ -414,6 +418,32 @@ MOONRAKER_ARGS="-m moonraker"
PYTHONPATH="/home/pi/moonraker"
```
# Optional Speedups
Moonraker supports two optional Python packages that can be used to reduce
its CPU load:
- [msgspec](https://github.com/jcrist/msgspec): Replaces the builtin `json`
encoder/decoder. Requires Python >= 3.8.
- [uvloop](https://github.com/MagicStack/uvloop/): Replaces the default asyncio
eventloop implementation.
If these packages are installed in Moonraker's python environment Moonraker will
load them. For existing installations this can be done manually with a command
like:
```
~/moonraker-env/bin/pip install -r ~/moonraker/scripts/moonraker-speedups.txt
```
After installing the speedup packages it is possible to revert back to the
default implementation by specifying one or both of the following
environment variables in [moonraker.env](#the-environment-file):
- `MOONRAKER_ENABLE_MSGSPEC="n"`
- `MOONRAKER_ENABLE_UVLOOP="n"`
### PolicyKit Permissions
Some of Moonraker's components require elevated privileges to perform actions.