-
Notifications
You must be signed in to change notification settings - Fork 1
/
uwsgi.ini
125 lines (102 loc) · 4.18 KB
/
uwsgi.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# vim: set syntax=dosini ts=4 sw=4 et:
[uwsgi]
master = true
lazy-apps = true
thunder-lock = true
manage-script-name = true
# ** USER-PROVIDED **
# Graphite Stats Collection
# To collect statistics for an application the SERVICE and ENV
# variables below must be defined.
# Stats will be reported in the format:
# uwsgi.<hostname>.<NYPR_UWSGI_SERVICE>-<ENV>.*
set-ph = graphite-host=graphite.nypr.digital:2003
if-env = ENV
carbon = %(graphite-host)
carbon-id = $(SERVICE).$(ENV)
carbon-hostname-dots = _
carbon-resolve-names = true
carbon-use-metrics = true
enable-metrics = true
memory-report = true
endif =
# Processes defines the maximum number of workers a single uWSGI application
# can spawn. A safe value can be estimated using the following formula:
# ⌊(total_mem) / (avg_rss_per_worker)⌋
# Override this value by setting UWSGI_PROCESSES.
processes = 4
# The minimum number of workers is defined by <cheaper>.
# The number of starting workers is defined by <initial>.
# Scaling operations will increment the number of workers by <step>.
# Override these values by setting UWSGI_CHEAPER(|-initial|-step).
cheaper = 1
cheaper-initial = 2
cheaper-step = 1
# These are required for newrelic
# and to avoid issues with third party C libraries.
single-interpreter = true
enable-threads = true
# When clients disconnect early 'junk' exceptions
# are reported to sentry. These three directives will
# reduce the noise.
ignore-sigpipe = true
ignore-write-errors = true
disable-write-exception = true
if-env = VIRTUAL_ENV
home = %(_)
endif =
http = :8080
set-ph = socket-dir=/tmp
stats = %(socket-dir)/%N_stats.sock
chmod-socket = 664
vacuum = true
# Workers will be reloaded after 5000 requests served
# to avoid complications due to memory leaks.
max-requests = 5000
# Workers will be restarted if they do not respond within 5 minutes
# to avoid worker pool reduction due to unsafe IO (no timeout).
harakiri = 300
## uWSGI Auto Scaling
# The busyness algorithm requires the cheaper_busyness plugin.
# Busyness is a smoother scaling algorithm than the built-ins.
cheaper-algo = busyness
cheaper-busyness-verbose = false
## Scaling Based On Worker Busyness
# Busyness is calculated every 30 seconds.
# If a worker's busyness is under the <busyness-min> for <busyness-multiplier>
# consecutive checks <overload> seconds apart it will be retired.
# If a worker's busyness is over the <busyness-max> for <busyness-multiplier>
# consecutive checks <overload> seconds apart it will be retired.
cheaper-overload = 30
cheaper-busyness-multiplier = 10
cheaper-busyness-min = 20
cheaper-busyness-max = 65
# The <busyness-penalty> is an additional number of seconds to append to
# the <busyness-multiplier> value, increasing the time between scaling events
# to allow the new workers to try to balance the workload.
cheaper-busyness-penalty = 2
## Scaling Based On Backlog Length
# Scaling based on the queue "backlog" addresses spikes in traffic without
# the need to wait for the long cheaper-overload cycles to complete.
# When the backlog is greater than <busyness-backlog-alert> for
# <busyness-backlog-multiplier> consecutive checks <busyness-backlog-step>
# workers will be spawned. Checks occur every 1s.
# The <busyness-backlog-nonzero> directive handles cases where a single worker
# may be stuck handling a long request. If the worker is held-up for the
# specified duration an additional worker will be spawned.
cheaper-busyness-backlog-alert = 33
cheaper-busyness-backlog-multiplier = 3
cheaper-busyness-backlog-step = 1
cheaper-busyness-backlog-nonzero = 60
## Logging
threaded-logger = true
# The healthcheck logger discards healthcheck requests from Amazon ELBs
# and Varnish.
logger = healthcheck file:/dev/null
log-req-route = healthcheck ELB-HealthChecker/\d.\d
log-req-route = healthcheck varnish-probe
# Uses the real client ip, not the load balancer's.
log-x-forwarded-for = true
# The timestamp is written in a Logstash-consumable format to avoid further
# parsing.
log-format = timestamp:${strftime:%%Y-%%m-%%dT%%T%%z}|vhost:%(host)|clientip:%(addr)|user:%(user)|verb:%(method)|request:%(uri)|protocol:%(proto)|status:%(status)|size:%(size)|referrer:"%(referer)"|agent:"%(uagent)"|duration:%(micros)|rss:%(rssM)|worker:%(wid)|pid:%(pid)