diff options
author | Aliaksandr Valialkin <valyala@gmail.com> | 2017-04-20 19:05:57 +0300 |
---|---|---|
committer | Aliaksandr Valialkin <valyala@gmail.com> | 2017-04-20 19:05:57 +0300 |
commit | 8d2055d00ac682d7218d9e697a19a9ab5abb2e8b (patch) | |
tree | 49e453b7ef2cf1be1a0548466b789f5a417f5da7 /fasthttputil | |
parent | fasthttputil: added BenchmarkTLSHandshakeWithoutClientSessionCache (diff) | |
download | fasthttp-8d2055d00ac682d7218d9e697a19a9ab5abb2e8b.tar.gz fasthttp-8d2055d00ac682d7218d9e697a19a9ab5abb2e8b.tar.bz2 fasthttp-8d2055d00ac682d7218d9e697a19a9ab5abb2e8b.zip |
fasthttputil: added TLS benchmarks for handshakes with elliptic curves
Diffstat (limited to 'fasthttputil')
-rw-r--r-- | fasthttputil/inmemory_listener_timing_test.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/fasthttputil/inmemory_listener_timing_test.go b/fasthttputil/inmemory_listener_timing_test.go index 3518de9..28b42e2 100644 --- a/fasthttputil/inmemory_listener_timing_test.go +++ b/fasthttputil/inmemory_listener_timing_test.go @@ -53,6 +53,24 @@ func BenchmarkTLSHandshakeWithoutClientSessionCache(b *testing.B) { benchmarkExt(b, handshakeHandler, bc) } +func BenchmarkTLSHandshakeWithCurvesWithClientSessionCache(b *testing.B) { + bc := &benchConfig{ + IsTLS: true, + DisableClientSessionCache: false, + UseCurves: true, + } + benchmarkExt(b, handshakeHandler, bc) +} + +func BenchmarkTLSHandshakeWithCurvesWithoutClientSessionCache(b *testing.B) { + bc := &benchConfig{ + IsTLS: true, + DisableClientSessionCache: true, + UseCurves: true, + } + benchmarkExt(b, handshakeHandler, bc) +} + func benchmark(b *testing.B, h fasthttp.RequestHandler, isTLS bool) { bc := &benchConfig{ IsTLS: isTLS, @@ -63,6 +81,7 @@ func benchmark(b *testing.B, h fasthttp.RequestHandler, isTLS bool) { type benchConfig struct { IsTLS bool DisableClientSessionCache bool + UseCurves bool } func benchmarkExt(b *testing.B, h fasthttp.RequestHandler, bc *benchConfig) { @@ -76,6 +95,12 @@ func benchmarkExt(b *testing.B, h fasthttp.RequestHandler, bc *benchConfig) { Certificates: []tls.Certificate{cert}, PreferServerCipherSuites: true, } + serverTLSConfig.CurvePreferences = []tls.CurveID{} + if bc.UseCurves { + serverTLSConfig.CurvePreferences = []tls.CurveID{ + tls.CurveP256, + } + } clientTLSConfig = &tls.Config{ InsecureSkipVerify: true, } |