Commit eaf59de9 authored by Siebers, Michael's avatar Siebers, Michael
Browse files

configure number of worker threads (daemon mode)

parent 4a58dd8c
......@@ -155,7 +155,12 @@ opt_spec([
type(atom),
longflags([user]),
help(['When started as root to open a port below 1000, this option must be provided to switch to the target user for operating the server.'])
]
],
[opt(workers),
type(integer),
default(5),
longflags([workers]),
help('Determine the number of worker threads. Default is 5. This is fine for small scale usage.')]
]) :-
setting_property(web_api:log, default(Log)),
setting_property(web_api:debug, default(DBG)).
......@@ -86,6 +86,7 @@ The _daemon_ mode supports all options of the _interactive_ mode. Additionally,
| --outfile | | The file additional prolog output is stored in | _equivalent to_ =|/dev/null|= |
| --shutdown | | Shuts down a running server. Ignores all options except =|--pidfile|= | `false` |
| --user | | When started as root, this option must be provided to switch to the target user for operating the server. | `none` |
| --workers | | Determine the number of worker threads. Default is fine for small scale usage. | 5 |
When starting the server, predicates loaded from the irrelevance template file are reported. On successful startup further messages are discarded or writen to the file denoted with =|--outfile|=.
......
......@@ -26,6 +26,7 @@ start_server() {
--log "${LOG_FILE}" \
--port ${PORT:-80} \
--outfile "${OUT_FILE:-/dev/null}"
--workers "${WORKERS:-10}"
}
......
......@@ -147,13 +147,14 @@ The daemon in the container may not be configured with command line arguments, b
| LOG_FILE | Location to place the servers log file | webapi.log |
| OUT_FILE | Location to store the Prolog output after successful start. | /dev/null |
| PORT | The port to serve. | 80 |
| WORKERS | Determine the number of worker threads. Default is fine for medium scale usage. | 10 |
_Please note_: The daemon starts up as user root. After startup, the daemon drops root priviledges and continues as user webapi. Thus, the locations `LOG_FILE` and `OUT_FILE` must be writeable for user webapi (by default only the main working directory `/app`).
For example, to serve on port 8080 and to store the Prolog output in file `/app/output`:
For example, to serve on port 8080 using 20 worker threads and to store the Prolog output in file `/app/output`:
```bash
docker run -e PORT=8080 -e OUT_FILE=output \
docker run -e PORT=8080 -e OUT_FILE=output -e WORKERS=20 \
docker-registry.rz.uni-bamberg.de/cogsys/dare2del/demonstrator/webapi
```
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment