From d00bff5ddb202d355ed39321f99f6bfc725ee7ac Mon Sep 17 00:00:00 2001 From: Guilhem Lettron Date: Thu, 22 Nov 2012 11:28:47 +0100 Subject: [PATCH] add recipe tuning set affinity to cpu 0 for haproxy process --- metadata.rb | 2 ++ recipes/tuning.rb | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 recipes/tuning.rb diff --git a/metadata.rb b/metadata.rb index 53081553..25ef4149 100644 --- a/metadata.rb +++ b/metadata.rb @@ -12,3 +12,5 @@ %w{ debian ubuntu }.each do |os| supports os end + +depends "cpu" diff --git a/recipes/tuning.rb b/recipes/tuning.rb new file mode 100644 index 00000000..017e4363 --- /dev/null +++ b/recipes/tuning.rb @@ -0,0 +1,25 @@ +# +# Cookbook Name:: haproxy +# Author:: Guilhem Lettron +# +# Copyright 2012, Societe Publica. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +include_recipe "cpu::affinity" + +cpu_affinity "set affinity for haproxy" do + pid node['haproxy']['pid_file'] + cpu 0 +end