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

akka-io: fixed #1225 - High CPU load using the Akka.IO TCP server #1236

Merged
merged 1 commit into from
Aug 11, 2015

Conversation

fergusn
Copy link
Contributor

@fergusn fergusn commented Aug 11, 2015

TL;DR; This PR resolve issue #1225.

The JVM socket selector will block until one socket is selected, or when wakeup is called. The behavior in JVM Akka is to block indefinitely until a socket is selected, or whenever a socket interest is added/removed to wake-up the selector and then select again.

In .NET sockets there is unfortunately no way I'm aware of to wake-up the Socket.Select method. The high CPU usage here was caused because we never blocked on Select.

I've changed the Select to block for 1 millisecond (the lowest timespan), which (in my testing at least) changed the idle CPU usage from 15% to 0%. The compromise is of course that some socket operation might wait a average of 0.5 ms, before they complete. I still have to do detailed measurement on the performance impact, but from my initial testing is seems reasonable.

The longer term solution is to switch to completely asynchronous sockets. I have a working version of this, but it breaks most TcpConnectionSpec tests - which are white box tests.

rogeralsing added a commit that referenced this pull request Aug 11, 2015
akka-io: fixed #1225 - High CPU load using the Akka.IO TCP server
@rogeralsing rogeralsing merged commit 533fa75 into akkadotnet:dev Aug 11, 2015
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

Successfully merging this pull request may close these issues.

4 participants