While testing SSL performance in one of our application dev environments, we noticed that we were not getting anywhere close the the requests per second volumes that we saw when we originally did the performance testing in the lab. In the lab we were seeing about 2000 requests per second per core, in dev, we were seeing less than 1000 requests per second on an 8 core node. Upon further investigation we confirmed that the performance was poor only when fabio was getting routes from a consul environment with a large number of services (our dev environment currently has about 2200 routes).
We did a pprof on the CPU and confirmed that github com/fabiolb/fabio/vendor/github com/gobwas/glob/ was the source of the high utilization. The pdf is attached below.
We are currently running 1.5.9; it looks like this performance may be related to #457. In that PR, it looks like the benchmark does show a decrease in performance compared to the glob/ryanuber-8 if gobwas/glob isn't compiled. This is further documented in the performance section of https://github.com/gobwas/glob.
In route/table.go We confirmed that Fabio is not using compiled Globs.
// matchingHosts returns all keys (host name patterns) from the
// routing table which match the normalized request hostname.
func (t Table) matchingHosts(req *http.Request) (hosts []string) {
host := normalizeHost(req.Host, req.TLS != nil)
for pattern := range t {
normpat := normalizeHost(pattern, req.TLS != nil)
g := glob.MustCompile(normpat)
if g.Match(host) {
hosts = append(hosts, pattern)
}
}
--SNIP
}
We rolled back to 1.5.8 and confirmed that the performance is much better. We are actively looking to either roll back to the glob package used in 1.5.8 or update the current route table to be compiled. Any thoughts on what would need to be updated to move forward with the compiled option? We'd be willing to submit the PR.
file.pdf
@galen0624
While testing SSL performance in one of our application dev environments, we noticed that we were not getting anywhere close the the requests per second volumes that we saw when we originally did the performance testing in the lab. In the lab we were seeing about 2000 requests per second per core, in dev, we were seeing less than 1000 requests per second on an 8 core node. Upon further investigation we confirmed that the performance was poor only when fabio was getting routes from a consul environment with a large number of services (our dev environment currently has about 2200 routes).
We did a pprof on the CPU and confirmed that github com/fabiolb/fabio/vendor/github com/gobwas/glob/ was the source of the high utilization. The pdf is attached below.
We are currently running 1.5.9; it looks like this performance may be related to #457. In that PR, it looks like the benchmark does show a decrease in performance compared to the glob/ryanuber-8 if gobwas/glob isn't compiled. This is further documented in the performance section of https://github.com/gobwas/glob.
In route/table.go We confirmed that Fabio is not using compiled Globs.
We rolled back to 1.5.8 and confirmed that the performance is much better. We are actively looking to either roll back to the glob package used in 1.5.8 or update the current route table to be compiled. Any thoughts on what would need to be updated to move forward with the compiled option? We'd be willing to submit the PR.
file.pdf
@galen0624