Skip to content

Commit f77fb6e

Browse files
committed
MINOR: Add 4 new tunable keywords for HAProxy 3.4
1 parent 1c2392f commit f77fb6e

16 files changed

Lines changed: 220 additions & 5 deletions

.aspell.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ allowed:
197197
- tls
198198
- tooltip
199199
- tsconfig
200+
- tunable
200201
- typings
201202
- ubuntu
202203
- uniq

config-parser/section-parsers.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,13 +284,16 @@ func (p *configParser) getGlobalParser() *Parsers { //nolint: maintidx
284284
addParser(parser, &sequence, &simple.Size{Name: "tune.bufsize"})
285285
addParser(parser, &sequence, &simple.Size{Name: "tune.bufsize.small"})
286286
addParser(parser, &sequence, &simple.Number{Name: "tune.comp.maxlevel"})
287+
addParser(parser, &sequence, &simple.Enabled{Name: "tune.defaults.purge"})
287288
addParser(parser, &sequence, &simple.Enabled{Name: "tune.disable-zero-copy-forwarding"})
288289
addParser(parser, &sequence, &simple.Enabled{Name: "tune.disable-fast-forward"})
289290
addParser(parser, &sequence, &simple.Word{Name: "tune.epoll.mask-events"})
290291
addParser(parser, &sequence, &simple.Number{Name: "tune.events.max-events-at-once"})
291292
addParser(parser, &sequence, &simple.Enabled{Name: "tune.fail-alloc"})
292293
addParser(parser, &sequence, &simple.Number{Name: "tune.glitches.kill.cpu-usage"})
293294
addParser(parser, &sequence, &simple.OnOff{Name: "tune.fd.edge-triggered"})
295+
addParser(parser, &sequence, &simple.Number{Name: "tune.h1.be.glitches-threshold"})
296+
addParser(parser, &sequence, &simple.Number{Name: "tune.h1.fe.glitches-threshold"})
294297
addParser(parser, &sequence, &simple.OnOff{Name: "tune.h1.zero-copy-fwd-recv"})
295298
addParser(parser, &sequence, &simple.OnOff{Name: "tune.h1.zero-copy-fwd-send"})
296299
addParser(parser, &sequence, &simple.Number{Name: "tune.h2.be.glitches-threshold"})
@@ -352,6 +355,7 @@ func (p *configParser) getGlobalParser() *Parsers { //nolint: maintidx
352355
addParser(parser, &sequence, &simple.Size{Name: "tune.sndbuf.frontend"})
353356
addParser(parser, &sequence, &simple.Size{Name: "tune.sndbuf.server"})
354357
addParser(parser, &sequence, &simple.Number{Name: "tune.ssl.cachesize"})
358+
addParser(parser, &sequence, &simple.AutoOnOff{Name: "tune.ssl.certificate-compression"})
355359
addParser(parser, &sequence, &simple.Enabled{Name: "tune.ssl.force-private-cache"})
356360
addParser(parser, &sequence, &simple.OnOff{Name: "tune.ssl.keylog"})
357361
addParser(parser, &sequence, &simple.Time{Name: "tune.ssl.lifetime"})

config-parser/tests/configs/haproxy.cfg.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,12 @@ global
4444
tune.buffers.reserve 3
4545
tune.bufsize 32768
4646
tune.bufsize.small 16k
47+
tune.defaults.purge
4748
tune.disable-zero-copy-forwarding
4849
tune.disable-fast-forward
4950
tune.events.max-events-at-once 150
51+
tune.h1.be.glitches-threshold 2
52+
tune.h1.fe.glitches-threshold 16
5053
tune.h1.zero-copy-fwd-recv on
5154
tune.h1.zero-copy-fwd-send on
5255
tune.h2.be.glitches-threshold 16
@@ -62,6 +65,7 @@ global
6265
tune.renice.runtime -10
6366
tune.renice.startup 8
6467
tune.ring.queues 8
68+
tune.ssl.certificate-compression off
6569
tune.ssl.default-dh-param 2048
6670
tune.quic.reorder-ratio 75
6771
tune.quic.zero-copy-fwd-send on

configuration/global.go

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1285,6 +1285,15 @@ func parseTuneOptions(p parser.Parser) (*models.TuneOptions, error) { //nolint:g
12851285
options.CompMaxlevel = intOption
12861286
}
12871287

1288+
boolOption, err = parseBoolOption(p, "tune.defaults.purge")
1289+
if err != nil {
1290+
return nil, err
1291+
}
1292+
if boolOption {
1293+
isEmpty = false
1294+
options.DefaultsPurge = boolOption
1295+
}
1296+
12881297
boolOption, err = parseBoolOption(p, "tune.disable-fast-forward")
12891298
if err != nil {
12901299
return nil, err
@@ -1341,6 +1350,24 @@ func parseTuneOptions(p parser.Parser) (*models.TuneOptions, error) { //nolint:g
13411350
options.GlitchesKillCPUUsage = intPOption
13421351
}
13431352

1353+
intPOption, err = parseInt64POption(p, "tune.h1.be.glitches-threshold")
1354+
if err != nil {
1355+
return nil, err
1356+
}
1357+
if intPOption != nil {
1358+
isEmpty = false
1359+
options.H1BeGlitchesThreshold = intPOption
1360+
}
1361+
1362+
intPOption, err = parseInt64POption(p, "tune.h1.fe.glitches-threshold")
1363+
if err != nil {
1364+
return nil, err
1365+
}
1366+
if intPOption != nil {
1367+
isEmpty = false
1368+
options.H1FeGlitchesThreshold = intPOption
1369+
}
1370+
13441371
intOption, err = parseInt64Option(p, "tune.h2.header-table-size")
13451372
if err != nil {
13461373
return nil, err
@@ -2080,6 +2107,15 @@ func parseTuneSSLOptions(p parser.Parser) (*models.TuneSslOptions, error) {
20802107
options.Cachesize = intPOption
20812108
}
20822109

2110+
strOption, err := parseAutoOnOffOption(p, "tune.ssl.certificate-compression")
2111+
if err != nil {
2112+
return nil, err
2113+
}
2114+
if strOption != "" {
2115+
isEmpty = false
2116+
options.CertificateCompression = strOption
2117+
}
2118+
20832119
boolOption, err := parseBoolOption(p, "tune.ssl.force-private-cache")
20842120
if err != nil {
20852121
return nil, err
@@ -2089,7 +2125,7 @@ func parseTuneSSLOptions(p parser.Parser) (*models.TuneSslOptions, error) {
20892125
options.ForcePrivateCache = boolOption
20902126
}
20912127

2092-
strOption, err := parseOnOffOption(p, "tune.ssl.keylog")
2128+
strOption, err = parseOnOffOption(p, "tune.ssl.keylog")
20932129
if err != nil {
20942130
return nil, err
20952131
}
@@ -3770,6 +3806,9 @@ func serializeTuneSSLOptions(p parser.Parser, options *models.TuneSslOptions, co
37703806
if err := serializeInt64POption(p, "tune.ssl.capture-buffer-size", options.CaptureBufferSize); err != nil {
37713807
return err
37723808
}
3809+
if err := serializeAutoOnOffOption(p, "tune.ssl.certificate-compression", options.CertificateCompression); err != nil {
3810+
return err
3811+
}
37733812
if err := serializeInt64Option(p, "tune.ssl.ssl-ctx-cache-size", options.CtxCacheSize); err != nil {
37743813
return err
37753814
}
@@ -3833,6 +3872,9 @@ func serializeTuneOptions(p parser.Parser, options *models.TuneOptions, configOp
38333872
if err := serializeInt64Option(p, "tune.comp.maxlevel", options.CompMaxlevel); err != nil {
38343873
return err
38353874
}
3875+
if err := serializeBoolOption(p, "tune.defaults.purge", options.DefaultsPurge); err != nil {
3876+
return err
3877+
}
38363878
if err := serializeBoolOption(p, "tune.disable-fast-forward", options.DisableFastForward); err != nil {
38373879
return err
38383880
}
@@ -3851,6 +3893,12 @@ func serializeTuneOptions(p parser.Parser, options *models.TuneOptions, configOp
38513893
if err := serializeInt64POption(p, "tune.glitches.kill.cpu-usage", options.GlitchesKillCPUUsage); err != nil {
38523894
return err
38533895
}
3896+
if err := serializeInt64POption(p, "tune.h1.be.glitches-threshold", options.H1BeGlitchesThreshold); err != nil {
3897+
return err
3898+
}
3899+
if err := serializeInt64POption(p, "tune.h1.fe.glitches-threshold", options.H1FeGlitchesThreshold); err != nil {
3900+
return err
3901+
}
38543902
if err := serializeInt64Option(p, "tune.h2.header-table-size", options.H2HeaderTableSize); err != nil {
38553903
return err
38563904
}

models/tune_options.go

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

models/tune_options_compare_test.go

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

models/tune_ssl_options.go

Lines changed: 51 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

models/tune_ssl_options_compare_test.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

models/tuneoptions_diff_generated.go

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)