Skip to content
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

allow configuration of uwsgi timeout #2018

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions config/crd/bases/awx.ansible.com_awxs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1730,6 +1730,9 @@ spec:
uwsgi_listen_queue_size:
description: Set the socket listen queue size for uwsgi
type: integer
uwsgi_timeout:
description: Set the timeout for requests served by uwsgi. (note, graceful exit signal sent 2 seconds prior to timeout)
type: integer
nginx_worker_processes:
description: Set the number of workers for nginx
type: integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,12 @@ spec:
- urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:com.tectonic.ui:number
- urn:alm:descriptor:com.tectonic.ui:hidden
- displayName: Uwsgi Timeout
path: uwsgi_timeout
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:com.tectonic.ui:number
- urn:alm:descriptor:com.tectonic.ui:hidden
- displayName: Uwsgi Processes
path: uwsgi_processes
x-descriptors:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,16 @@ spec:

## Custom UWSGI Configuration

We allow the customization of two UWSGI parameters:
We allow the customization of three UWSGI parameters:

* [processes](https://uwsgi-docs.readthedocs.io/en/latest/Options.html#processes) with `uwsgi_processes` (default 5)
* [listen](https://uwsgi-docs.readthedocs.io/en/latest/Options.html#listen) with `uwsgi_listen_queue_size` (default 128)
* [harakiri](https://uwsgi-docs.readthedocs.io/en/latest/Options.html#harakiri) with `uwsgi_timeout` (default 30)

**Note:** Increasing the listen queue beyond 128 requires that the sysctl setting net.core.somaxconn be set to an equal value or higher.
The operator will set the appropriate securityContext sysctl value for you, but it is a required that this sysctl be added to an allowlist on the kubelet level. [See kubernetes docs about allowing this sysctl setting](https://kubernetes.io/docs/tasks/administer-cluster/sysctl-cluster/#enabling-unsafe-sysctls).

These vars relate to the vertical and horizontal scalibility of the web service.
The `processes` and `listen` vars relate to the vertical and horizontal scalibility of the web service.

Increasing the number of processes allows more requests to be actively handled
per web pod, but will consume more CPU and Memory and the resource requests
Expand All @@ -89,6 +90,12 @@ requests (more than 128) tend to come in a short period of time, but can all be
handled before any other time outs may apply. Also see related nginx
configuration.

The `uwsgi_timeout` variable determines after how many seconds a request will
be forecibly killed by uwsgi. A "graceful" timeout signal is sent to the worker
2 seconds prior to attempt to get a traceback of what may be causing the
request to hang.


## Custom Nginx Configuration

Using the [extra_volumes feature](#custom-volume-and-volume-mount-options), it is possible to extend the nginx.conf.
Expand Down
1 change: 1 addition & 0 deletions roles/installer/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ uwsgi_processes: 5
# Also see https://kubernetes.io/docs/tasks/administer-cluster/sysctl-cluster/#enabling-unsafe-sysctls for how
# to allow setting this sysctl, which requires kubelet configuration to add to allowlist
uwsgi_listen_queue_size: 128
uwsgi_timeout: 30

# NGINX default values
nginx_worker_processes: 1
Expand Down
4 changes: 2 additions & 2 deletions roles/installer/templates/configmaps/config.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ data:
max-requests = 1000
buffer-size = 32768

harakiri = 120
harakiri-graceful-timeout = 115
harakiri = {{ uwsgi_timeout|int }}
harakiri-graceful-timeout = {{ [(uwsgi_timeout|int - 2), 1] | max }}
harakiri-graceful-signal = 6
py-call-osafterfork = true

Expand Down
Loading