Bug 42945 - Asynchronous IO seems slow when compared to CoreCLR
Summary: Asynchronous IO seems slow when compared to CoreCLR
Status: ASSIGNED
Alias: None
Product: Runtime
Classification: Mono
Component: io-layer (show other bugs)
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Rodrigo Kumpera
URL:
: 18686 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-07-31 19:27 UTC by Dylan Borg
Modified: 2017-10-14 00:35 UTC (History)
6 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Dylan Borg 2016-07-31 19:27:19 UTC
After running a test application on both CLRs I found mono to be 5 times slower when compared to .NET Core. The test used a custom compiler. Would the repro binaries and source code suffice?I do not think it is easy to install my custom stuff on other machines. The .NET Core used was from standard RTM packages whereas the mono used is from git without any patches applied.
Comment 1 Jon Purdy 2016-09-07 20:42:02 UTC
We’re aware of some threadpool performance issues, and we could use better benchmarks. Please upload some kind of minimal test case so we can investigate this further.
Comment 2 su21 2017-03-31 06:09:28 UTC
>We’re aware of some threadpool performance issues, and we could use better benchmarks. Please upload some kind of minimal test case so we can investigate this further.

I can provide one: https://gist.github.com/sillyousu/ecbf780bf24f422f6ab9787c630139cc
Comment 3 su21 2017-03-31 06:12:44 UTC
Samples: 2M of event 'cpu-clock', Event count (approx.): 647970250000
Overhead  Command          Shared Object                 Symbol
  47.13%  Threadpool work  [kernel.vmlinux]              [k] _raw_spin_lock
  10.42%  Threadpool work  [kernel.vmlinux]              [k] _raw_spin_unlock_irqrestore
   3.25%  Threadpool work  [kernel.vmlinux]              [k] finish_task_switch

worker threads spinning hurt the overall performance.
Comment 4 su21 2017-03-31 07:24:04 UTC
threadpool domains_lock 0xb389b8
threadpool_worker parked_threads_lock 0xb38a40
threadpool_worker parked_threads_cond 0xb38a70
threadpool_worker worker_creation_lock 0xb38ab0
threadpool_worker heuristic_lock 0xb38bb8
round 0 time 5129
round 1 time 2566
round 2 time 6978
round 3 time 9848
round 4 time 22607
round 5 time 40754
round 6 time 51302
round 7 time 37000
round 8 time 24734
round 9 time 25515

mono[19560] lock 0x7ff284000020 contended 84 times, 11 avg us
mono[19560] lock 0x7ff248000020 contended 87 times, 14 avg us
mono[19560] lock 0x7ff280000020 contended 98 times, 15 avg us
mono[19560] lock 0x7ff240000020 contended 125 times, 20 avg us
mono[19560] lock 0x7ff27c000020 contended 101 times, 14 avg us
mono[19560] lock 0x1d6d35c contended 102 times, 60397 avg us
mono[19560] lock 0xb69600 contended 4120 times, 865 avg us
mono[19560] lock 0xb38a40 contended 775650 times, 1446 avg us
mono[19560] lock 0x1d6d2ec contended 21 times, 60150 avg us
mono[19560] lock 0x7ff2a4000020 contended 125 times, 20 avg us
mono[19560] lock 0x7ff25c000020 contended 117 times, 11 avg us
mono[19560] lock 0x7ff254000020 contended 90 times, 20 avg us
mono[19560] lock 0x1d76f00 contended 1 times, 12 avg us
mono[19560] lock 0xb38a70 contended 19818 times, 30 avg us
mono[19560] lock 0x7ff274000020 contended 92 times, 22 avg us
mono[19560] lock 0x7ff2a8000020 contended 87 times, 19 avg us
mono[19560] lock 0x7ff28c000020 contended 152 times, 18 avg us
mono[19560] lock 0xb68cc0 contended 6867 times, 70 avg us
mono[19560] lock 0xb38ab0 contended 115147 times, 25 avg us
mono[19560] lock 0x7ff294000020 contended 98 times, 21 avg us
mono[19560] lock 0x7ff288000020 contended 109 times, 18 avg us
mono[19560] lock 0x7ff24c000020 contended 82 times, 14 avg us
mono[19560] lock 0xb68144 contended 29 times, 1339203 avg us
mono[19560] lock 0xb68be0 contended 35 times, 525 avg us
mono[19560] lock 0x7ff278000020 contended 88 times, 15 avg us
mono[19560] lock 0x7ffc11b4bb54 contended 2 times, 225 avg us
mono[19560] lock 0x7ff270000020 contended 92 times, 19 avg us
mono[19560] lock 0x7ff258000020 contended 98 times, 22 avg us
mono[19560] lock 0xb387a0 contended 42 times, 1061 avg us
mono[19560] lock 0x7ff290000020 contended 118 times, 20 avg us
mono[19560] lock 0x7ff29c000020 contended 107 times, 16 avg us
mono[19560] lock 0x1d6d3cc contended 108 times, 62101 avg us
mono[19560] lock 0x7ff250000020 contended 125 times, 10 avg us
mono[19560] lock 0x7ff2a0000020 contended 112 times, 21 avg us
mono[19560] lock 0x7ff268000020 contended 95 times, 14 avg us
mono[19560] lock 0x7ff35d057930 contended 63 times, 701 avg us
mono[19560] lock 0x7ff234000020 contended 129 times, 12 avg us
mono[19560] lock 0xb389b8 contended 2652436 times, 16 avg us
mono[19560] lock 0x7ff244000020 contended 105 times, 14 avg us
mono[19560] lock 0x7ff23c000020 contended 129 times, 11 avg us
mono[19560] lock 0x7ff31acfb9d0 contended 1 times, 72 avg us
mono[19560] lock 0xb68184 contended 26 times, 1356 avg us
mono[19560] lock 0x7ff2621079d0 contended 1 times, 1019 avg us
mono[19560] lock 0xb387e0 contended 3 times, 9 avg us
mono[19560] lock 0x7ff2f17c79d0 contended 1 times, 13 avg us
mono[19560] lock 0x7ff31a1b39d0 contended 1 times, 48 avg us
mono[19560] lock 0xb68360 contended 3 times, 21 avg us
mono[19560] lock 0x7ff3524d59d0 contended 1 times, 24 avg us
mono[19560] lock 0x7ffc11b4c104 contended 1 times, 54 avg us
Comment 5 su21 2017-03-31 07:28:25 UTC
```
threadpool domains_lock 0xb389b8, contended 2652436 times, 16 avg us
threadpool_worker parked_threads_lock 0xb38a40,  contended 775650 times, 1446 avg us
threadpool_worker parked_threads_cond 0xb38a70, contended 19818 times, 30 avg us
threadpool_worker worker_creation_lock 0xb38ab0, contended 115147 times, 25 avg us
```
big lock is evil.
Comment 6 Rodrigo Kumpera 2017-10-11 17:46:44 UTC
I can confirm the above issues on TP.
Comment 7 su21 2017-10-12 13:36:24 UTC
To Rodrigo Kumpera, if you are interested in tackling this issue, you may also want to know:
https://github.com/dotnet/coreclr/pull/13274
https://github.com/dotnet/coreclr/issues/14017
(and more related issues and PRs)
Comment 8 Rodrigo Kumpera 2017-10-14 00:35:05 UTC
*** Bug 18686 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.