From e0ae5a7aea6f90ca37024140d4ff5e2670d80591 Mon Sep 17 00:00:00 2001 From: Jose Quintana Date: Sun, 30 Apr 2023 23:25:19 +0200 Subject: [PATCH] docs: blocking threads feature page missing [skip ci] --- docs/content/features/blocking-threads.md | 17 +++++++++++++++++ docs/content/features/worker-threads.md | 7 ++++++- docs/mkdocs.yml | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 docs/content/features/blocking-threads.md diff --git a/docs/content/features/blocking-threads.md b/docs/content/features/blocking-threads.md new file mode 100644 index 0000000..986ac81 --- /dev/null +++ b/docs/content/features/blocking-threads.md @@ -0,0 +1,17 @@ +# Blocking Threads Customization + +**SWS** allows limiting the number of blocking threads powered by the [Tokio](https://tokio.rs/) runtime. + +This feature can be controlled by the numeric `-b, --max-blocking-threads` option or the equivalent [SERVER_MAX_BLOCKING_THREADS](./../configuration/environment-variables.md#server_max_blocking_threads) env. + +!!! info "WebAssembly" + We use `20` in [Wasm](https://webassembly.org/) by default and `512` in native environments (Tokio's default). See [Tokio ` max_blocking_threads` API](https://docs.rs/tokio/latest/tokio/runtime/struct.Builder.html#method.max_blocking_threads) for more details. + +Below is an example. + +```sh +static-web-server \ + --port 8787 \ + --root ./my-public-dir \ + --max-blocking-threads 20 +``` diff --git a/docs/content/features/worker-threads.md b/docs/content/features/worker-threads.md index da02959..a034e9d 100644 --- a/docs/content/features/worker-threads.md +++ b/docs/content/features/worker-threads.md @@ -2,6 +2,8 @@ **SWS** allows customizing the number of worker threads powered by the [Tokio](https://tokio.rs/) runtime. +See [Tokio ` worker_threads` API](https://docs.rs/tokio/latest/tokio/runtime/struct.Builder.html#method.worker_threads). + This feature can be controlled by the numeric `-n, --threads-multiplier` option or the equivalent [SERVER_THREADS_MULTIPLIER](./../configuration/environment-variables.md#server_threads_multiplier) env. ## Worker threads multiplier @@ -21,8 +23,11 @@ The formula used is the following: !!! tip "Tip" When the `--threads-multiplier` input value is `0` or `1` then one thread per core is used (default value). +!!! info "WebAssembly" + We use `2` threads per core in [Wasm](https://webassembly.org/) and `1` in native environments by default. + !!! warn "Warn" - The number of worker threads result should be a number between `1` and `32,768` though it is advised to keep this value on the smaller side. See [Tokio ` worker_threads` API](https://docs.rs/tokio/1.12.0/tokio/runtime/struct.Builder.html#method.worker_threads) for more details. + The number of worker threads resulted should be a number between `1` and `32,768` though it is advised to keep this value on the smaller side. See [Tokio ` worker_threads` API](https://docs.rs/tokio/latest/tokio/runtime/struct.Builder.html#method.worker_threads) for more details. Below is an example of how to adjust the number of worker threads. diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index af79aa2..b8ea386 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -139,6 +139,7 @@ nav: - 'Graceful Shutdown': 'features/graceful-shutdown.md' - 'File Descriptor Socket Passing': './features/file-descriptor-socket-passing.md' - 'Worker Threads Customization': 'features/worker-threads.md' + - 'Blocking Threads Customization': 'features/blocking-threads.md' - 'Error Pages': 'features/error-pages.md' - 'Custom HTTP Headers': 'features/custom-http-headers.md' - 'URL Rewrites': 'features/url-rewrites.md' -- libgit2 1.7.2