core icon indicating copy to clipboard operation
core copied to clipboard

Major Performance Difference

Open jonfasking opened this issue 10 years ago • 10 comments

I'm seeing a significant performance difference across OS's on one of my core projects. It consists of socket connections with Kafka, and databases that talk with Orient. When running on Windows, I'm able to process ~15K msgs/minute between Kafka and Orient. The exact same code (literally x copied) over to OSX is only able to run ~1K msgs/minute between the two.

Details: Both boxes are on the same network. Network is nowhere near capacity. Both boxes are running all the latest core rc2 installs. Windows box is running 10, and when running the project is capping available memory at 90%. Mac box is running El Capitan 10.11 and has 4X the memory as the windows box and is also capping at ~80% memory.

At this point, I am stumped as to where to even look for the bottlenecks between the OS's. I'm stumped as to how a box that has much stronger hardware, hooked up to the same network, can cause such a drastic performance drop. Unfortunately, I cannot post up the code to share.

Is there any documentation I can reference for possible GC differences between OS's, or maybe variances is TPL/Threading that core may or may not support on certain OS's?

jonfasking avatar Jun 13 '16 17:06 jonfasking

cc: @ericeil. @pgavlin

stephentoub avatar Jun 13 '16 17:06 stephentoub

Just to confirm, I deployed the code to a linux box, and I saw the same results. Back to back tests consistently reveal drastically different numbers between windows OS and linux OS.

jonfasking avatar Jun 13 '16 18:06 jonfasking

@jonfasking, can you collect a perf trace on Linux? Instructions are here: https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/linux-performance-tracing.md

ericeil avatar Jun 13 '16 18:06 ericeil

sampletrace2.trace.zip

I'm trying to make heads or tails of this but I'm not getting anywhere, haha.

jonfasking avatar Jun 13 '16 20:06 jonfasking

I'm having trouble finding much specific information about the actual dotNET process in that trace. However, it does look like, at least in terms of CPU usage, the "bro" process is using much more CPU than the dotNET process. There is also a Java process using a little more CPU. Perhaps those are useful clues.

ericeil avatar Jun 14 '16 20:06 ericeil

@vancem, @brianrob, any chance one of you could help us make more sense of this trace?

ericeil avatar Jun 14 '16 20:06 ericeil

First if you look at the CPU STacks you see that all the activity is in the first 6 seconds. I am assuming that is expected. It also looks like you are not CPU bound (most CPU time is spend in the idle process, you have an 8 proc system and are only using at most half of your available CPU). The 'bro' and 'java' processes are fairly active, but the dotnet process consumes CPU in the start (500msec) and then uses very little. This implies that you are not CPU bound but something else is slowing down the requests (thus this is probably not going to be a CPU investigation, which is unfortunate, as we don't really have good wall clock time investigation tools on Linux yet).

Homing in on the dotnet process, we see that libcoreclr.so!unknown is where most of the time is spent. Thus we have a symbol problem (we need the symbol packages). We have a plan to improve this experience, but for now you need to get symbols put in the right place. Brian can help here. however I don't think that this will help much as my expectation is that al tha time is JIT compile time. Still having the symbols can help.

However as mentioned, this is nto likely to be a CPU problem but some sort of blocked time problem. To investigate this is is best to put in an System.Diagnostics.Tracing.EventSource and 'interesting' places so that we can see where time is spent (basically you get logging with accurate time stamps that let you break down the time).

I would recommend using PerfView to collect a trace on Windows (simply do PerfView /threadTime collect). Our instrumentation is MUCH better there and having a baseline of how it is SUPPOSED to work is very valuable.

I would start there, as also instrument your code with an EventSource (see https://blogs.msdn.microsoft.com/vancem/2015/09/14/exploring-eventsource-activity-correlation-and-causation-features/), and get some measurements on Windows. Then we can tell you how to turn this on for Linux and see what can be learned from that.

However, it will take some effort. You are on the bleading edge. We want to make investigations like this much better, but Linux performance investigation is in its infancy.

vancem avatar Jun 15 '16 18:06 vancem

What is the status of this issue then? Seems like there has been no movement on it for a month now...

thesmithee avatar Jul 26 '16 04:07 thesmithee

I would recommend that @jonfasking take a new trace with perfCollect with a RTM version of the runtime (this will at least solve many of the symbol problems, as we know we have symbols for that version of the runtime. If he adds EventSource instrumentation to his code as I have recommended previously that would also be good. Finally if he can run it on Windows easily enough, that would certainly main the investigation easier as well...

vancem avatar Jul 26 '16 14:07 vancem

Thanks @vancem. Given the inactivity here, I will close this issue. @jonfasking if you still would like to continue this discussion, please open the issue on dotnet/coreclr, as it is a much better home for it than here. Thanks!

thesmithee avatar Jul 28 '16 05:07 thesmithee