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

Udp balancing fire and forget mode 100% cpu usage #290

Closed
fedelway opened this issue Jul 3, 2020 · 4 comments
Closed

Udp balancing fire and forget mode 100% cpu usage #290

fedelway opened this issue Jul 3, 2020 · 4 comments
Assignees
Milestone

Comments

@fedelway
Copy link

fedelway commented Jul 3, 2020

In my organization we are using gobetween to load balance Udp traffic to an ELK stack. Our app servers send udp messages with log lines to gobetween which forwards this traffic to several logstash instances.

We tried the roundrobin configuration but we detected the traffic was not evenly balanced (on a total packet basis). So we changed max_requests to 1 to enable fire and forget mode.

The result was the balacing was done right, with logstash instances receiving the same amount of traffic, but the CPU usage got to 100%. With 50-60% from system usage. Previously, before the fire and forget mode was activated, the CPU usage was around 15-20%.

I suspect this is related to the function electAndConnect that is used with the fireAndForget mode (in src/server/udp/server.go) that resolves the address and opens the udp socket on every packet that is received by gobetween. Reusing the sockets probably solves the issue.

@illarion illarion self-assigned this Jul 6, 2020
@illarion illarion added this to the 0.8.0 milestone Jul 6, 2020
@illarion
Copy link
Collaborator

illarion commented Jul 6, 2020

@fedelway thank you for great bug report. I've checked your assumption and it's 100% correct. I am working on a fix right now.

illarion added a commit that referenced this issue Jul 6, 2020
@illarion
Copy link
Collaborator

illarion commented Jul 6, 2020

@fedelway could you please test the fix in latest gobetween build from master branch?

@fedelway
Copy link
Author

fedelway commented Jul 6, 2020

@illarion We're running the latest build and it is working perfectly. The CPU usage is stable at 20-30%. I'm going to be monitoring how it behaves over time in my environment.

@illarion illarion closed this as completed Jul 7, 2020
@fedelway
Copy link
Author

fedelway commented Jul 7, 2020

I left the balancer running for a whole day and it worked correctly. No errors were logged.

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

2 participants