kolla-ansible/ansible/roles/monasca/templates/monasca-api/api.conf.j2
Pierre Riteau c81772024c Reduce the use of SQLAlchemy connection pooling
When the internal VIP is moved in the event of a failure of the active
controller, OpenStack services can become unresponsive as they try to
talk with MariaDB using connections from the SQLAlchemy pool.

It has been argued that OpenStack doesn't really need to use connection
pooling with MariaDB [1]. This commit reduces the use of connection
pooling via two configuration options:

- max_pool_size is set to 1 to allow only a single connection in the
  pool (it is not possible to disable connection pooling entirely via
  oslo.db, and max_pool_size = 0 means unlimited pool size)
- lower connection_recycle_time from the default of one hour to 10
  seconds, which means the single connection in the pool will be
  recreated regularly

These settings have shown better reactivity of the system in the event
of a failover.

[1] http://lists.openstack.org/pipermail/openstack-dev/2015-April/061808.html

Change-Id: Ib6a62d4428db9b95569314084090472870417f3d
Closes-Bug: #1896635
2020-09-22 17:54:45 +02:00

72 lines
3.0 KiB
Django/Jinja

[DEFAULT]
log_file = monasca-api.log
log_dir = /var/log/kolla/monasca
debug = {{ monasca_logging_debug }}
region = {{ openstack_region_name }}
enable_logs_api = True
[database]
database = {{ monasca_database_name }}
connection = mysql+pymysql://{{ monasca_database_user }}:{{ monasca_database_password }}@{{ monasca_database_address | put_address_in_context('url') }}:{{ monasca_database_port }}/{{ monasca_database_name }}
connection_recycle_time = {{ database_connection_recycle_time }}
max_pool_size = {{ database_max_pool_size }}
[influxdb]
database_name = {{ monasca_influxdb_name }}
ip_address = {{ monasca_influxdb_address }}
port = {{ monasca_influxdb_http_port }}
[kafka]
# NOTE(dszumski): This will become the default in Victoria and can then
# be removed: https://review.opendev.org/#/c/740954
legacy_kafka_client_enabled = False
metrics_topic = {{ monasca_metrics_topic }}
logs_topics = {{ monasca_raw_logs_topic }}
uri = {{ monasca_kafka_servers }}
[messaging]
driver = monasca_api.common.messaging.kafka_publisher:KafkaPublisher
[security]
default_authorized_roles = {{ monasca_default_authorized_roles|join(', ') }}
agent_authorized_roles = {{ monasca_agent_authorized_roles|join(', ') }}
read_only_authorized_roles = {{ monasca_read_only_authorized_roles|join(', ') }}
delegate_authorized_roles = {{ monasca_delegate_authorized_roles|join(', ') }}
[keystone_authtoken]
www_authenticate_uri = {{ keystone_internal_url }}
auth_url = {{ keystone_admin_url }}
auth_type = password
project_domain_id = {{ default_project_domain_id }}
user_domain_id = {{ default_user_domain_id }}
project_name = service
username = {{ monasca_keystone_user }}
password = {{ monasca_keystone_password }}
service_token_roles_required=True
cafile = {{ openstack_cacert }}
memcache_security_strategy = ENCRYPT
memcache_secret_key = {{ memcache_secret_key }}
memcached_servers = {{ monasca_memcached_servers }}
[dispatcher]
versions = monasca_api.v2.reference.versions:Versions
version_2_0 = monasca_api.v2.reference.version_2_0:Version2
metrics = monasca_api.v2.reference.metrics:Metrics
metrics_measurements = monasca_api.v2.reference.metrics:MetricsMeasurements
metrics_statistics = monasca_api.v2.reference.metrics:MetricsStatistics
metrics_names = monasca_api.v2.reference.metrics:MetricsNames
alarm_definitions = monasca_api.v2.reference.alarm_definitions:AlarmDefinitions
alarms = monasca_api.v2.reference.alarms:Alarms
alarms_count = monasca_api.v2.reference.alarms:AlarmsCount
alarms_state_history = monasca_api.v2.reference.alarms:AlarmsStateHistory
notification_methods = monasca_api.v2.reference.notifications:Notifications
dimension_values = monasca_api.v2.reference.metrics:DimensionValues
dimension_names = monasca_api.v2.reference.metrics:DimensionNames
notification_method_types = monasca_api.v2.reference.notificationstype:NotificationsType
healthchecks = monasca_api.healthchecks:HealthChecks
[log_publisher]
# Increase the maximum payload size to slightly above the default Fluentd chunk size (8MB)
max_log_size = 10485760