From d4b335deddb7c9fea59d4a0a93520e8ecfedc1b0 Mon Sep 17 00:00:00 2001
From: Jerry Zhao <zhaoxinyu@huawei.com>
Date: Wed, 23 Jul 2014 10:20:53 -0700
Subject: [PATCH] Add timeout check and timeout queue with recommended value

There were also occurances that httpchk experienced timeout. Right
now we are using default value 2000ms. Try using 10s suggested by
the example config in openstack doc.

Related-bug: #1344144
Change-Id: I7a72d7a22a1845d1e2d480eee88246f980f87e6c
---
 chef/cookbooks/haproxy/attributes/default.rb             | 3 +++
 chef/cookbooks/haproxy/templates/default/haproxy.cfg.erb | 1 +
 2 files changed, 4 insertions(+)

diff --git a/chef/cookbooks/haproxy/attributes/default.rb b/chef/cookbooks/haproxy/attributes/default.rb
index 467e7ee..7230e0b 100644
--- a/chef/cookbooks/haproxy/attributes/default.rb
+++ b/chef/cookbooks/haproxy/attributes/default.rb
@@ -59,8 +59,11 @@ default['haproxy']['pid_file'] = "/var/run/haproxy.pid"
 default['haproxy']['defaults_options'] = ["tcpka", "httpchk", "tcplog", "httplog"]
 default['haproxy']['x_forwarded_for'] = false
 default['haproxy']['defaults_timeouts']['connect'] = "10s"
+default['haproxy']['defaults_timeouts']['check'] = "10s"
+default['haproxy']['defaults_timeouts']['queue'] = "100s"
 default['haproxy']['defaults_timeouts']['client'] = "100s"
 default['haproxy']['defaults_timeouts']['server'] = "100s"
+
 default['haproxy']['cookie'] = nil
 
 default['haproxy']['user'] = "haproxy"
diff --git a/chef/cookbooks/haproxy/templates/default/haproxy.cfg.erb b/chef/cookbooks/haproxy/templates/default/haproxy.cfg.erb
index 07d75dc..6b3475b 100644
--- a/chef/cookbooks/haproxy/templates/default/haproxy.cfg.erb
+++ b/chef/cookbooks/haproxy/templates/default/haproxy.cfg.erb
@@ -6,6 +6,7 @@ global
   maxconn <%= node['haproxy']['global_max_connections'] %>
   #debug
   #quiet
+  spread-checks     5
   user <%= node['haproxy']['user'] %>
   group <%= node['haproxy']['group'] %>
 <% if node['haproxy']['enable_stats_socket'] -%>