From 4361ed12e0eaa8429698d4c7844acec11f845a17 Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 15 Jul 2015 15:22:08 -0500 Subject: [PATCH] Container create/system tuning This change has shown to improve general performance and system stability. Ubuntu 14.04 has some systemD bits within it and there are a few items that can be tuned. These changes add some additional in container tuning the ensure that the pseudo systemD availability within our containers is not impeding container performance. Additionally the netfilter for bridged interfaces was set to 0 which should also improve bridge performance in general. Change-Id: Iad4f0472cf3e38c95c04b29cee8433c0781ff9ff --- .../tasks/container_create.yml | 24 +++++++++++++++++++ .../lxc_container_create/templates/autodev.j2 | 5 ++++ .../roles/openstack_hosts/defaults/main.yml | 3 +++ 3 files changed, 32 insertions(+) create mode 100644 playbooks/roles/lxc_container_create/templates/autodev.j2 diff --git a/playbooks/roles/lxc_container_create/tasks/container_create.yml b/playbooks/roles/lxc_container_create/tasks/container_create.yml index b5ab2252e1..65a08ad895 100644 --- a/playbooks/roles/lxc_container_create/tasks/container_create.yml +++ b/playbooks/roles/lxc_container_create/tasks/container_create.yml @@ -45,10 +45,22 @@ - "/openstack/{{ inventory_hostname }}" - "/openstack/backup/{{ inventory_hostname }}" - "/openstack/log/{{ inventory_hostname }}" + - "{{ lxc_container_directory }}/{{ inventory_hostname }}" delegate_to: "{{ physical_host }}" tags: - lxc-container-directories +- name: LXC autodev setup + template: + src: "autodev.j2" + dest: "/var/lib/lxc/{{ inventory_hostname }}/autodev" + owner: "root" + group: "root" + mode: "0755" + delegate_to: "{{ physical_host }}" + tags: + - lxc-container-autodev + - name: Create container lxc_container: name: "{{ inventory_hostname }}" @@ -63,7 +75,19 @@ vg_name: "{{ properties.container_vg_name|default(lxc_container_vg_name) }}" template_options: "{{ lxc_container_template_options }}" container_command: | + if [ -f "/usr/lib/systemd/system/poweroff.target" ];then + ln -sf /usr/lib/systemd/system/poweroff.target /etc/systemd/system/sigpwr.target || true + fi + ln -s /dev/null /etc/systemd/system/systemd-udevd.service || true + ln -s /dev/null /etc/systemd/system/systemd-udevd-control.socket || true + ln -s /dev/null /etc/systemd/system/systemd-udevd-kernel.socket || true + ln -s /dev/null /etc/systemd/system/proc-sys-fs-binfmt_misc.automount || true echo -e '{{ lxc_container_default_interfaces }}' | tee /etc/network/interfaces + container_config: + - "lxc.autodev=1" + - "lxc.pts=1024" + - "lxc.kmsg=0" + - "lxc.hook.autodev=/var/lib/lxc/{{ inventory_hostname }}/autodev" delegate_to: "{{ physical_host }}" tags: - lxc-container-create diff --git a/playbooks/roles/lxc_container_create/templates/autodev.j2 b/playbooks/roles/lxc_container_create/templates/autodev.j2 new file mode 100644 index 0000000000..259f15e7f5 --- /dev/null +++ b/playbooks/roles/lxc_container_create/templates/autodev.j2 @@ -0,0 +1,5 @@ +#!/bin/bash +cd ${LXC_ROOTFS_MOUNT}/dev +mkdir net +mknod net/tun c 10 200 +chmod 0666 net/tun diff --git a/playbooks/roles/openstack_hosts/defaults/main.yml b/playbooks/roles/openstack_hosts/defaults/main.yml index 59963c1d1b..b1a52e5144 100644 --- a/playbooks/roles/openstack_hosts/defaults/main.yml +++ b/playbooks/roles/openstack_hosts/defaults/main.yml @@ -92,6 +92,9 @@ openstack_kernel_options: - { key: 'vm.dirty_background_ratio', value: 5 } - { key: 'vm.dirty_ratio', value: 10 } - { key: 'vm.swappiness', value: 5 } + - { key: 'net.bridge.bridge-nf-call-ip6tables', value: 0 } + - { key: 'net.bridge.bridge-nf-call-iptables', value: 0 } + - { key: 'net.bridge.bridge-nf-call-arptables', value: 0 } - { key: 'net.ipv4.neigh.default.gc_thresh1', value: "{{ set_gc_val | int // 2 }}" } - { key: 'net.ipv4.neigh.default.gc_thresh2', value: "{{ set_gc_val | int }}" } - { key: 'net.ipv4.neigh.default.gc_thresh3', value: "{{ set_gc_val | int * 2 }}" }