Skip to content

"workers" auto setup #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ Example:
| Object | Description |
| --- | --- |
| `type`| Type of the application (`go`).
| `workers` | Number of application workers.
| `workers` | Number of application workers (0 will try to set it to the number of the cpu cores).
| `executable` | Full path to compiled Go app.
| `user` (optional) | Username that runs the app process. If not specified, `nobody` is used.
| `group` (optional) | Group name that runs the app process. If not specified, user's primary group is used.
Expand All @@ -721,7 +721,7 @@ Example:
| Object | Description |
| --- | --- |
| `type`| Type of the application (`php`).
| `workers` | Number of application workers.
| `workers` | Number of application workers (0 will try to set it to the number of the cpu cores).
| `root` | Directory to search for PHP files.
| `index` | Default launch file when the PHP file name is not specified in the URL.
| `script` (optional) | File that Unit runs for every URL, instead of searching for a file in the filesystem. The location is relative to the root.
Expand All @@ -746,7 +746,7 @@ Example:
| Object | Description |
| --- | --- |
| `type`| Type of the application (`python`).
| `workers` | Number of application workers.
| `workers` | Number of application workers (0 will try to set it to the number of the cpu cores).
| `path` | Path to search for the **wsgi.py** file.
| `module` | Required. Currently the only supported value is `wsgi`.
| `user` (optional) | Username that runs the app process. If not specified, `nobody` is used.
Expand Down
7 changes: 7 additions & 0 deletions src/nxt_router.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,13 @@ nxt_router_conf_create(nxt_task_t *task, nxt_router_temp_conf_t *tmcf,
goto app_fail;
}

if (apcf.workers == 0) {
if (nxt_ncpu > 0)
apcf.workers = nxt_ncpu;
else
apcf.workers = 1;
}

nxt_debug(task, "application type: %V", &apcf.type);
nxt_debug(task, "application workers: %D", apcf.workers);

Expand Down