-
Notifications
You must be signed in to change notification settings - Fork 1k
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.Remote Performance - String.Format logging perf fix #1540
Akka.Remote Performance - String.Format logging perf fix #1540
Conversation
👍 - there are some merge conflicts to be resolved. |
// message is intended for the RemoteDaemon, usually a command to create a remote actor | ||
if (recipient == remoteDaemon) | ||
{ | ||
if (settings.UntrustedMode) log.Debug("dropping daemon message in untrusted mode"); | ||
else | ||
{ | ||
if (settings.LogReceive) log.Debug("received daemon message [{0}]", msgLog); | ||
if (settings.LogReceive) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this the right setting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep,
//this is the line we have moved ####################################
def msgLog = s"RemoteMessage: [$payload] to [$recipient]<+[$originalReceiver] from [$sender()]"
recipient match {
case `remoteDaemon` ⇒
if (UntrustedMode) log.debug("dropping daemon message in untrusted mode")
else {
//this is where it is consumed ####################################
if (LogReceive) log.debug("received daemon message {}", msgLog)
remoteDaemon ! payload
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@Horusiath merge conflicts? its green here |
@rogeralsing could you rebase this on dev and re-run it so the Akka.Remote benchmarks show up? |
Perf from this build thus far Akka.Remote.Tests.Performance.TestTransportRemoteMessagingThroughputSpec+OneWayMeasures the throughput of Akka.Remote over a particular transport using one-way messaging System InfoNBench=NBench, Version=0.1.5.0, Culture=neutral, PublicKeyToken=null
OS=Microsoft Windows NT 6.2.9200.0
ProcessorCount=4
CLR=4.0.30319.42000,IsMono=False,MaxGcGeneration=2
WorkerThreads=32767, IOThreads=4 NBench SettingsRunMode=Iterations, TestMode=Measurement
NumberOfIterations=13, MaximumRunTime=00:00:01 DataTotals
Per-second Totals
Raw DataTotalCollections [Gen0]
TotalCollections [Gen1]
TotalCollections [Gen2]
[Counter] RemoteMessageReceived
|
Perf from previous Akka.Remote.Tests.Performance.TestTransportRemoteMessagingThroughputSpec+OneWayMeasures the throughput of Akka.Remote over a particular transport using one-way messaging System InfoNBench=NBench, Version=0.1.5.0, Culture=neutral, PublicKeyToken=null
OS=Microsoft Windows NT 6.2.9200.0
ProcessorCount=4
CLR=4.0.30319.42000,IsMono=False,MaxGcGeneration=2
WorkerThreads=32767, IOThreads=4 NBench SettingsRunMode=Iterations, TestMode=Measurement
NumberOfIterations=13, MaximumRunTime=00:00:01 DataTotals
Per-second Totals
Raw DataTotalCollections [Gen0]
TotalCollections [Gen1]
TotalCollections [Gen2]
[Counter] RemoteMessageReceived
|
Performance of this build is actually worse with a wider standard deviation than the previous build of the |
@rogeralsing double check the benchmark's Akka.Remote config settings - if |
@Aaronontheweb I'm not following? what settings are you running the tests with? |
@rogeralsing read the C# code of this class https://github.com/akkadotnet/akka.net/blob/dev/src/core/Akka.Remote.Tests.Performance/RemoteMessagingThroughputSpecBase.cs that's the base class that defines the per-transport benchmarks |
@rogeralsing concrete implementation for |
also might be worth comparing the results of the two-way spec (second method on the benchmark class), which I did not include in the comments |
|
|
The remoting tests need way longer time to run also, I'm seeing a throughput difference of ca 30% in just error between my runs in my test apps. Even using the TestTransport, the remoting layer is just far too indeterministic in throughput. And never calling ToString on an object will ofc always be faster than always calling ToString on that object. |
The old code: //always executed
var msgLog = string.Format("RemoteMessage: {0} to {1}<+{2} from {3}", payload, recipient, originalReceiver,sender);
if (settings.LogReceive) //defaults to false
{
log.Debug("received daemon message [{0}]", msgLog);
} The new code if (settings.LogReceive) //defaults to false
{
//not executed
var msgLog = string.Format("RemoteMessage: {0} to {1}<+{2} from {3}", payload, recipient, originalReceiver,sender);
log.Debug("received daemon message [{0}]", msgLog);
} Any argument that the original code is faster for real, and I will start pushing code with ToString statements everywhere to make it all go faster ;-) |
It shows the changes weren't a significant factor in affecting performance. Try running them locally. |
And if the tests are broken, then fix them. This is the standard we've picked - so learn how to use it and run with it instead of depending on home-rolled stuff. My work with them over the weekend clearly demonstrated the performance differences the resulted from changing the dispatchers. |
We are fixing them we have multiple people working on fixing the dedicated thread pool which is the main issue here. |
Not being anal, but we can't operate from a basis of dismissing our performance numbers when they don't concur with our understanding of what should have happened as a result of this change. From where I'm sitting, these numbers are explained by 1 or more of the following explanations:
What I'd like to see going forward is rather than have us dismiss all of the above and merge it anyway, let's figure out which of those options explains why the observed behavior doesn't align with the expected behavior. The code you wrote is obviously an improvement and aligns with what the JVM does, but we need to explain and provide evidence for why it didn't have an impact on this benchmark. Does that make sense? |
One more possible explanation:
|
So I tried running this locally, to see if Azure's CPU throttling was to blame for some of the skew and disparity between the two tests, and this time got a convergent result: With ChangeAkka.Remote.Tests.Performance.TestTransportRemoteMessagingThroughputSpec+OneWayMeasures the throughput of Akka.Remote over a particular transport using one-way messaging System InfoNBench=NBench, Version=0.1.3.0, Culture=neutral, PublicKeyToken=null
OS=Microsoft Windows NT 6.2.9200.0
ProcessorCount=8
CLR=4.0.30319.42000,IsMono=False,MaxGcGeneration=2
WorkerThreads=32767, IOThreads=8 NBench SettingsRunMode=Iterations, TestMode=Measurement
NumberOfIterations=13, MaximumRunTime=00:00:01 DataTotals
Per-second Totals
Raw DataTotalCollections [Gen0]
TotalCollections [Gen1]
TotalCollections [Gen2]
[Counter] RemoteMessageReceived
Without changeAkka.Remote.Tests.Performance.TestTransportRemoteMessagingThroughputSpec+OneWayMeasures the throughput of Akka.Remote over a particular transport using one-way messaging System InfoNBench=NBench, Version=0.1.3.0, Culture=neutral, PublicKeyToken=null
OS=Microsoft Windows NT 6.2.9200.0
ProcessorCount=8
CLR=4.0.30319.42000,IsMono=False,MaxGcGeneration=2
WorkerThreads=32767, IOThreads=8 NBench SettingsRunMode=Iterations, TestMode=Measurement
NumberOfIterations=13, MaximumRunTime=00:00:01 DataTotals
Per-second Totals
Raw DataTotalCollections [Gen0]
TotalCollections [Gen1]
TotalCollections [Gen2]
[Counter] RemoteMessageReceived
|
With the exception of one outlier, the performance of the code with this change has a speed advantage of roughly ~5,000 nanos per operation over the previous stable release from dev. |
I can dial up the |
Akka.Remote Performance - String.Format logging perf fix
Fixes #1539
The log message is being formatted in the default pipeline, even if logging is not enabled.
This PR moves the message formatting into the conditionals that logs.