mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-31 04:41:56 -05:00
We've seen the SQLAlchemy "could not acquire connection" error in production during heavy traffic. Since we have more gunicorn eventlet workers than we have DB connections available some workers need to wait for a DB connection to become available before they can proceed with the request. There's a timeout set on how long a worker would wait and if that timeout is exceeded the above exception is raised. Currently, we're using at most 1000 out of 5000 max DB connections, 40% peak CPU usage on the DB instance and an average of 60% CPU on API instances during heavy load. The number of DB connections is proportionally similar in preview and staging. This slightly increases the number of max DB connections per API instance. This should improve our utilization of API instances by increasing the number of workers that can communicate with the DB concurrently while staying well within the max DB connections limit.
68 lines
1.3 KiB
YAML
68 lines
1.3 KiB
YAML
---
|
|
|
|
buildpack: python_buildpack
|
|
command: unset GUNICORN_CMD_ARGS; scripts/run_app_paas.sh gunicorn -c /home/vcap/app/gunicorn_config.py application
|
|
|
|
services:
|
|
- notify-db
|
|
- logit-ssl-syslog-drain
|
|
|
|
env:
|
|
NOTIFY_APP_NAME: public-api
|
|
CW_APP_NAME: api
|
|
# required by cf run-task
|
|
FLASK_APP: application.py
|
|
SQLALCHEMY_POOL_SIZE: 20
|
|
|
|
# Credentials variables
|
|
ADMIN_BASE_URL: null
|
|
ADMIN_CLIENT_SECRET: null
|
|
API_HOST_NAME: null
|
|
DANGEROUS_SALT: null
|
|
SECRET_KEY: null
|
|
ROUTE_SECRET_KEY_1: null
|
|
ROUTE_SECRET_KEY_2: null
|
|
CRONITOR_KEYS: null
|
|
|
|
PERFORMANCE_PLATFORM_ENDPOINTS: null
|
|
|
|
NOTIFICATION_QUEUE_PREFIX: null
|
|
AWS_ACCESS_KEY_ID: null
|
|
AWS_SECRET_ACCESS_KEY: null
|
|
|
|
STATSD_PREFIX: null
|
|
|
|
ZENDESK_API_KEY: null
|
|
|
|
MMG_URL: null
|
|
MMG_API_KEY: null
|
|
MMG_INBOUND_SMS_AUTH: null
|
|
MMG_INBOUND_SMS_USERNAME: null
|
|
|
|
FIRETEXT_API_KEY: null
|
|
LOADTESTING_API_KEY: null
|
|
FIRETEXT_INBOUND_SMS_AUTH: null
|
|
|
|
REDIS_ENABLED: null
|
|
REDIS_URL: null
|
|
|
|
TEMPLATE_PREVIEW_API_HOST: null
|
|
TEMPLATE_PREVIEW_API_KEY: null
|
|
|
|
DOCUMENT_DOWNLOAD_API_HOST: null
|
|
DOCUMENT_DOWNLOAD_API_KEY: null
|
|
|
|
instances: 1
|
|
memory: 1G
|
|
disk_quota: 2G
|
|
|
|
applications:
|
|
- name: notify-api
|
|
|
|
- name: notify-api-db-migration
|
|
command: sleep infinity
|
|
no-route: true
|
|
health-check-type: none
|
|
instances: 1
|
|
memory: 128M
|