mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-15 17:52:26 -05:00
- Gunicorn can give us some interestings stats about what it is doing that might prove useful when trying to work out the gunicorn/eventlet/sqlalchemy kind of bottlenecking issues - We already ship these env vars to the app so this is a pretty easy change to make - Uses statsd which is UDP so it shouldn't have any performance impact on gunicorn
30 lines
759 B
Python
30 lines
759 B
Python
import os
|
|
import sys
|
|
import traceback
|
|
|
|
workers = 4
|
|
worker_class = "eventlet"
|
|
worker_connections = 256
|
|
errorlog = "/home/vcap/logs/gunicorn_error.log"
|
|
bind = "0.0.0.0:{}".format(os.getenv("PORT"))
|
|
statsd_host = "{}:8125".format(os.getenv("STATSD_HOST"))
|
|
statsd_prefix = os.getenv("STATSD_PREFIX")
|
|
|
|
|
|
def on_starting(server):
|
|
server.log.info("Starting Notifications API")
|
|
|
|
|
|
def worker_abort(worker):
|
|
worker.log.info("worker received ABORT {}".format(worker.pid))
|
|
for threadId, stack in sys._current_frames().items():
|
|
worker.log.error(''.join(traceback.format_stack(stack)))
|
|
|
|
|
|
def on_exit(server):
|
|
server.log.info("Stopping Notifications API")
|
|
|
|
|
|
def worker_int(worker):
|
|
worker.log.info("worker: received SIGINT {}".format(worker.pid))
|