Skip to content
This repository has been archived by the owner on Aug 5, 2020. It is now read-only.

Commit

Permalink
Merge pull request #184 from phylake/master
Browse files Browse the repository at this point in the history
maxconn
  • Loading branch information
phylake authored Aug 21, 2017
2 parents 68a2661 + 59e66ff commit f2685dc
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
`porter` is [semantically versioned](http://semver.org/spec/v2.0.0.html)

### v4.9.0

- HAProxy `maxconn` is configurable
- fixed issue where `maxconn` wasn't set on the frontend

### v4.8.3

- enabling fix for volume mounts on SELinux by setting the environment variable `VOLUME_FLAG`
Expand Down
6 changes: 6 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ See the [CHANGELOG](CHANGELOG.md) for a complete list of changes.

`porter` is [semantically versioned](http://semver.org/spec/v2.0.0.html)

v4.9
====

HAProxy's [`maxconn`](docs/detailed_design/config-reference.md#maxconn)
is now configurable.

v4.8
====

Expand Down
2 changes: 2 additions & 0 deletions commands/host/haproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type (
ResHeaderCaptures []conf.HeaderCapture
HTTPS_Redirect bool
HaveELB bool
MaxConn uint64

TimeoutClient uint64
TimeoutServer uint64
Expand Down Expand Up @@ -225,6 +226,7 @@ func hotswap(log log15.Logger, environmentStr, regionStr string, hapStdin HAPStd
ResHeaderCaptures: environment.HAProxy.ResHeaderCaptures,
HTTPS_Redirect: environment.HAProxy.SSL.HTTPS_Redirect,
HaveELB: region.HasELB(),
MaxConn: environment.HAProxy.MaxConn,
TimeoutClient: uint64(environment.HAProxy.Timeout.Client_.Seconds() * 1000),
TimeoutServer: uint64(environment.HAProxy.Timeout.Server_.Seconds() * 1000),
TimeoutTunnel: uint64(environment.HAProxy.Timeout.Tunnel_.Seconds() * 1000),
Expand Down
5 changes: 5 additions & 0 deletions conf/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ type (
CompressTypes []string `yaml:"compress_types"`
SSL SSL `yaml:"ssl"`
Timeout Timeout `yaml:"timeout"`
MaxConn uint64 `yaml:"maxconn"`
}

Timeout struct {
Expand Down Expand Up @@ -267,6 +268,10 @@ func (recv *Config) SetDefaults() {
env.HAProxy.SSL.CertDirectory = "/etc/ssl/certs/"
}

if env.HAProxy.MaxConn == 0 {
env.HAProxy.MaxConn = 200000
}

if env.HAProxy.Timeout.Client == nil || *env.HAProxy.Timeout.Client == "" {
env.HAProxy.Timeout.Client = new(string)
*env.HAProxy.Timeout.Client = "7s"
Expand Down
8 changes: 8 additions & 0 deletions docs/detailed_design/config-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ For each field the following notation is used
- [compression](#compression) (==1?)
- [compress_types](#compress_types) (==1?)
- [timeout](#timeout)
- [maxconn](#maxconn) (==1?)
- [ssl](#ssl) (==1?)
- [cert_directory](#cert_directory) (==1?)
- [pem](#pem) (==?!)
Expand Down Expand Up @@ -356,6 +357,13 @@ Disable any timeout by setting the value to `0`
Refer to the [HAProxy docs](https://cbonte.github.io/haproxy-dconv/1.5/configuration.html#4.2-timeout%20client)
for what these timeouts mean

### maxconn

[`maxconn`](https://cbonte.github.io/haproxy-dconv/1.5/configuration.html#4-maxconn)
docs. This sets `maxconn` in the global and defaults sections.

Default: `200000`

### ssl

SSL support via HAProxy
Expand Down
4 changes: 2 additions & 2 deletions files/haproxy.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ global
daemon

# NOTE: this only sets ulimit, not 'sysctl fs.file-max' which may need tuned
# TODO calculate this
maxconn 200000
maxconn {{ .MaxConn }}

defaults
log global
Expand All @@ -20,6 +19,7 @@ defaults
{{- end }}
retries 3
option redispatch
maxconn {{ .MaxConn }}

# Time to connect to backends
# N * 3 + 1 where N=4 was chosen based on load testing
Expand Down

0 comments on commit f2685dc

Please sign in to comment.