From db4ad90762bd9df437a39950ad97173f65a93b64 Mon Sep 17 00:00:00 2001 From: Bjoern Teipel Date: Tue, 19 Apr 2016 16:03:23 -0500 Subject: [PATCH] Remove XFS filesystem from the daily mlocate cron job This fix removes the XFS filesystem from the daily cron job. It will help to remove unnecessary disk IO due to updatedb/mlocate swift object indexing inside the /srv/node folders. Change-Id: I8bfa92003ce06ee4f065663e054cd2d04f458ec6 Closes-Bug: #1572307 --- ...ure-xfs-from-mlocate-e4844e6c0469afd6.yaml | 5 +++++ tasks/swift_pre_install.yml | 10 +++++++++ templates/mlocate-crond-daily.sh.j2 | 21 +++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 releasenotes/notes/swift-reconfigure-xfs-from-mlocate-e4844e6c0469afd6.yaml create mode 100644 templates/mlocate-crond-daily.sh.j2 diff --git a/releasenotes/notes/swift-reconfigure-xfs-from-mlocate-e4844e6c0469afd6.yaml b/releasenotes/notes/swift-reconfigure-xfs-from-mlocate-e4844e6c0469afd6.yaml new file mode 100644 index 00000000..bb081338 --- /dev/null +++ b/releasenotes/notes/swift-reconfigure-xfs-from-mlocate-e4844e6c0469afd6.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - The XFS filesystem is excluded from the daily mlocate crond job + in order to conserve disk IO for large IOPS bursts due to + updatedb/mlocate file indexing. diff --git a/tasks/swift_pre_install.yml b/tasks/swift_pre_install.yml index 165f5f1e..ade9dcff 100644 --- a/tasks/swift_pre_install.yml +++ b/tasks/swift_pre_install.yml @@ -109,3 +109,13 @@ tags: - swift-dirs - swift-logs + +- name: Configure mlocate for cron.daily + template: + src: "mlocate-crond-daily.sh.j2" + dest: "/etc/cron.daily/mlocate" + mode: "0755" + owner: "root" + group: "root" + tags: + - swift-crond diff --git a/templates/mlocate-crond-daily.sh.j2 b/templates/mlocate-crond-daily.sh.j2 new file mode 100644 index 00000000..402d320f --- /dev/null +++ b/templates/mlocate-crond-daily.sh.j2 @@ -0,0 +1,21 @@ +#! /bin/bash +# {{ ansible_managed }} + +set -e + +[ -x /usr/bin/updatedb.mlocate ] || exit 0 + +if which on_ac_power >/dev/null 2>&1; then + ON_BATTERY=0 + on_ac_power >/dev/null 2>&1 || ON_BATTERY=$? + if [ "$ON_BATTERY" -eq 1 ]; then + exit 0 + fi +fi + +# See ionice(1) +if [ -x /usr/bin/ionice ] && /usr/bin/ionice -c3 true 2>/dev/null; then + IONICE="/usr/bin/ionice -c3" +fi + +flock --nonblock /run/mlocate.daily.lock $IONICE /usr/bin/updatedb.mlocate --prunefs xfs