Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NormalizeHost CPU Performance #647

Open
murphymj25 opened this issue Apr 19, 2019 · 0 comments
Open

NormalizeHost CPU Performance #647

murphymj25 opened this issue Apr 19, 2019 · 0 comments

Comments

@murphymj25
Copy link
Contributor

murphymj25 commented Apr 19, 2019

In looking at a CPU pprof of one of our production instances, we have noticed that a significant amount of CPU time is being spend on the strings.ToLower in the normalizeHost function in table.go.

The pprof was taken on a 16 core instance, with about 3,000 requests per second of traffic. In this environment, the route table has about 13,000 separate routes. In the pprof, we see the following:
image

I've done some testing and updated the matchingHostNoGlob to use string.EqualFold instead of doing the comparison with the normalizeHost and strings.ToLower. With that change, the normalizeHost was reduced from 22% to 8% with similar request volume and route table size. The overall CPU usage of the instance was reduced by about 10%.

I'll create a PR to share the changes I've done already. I think there's still some opportunity to further reduce the CPU load by changing how the :port is trimmed off.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant