Ensure the components are isolated from the system

This creates a specific slice which all OpenStack services will operate
from. By creating an independent slice these components will be governed
away from the system slice allowing us to better optimise resource
consumption.

See the following for more information on slices:

* https://www.freedesktop.org/software/systemd/man/systemd.slice.html

See for following for more information on resource controls:

* https://www.freedesktop.org/software/systemd/man/systemd.resource-control.html

Tools like ``systemd-cgtop`` and ``systemd-cgls`` will now give us
insight into specific processes, process groups, and resouce consumption
in ways that we've not had access to before. To enable some of this reporting
the accounting options have been added to the [Service] section of the unit
file.

Change-Id: I619ab58574eedece7e00e323f91aeaec4c5b5a6e
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2017-03-28 18:19:27 -05:00 committed by Kevin Carter (cloudnull)
parent e77eed1228
commit 2746142b68
4 changed files with 27 additions and 1 deletions

View File

@ -117,17 +117,22 @@ monasca_use_mod_wsgi: false
monasca_api_metrics_driver: "monasca_api.common.repositories.influxdb.metrics_repository:MetricsRepository"
monasca_api_init_config_overrides: {}
monasca_log_api_init_config_overrides: {}
monasca_services:
monasca-api:
group: monasca_api
service_name: monasca-api
service_init_bin: "{{ monasca_bin }}/gunicorn"
service_init_options: "-n monasca-api -k eventlet --worker-connections=2000 --backlog=1000 --paste /etc/monasca/api-config.ini"
init_config_overrides: "{{ monasca_api_init_config_overrides }}"
monasca-log-api:
group: monasca_log_api
service_name: monasca-log-api
service_init_bin: "{{ monasca_bin }}/gunicorn"
service_init_options: "-n monasca-log-api -k eventlet --worker-connections=2000 --backlog=1000 --paste /etc/monasca/log-api-config.ini"
init_config_overrides: "{{ monasca_log_api_init_config_overrides }}"
monasca_requires_pip_packages:
- httplib2

View File

@ -0,0 +1,10 @@
---
features:
- New variables have been added to allow a deployer to customize
a monasca systemd unit file to their liking.
- The task dropping the monasca systemd unit files now uses the
``config_template`` action plugin allowing deployers access to
customize the unit files as they see fit without having to
load extra options into the defaults and polute the generic
systemd unit file with jinja2 variables and conditionals.

View File

@ -44,12 +44,14 @@
when: inventory_hostname in groups[item.value.group]
- name: Place the systemd init script
template:
config_template:
src: "monasca-systemd-init.j2"
dest: "/etc/systemd/system/{{ item.value.service_name }}.service"
mode: "0644"
owner: "root"
group: "root"
config_overrides: "{{ item.value.init_config_overrides }}"
config_type: "ini"
with_dict: "{{ monasca_services }}"
when: inventory_hostname in groups[item.value.group]
notify:

View File

@ -21,5 +21,14 @@ TimeoutSec=300
Restart=on-failure
RestartSec=150
# This creates a specific slice which all services will operate from
# The accounting options give us the ability to see resource usage through
# the `systemd-cgtop` command.
Slice=monasca.slice
CPUAccounting=true
BlockIOAccounting=true
MemoryAccounting=false
TasksAccounting=true
[Install]
WantedBy=multi-user.target