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

Benchmark variations #24

Closed
tmds opened this issue Feb 19, 2020 · 41 comments
Closed

Benchmark variations #24

tmds opened this issue Feb 19, 2020 · 41 comments

Comments

@tmds
Copy link
Owner

tmds commented Feb 19, 2020

Default values for benchmarks:
ThreadCount: 1
DeferReceives/DeferSends: false
DispatchContinuations: true

Ordered list:

  • EPollAsyncEngine.useLinuxAio
  • using PipeScheduler.Inline and DispatchContinuations=false, to keep receiving/sending on the epoll/io_uring thread
  • DeferReceives/DeferSends (incl latency)
  • Ring.SubmissionQueueSize/CompletionQueueSize vs nr connections
  • IOUringAsyncEngine/EPollAsyncEngine.threadCount

cc @adamsitnik

@adamsitnik
Copy link
Collaborator

adamsitnik commented Feb 20, 2020

Default settings + AIO turned ON and OFF using Citrine

--path "/plaintext" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=false"
RequestsPerSecond:           618,484
Max CPU (%):                 100
WorkingSet (MB):             76
Avg. Latency (ms):           0.43
Startup (ms):                1
First Request (ms):          44.83
Latency (ms):                0.1
Total Requests:              9,338,876
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,001
Published Size (KB):         1,057
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.1.20113.7
ASP.NET Core:                5.0.0-preview.1.20119.7
--path "/plaintext" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true"
RequestsPerSecond:           671,200
Max CPU (%):                 100
WorkingSet (MB):             74
Avg. Latency (ms):           0.42
Startup (ms):                1
First Request (ms):          45.66
Latency (ms):                0.1
Total Requests:              10,134,851
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,001
Published Size (KB):         1,057
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.1.20113.7
ASP.NET Core:                5.0.0-preview.1.20119.7

@adamsitnik
Copy link
Collaborator

adamsitnik commented Feb 20, 2020

DispatchContinuations=false

--path "/plaintext" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=true"
RequestsPerSecond:           215,437
Max CPU (%):                 45
WorkingSet (MB):             73
Avg. Latency (ms):           1.19
Startup (ms):                1
First Request (ms):          43.09
Latency (ms):                0.1
Total Requests:              3,253,016
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,001
Published Size (KB):         1,057
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.1.20113.7
ASP.NET Core:                5.0.0-preview.1.20119.7

@tmds
Copy link
Owner Author

tmds commented Feb 20, 2020

Is this pipelined? Using non-pipelined gives most visibility to transport changes.

@adamsitnik
Copy link
Collaborator

adamsitnik commented Feb 20, 2020

DeferReceives/DeferSends (incl latency)

 --path "/plaintext" --arg "-e=epoll" --arg "-t=1" --arg "-s=true" --arg "-r=true" --arg "-c=true" --arg "-a=true"
RequestsPerSecond:           77,724
Max CPU (%):                 40
WorkingSet (MB):             75
Avg. Latency (ms):           3.28
Startup (ms):                1
First Request (ms):          41.57
Latency (ms):                0.13
Total Requests:              1,173,617
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,501
Published Size (KB):         1,057
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.1.20113.7
ASP.NET Core:                5.0.0-preview.1.20119.7
--path "/plaintext" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=true" --arg "-c=true" --arg "-a=true"
RequestsPerSecond:           162,405
Max CPU (%):                 64
WorkingSet (MB):             71
Avg. Latency (ms):           1.58
Startup (ms):                1
First Request (ms):          42.52
Latency (ms):                0.12
Total Requests:              2,452,338
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             3,501
Published Size (KB):         1,057
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.1.20113.7
ASP.NET Core:                5.0.0-preview.1.20119.7
--path "/plaintext" --arg "-e=epoll" --arg "-t=1" --arg "-s=true" --arg "-r=false" --arg "-c=true" --arg "-a=true"
RequestsPerSecond:           123,872
Max CPU (%):                 44
WorkingSet (MB):             72
Avg. Latency (ms):           2.06
Startup (ms):                1
First Request (ms):          46.44
Latency (ms):                0.14
Total Requests:              1,870,455
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             3,501
Published Size (KB):         1,057
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.1.20113.7
ASP.NET Core:                5.0.0-preview.1.20119.7

@adamsitnik
Copy link
Collaborator

I currently can not test io_uring because our machines don't have a kernel version which supports it (cc @sebastienros @davidfowl)

[STDERR] Unhandled exception. IoUring.ErrnoException: Function not implemented
[STDERR]    at IoUring.Internal.ThrowHelper.ThrowErrnoException()
[STDERR]    at IoUring.Ring.Setup(UInt32 entries, io_uring_params* p, RingOptions options)
[STDERR]    at IoUring.Ring..ctor(Int32 entries, RingOptions ringOptions)
[STDERR]    at Tmds.LinuxAsync.IOUringAsyncEngine.IOUringExecutionQueue..ctor() in /tmp/benchmarks-agent/benchmarks-server-203/5mlk1hkx.i4k/Tmds.LinuxAsync/src/Tmds.LinuxAsync/IOUringAsyncEngine.IOUringExecutionQueue.cs:line 65
[STDERR]    at Tmds.LinuxAsync.IOUringAsyncEngine.IOUringThread.CreateResources() in /tmp/benchmarks-agent/benchmarks-server-203/5mlk1hkx.i4k/Tmds.LinuxAsync/src/Tmds.LinuxAsync/IOUringAsyncEngine.IOUringThread.cs:line 241
[STDERR]    at Tmds.LinuxAsync.IOUringAsyncEngine.IOUringThread..ctor() in /tmp/benchmarks-agent/benchmarks-server-203/5mlk1hkx.i4k/Tmds.LinuxAsync/src/Tmds.LinuxAsync/IOUringAsyncEngine.IOUringThread.cs:line 42
[STDERR]    at Tmds.LinuxAsync.IOUringAsyncEngine..ctor(Int32 threadCount) in /tmp/benchmarks-agent/benchmarks-server-203/5mlk1hkx.i4k/Tmds.LinuxAsync/src/Tmds.LinuxAsync/IOUringAsyncEngine.cs:line 17
[STDERR]    at web.Program.CreateAsyncEngine(CommandLineOptions commandLineOptions) in /tmp/benchmarks-agent/benchmarks-server-203/5mlk1hkx.i4k/Tmds.LinuxAsync/test/web/Program.cs:line 78
[STDERR]    at web.Program.CreateHostBuilder(String[] args, CommandLineOptions commandLineOptions) in /tmp/benchmarks-agent/benchmarks-server-203/5mlk1hkx.i4k/Tmds.LinuxAsync/test/web/Program.cs:line 52
[STDERR]    at web.Program.<>c__DisplayClass0_0.<Main>b__0(CommandLineOptions options) in /tmp/benchmarks-agent/benchmarks-server-203/5mlk1hkx.i4k/Tmds.LinuxAsync/test/web/Program.cs:line 46
[STDERR]    at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult`1 result, Action`1 action)
[STDERR]    at web.Program.Main(String[] args) in /tmp/benchmarks-agent/benchmarks-server-203/5mlk1hkx.i4k/Tmds.LinuxAsync/test/web/Program.cs:line 44

@adamsitnik
Copy link
Collaborator

Is this pipelined? Using non-pipelined gives most visibility to transport changes.

where can pipelining be configured? I am using the default settings

@adamsitnik
Copy link
Collaborator

adamsitnik commented Feb 20, 2020

Btw If I increase the threads count the numbers get better:

--path "/plaintext" --arg "-e=epoll" --arg "-t=12" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=false"
RequestsPerSecond:           816,404
Max CPU (%):                 99
WorkingSet (MB):             77
Avg. Latency (ms):           1.11
Startup (ms):                1
First Request (ms):          43.79
Latency (ms):                0.11
Total Requests:              12,327,577
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             3,501
Published Size (KB):         1,057
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.1.20113.7
ASP.NET Core:                5.0.0-preview.1.20119.7

@tmds
Copy link
Owner Author

tmds commented Feb 20, 2020

where can pipelining be configured? I am using the default settings

By default wrk doesn't pipeline. The TE benchmark for plaintext does 16 requests sequentially by configuring wrk. If you are using some tooling from https://github.com/aspnet/Benchmarks, the default for plaintext may be to do pipelining.
For json, TE benchmark doesn't do pipelining.

Btw If I increase the threads count the numbers get better:

With threadcount 1, the thread is the bottleneck. Adding more threads gives more rpms.
If it is the bottleneck, then things like DeferSend/DispatchContinuations/DeferReceive may not be capable of delivering. We should set it higher.

@adamsitnik
Copy link
Collaborator

adamsitnik commented Feb 20, 2020

JSON

--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=false"
RequestsPerSecond:           710,085
Max CPU (%):                 100
WorkingSet (MB):             405
Avg. Latency (ms):           0.52
Startup (ms):                1
First Request (ms):          52.48
Latency (ms):                0.1
Total Requests:              10,722,147
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             3,501
Published Size (KB):         1,057
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.1.20113.7
ASP.NET Core:                5.0.0-preview.1.20119.7
--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true"
RequestsPerSecond:           744,197
Max CPU (%):                 100
WorkingSet (MB):             413
Avg. Latency (ms):           0.56
Startup (ms):                1
First Request (ms):          52.18
Latency (ms):                0.1
Total Requests:              11,236,875
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             3,501
Published Size (KB):         1,057
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.1.20113.7
ASP.NET Core:                5.0.0-preview.1.20119.7

Which makes me think that when I am using --repository option with BenchmarkDriver from https://github.com/aspnet/Benchmarks/ the client is not pipelining the requests

@sebastienros how can I force the client to use pipelining when using custom --repository and --path? Sample command:

 --repository https://github.com/tmds/Tmds.LinuxAsync.git --project-file "test/web/web.csproj" --path "/plaintext"

@tmds
Copy link
Owner Author

tmds commented Feb 20, 2020

@adamsitnik can you run additional scenarios for JSON with AIO off to on where we vary ThreadCount and ConnectionCount?

JSON ThreadCount=1 ThreadCount=ProcessorCount
ConnectionCount=256 + ? % + ? %
ConnectionCount=16384 + ? % + ? %

@adamsitnik
Copy link
Collaborator

--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --connections 256   
RequestsPerSecond:           822,837
Max CPU (%):                 100
WorkingSet (MB):             420
Avg. Latency (ms):           0.54
Startup (ms):                1
First Request (ms):          52.63
Latency (ms):                0.1
Total Requests:              12,424,591
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             6,002
Published Size (KB):         1,059
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.1.20113.7
ASP.NET Core:                5.0.0-preview.1.20119.7
--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --connections 16384 
RequestsPerSecond:           435,566
Max CPU (%):                 87
WorkingSet (MB):             2,523
Avg. Latency (ms):           37.31
Startup (ms):                1
First Request (ms):          52.44
Latency (ms):                0.1
Total Requests:              6,576,820
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,001
Published Size (KB):         1,059
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.1.20113.7
ASP.NET Core:                5.0.0-preview.1.20119.7
--path "/json" --arg "-e=epoll" --arg "-t=14" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --connections 256
RequestsPerSecond:           741,792
Max CPU (%):                 99
WorkingSet (MB):             407
Avg. Latency (ms):           1
Startup (ms):                1
First Request (ms):          53.2
Latency (ms):                0.09
Total Requests:              11,200,861
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,001
Published Size (KB):         1,059
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.1.20113.7
ASP.NET Core:                5.0.0-preview.1.20119.7
--path "/json" --arg "-e=epoll" --arg "-t=14" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --connections 16384  
RequestsPerSecond:           628,169
Max CPU (%):                 99
WorkingSet (MB):             2,624
Avg. Latency (ms):           23.74
Startup (ms):                1
First Request (ms):          53.52
Latency (ms):                0.11
Total Requests:              9,486,114
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,001
Published Size (KB):         1,059
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.1.20113.7
ASP.NET Core:                5.0.0-preview.1.20119.7
--path "/json" --arg "-e=epoll" --arg "-t=28" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --connections 256 
RequestsPerSecond:           711,317
Max CPU (%):                 99
WorkingSet (MB):             417
Avg. Latency (ms):           0.75
Startup (ms):                1
First Request (ms):          52.31
Latency (ms):                0.1
Total Requests:              10,740,348
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             3,501
Published Size (KB):         1,059
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.1.20113.7
ASP.NET Core:                5.0.0-preview.1.20119.7
--path "/json" --arg "-e=epoll" --arg "-t=28" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --connections 16384    
RequestsPerSecond:           602,675
Max CPU (%):                 95
WorkingSet (MB):             3,446
Avg. Latency (ms):           23.68
Startup (ms):                1
First Request (ms):          53.43
Latency (ms):                0.1
Total Requests:              9,101,192
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             3,501
Published Size (KB):         1,059
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.1.20113.7
ASP.NET Core:                5.0.0-preview.1.20119.7

@tmds
Copy link
Owner Author

tmds commented Feb 20, 2020

Thanks, Adam. Can you run them also without AIO?
Are these copy-pastable for you?:

--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=false" --connections 256
--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=false" --connections 16384
--path "/json" --arg "-e=epoll" --arg "-t=14" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=false" --connections 256
--path "/json" --arg "-e=epoll" --arg "-t=14" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=false" --connections 16384
--path "/json" --arg "-e=epoll" --arg "-t=28" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=false" --connections 256
--path "/json" --arg "-e=epoll" --arg "-t=28" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=false" --connections 16384

@sebastienros
Copy link

perf has 12 cores and citrine 28 if you need to know how many thread to use.
Pipelining is enabled by using the pipelining lua script like this: https://github.com/aspnet/Benchmarks/blob/master/src/Benchmarks/benchmarks.plaintext.json#L4-L7

This can also be done by command line. Changing the branch and repos should not have any impact on these settings.

Two weeks ago we ran iouring benchmarks successfully on the "perf" machines: Linux asp-perf-lin 5.0.0-37-generic #40~18.04.1-Ubuntu SMP. I agreed to update the kernel on this one to a more recent one which should get even better perf on this scenario.

16K connections is very high, is it reasonable? TE doesn't go near to that number.

@adamsitnik
Copy link
Collaborator

Are these copy-pastable for you?:

Yes, thanks!

 --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=false" --connections 256
RequestsPerSecond:           755,972
Max CPU (%):                 100
WorkingSet (MB):             413
Avg. Latency (ms):           0.65
Startup (ms):                1
First Request (ms):          52.41
Latency (ms):                0.1
Total Requests:              11,414,811
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             7,502
Published Size (KB):         1,059
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.1.20113.7
ASP.NET Core:                5.0.0-preview.1.20120.3
--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=false" --connections 16384
RequestsPerSecond:           452,605
Max CPU (%):                 88
WorkingSet (MB):             2,699
Avg. Latency (ms):           32.86
Startup (ms):                1
First Request (ms):          52.28
Latency (ms):                0.1
Total Requests:              6,834,562
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,001
Published Size (KB):         1,059
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.1.20113.7
ASP.NET Core:                5.0.0-preview.1.20120.3
--path "/json" --arg "-e=epoll" --arg "-t=14" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=false" --connections 256
RequestsPerSecond:           741,398
Max CPU (%):                 99
WorkingSet (MB):             414
Avg. Latency (ms):           0.97
Startup (ms):                1
First Request (ms):          52.56
Latency (ms):                0.12
Total Requests:              11,194,911
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,001
Published Size (KB):         1,059
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.1.20113.7
ASP.NET Core:                5.0.0-preview.1.20120.3
--path "/json" --arg "-e=epoll" --arg "-t=14" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=false" --connections 16384
RequestsPerSecond:           635,108
Max CPU (%):                 99
WorkingSet (MB):             1,997
Avg. Latency (ms):           22.24
Startup (ms):                1
First Request (ms):          52.38
Latency (ms):                0.12
Total Requests:              9,590,801
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,001
Published Size (KB):         1,059
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.1.20113.7
ASP.NET Core:                5.0.0-preview.1.20120.3
--path "/json" --arg "-e=epoll" --arg "-t=28" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=false" --connections 256
RequestsPerSecond:           705,436
Max CPU (%):                 98
WorkingSet (MB):             400
Avg. Latency (ms):           0.67
Startup (ms):                1
First Request (ms):          53.35
Latency (ms):                0.1
Total Requests:              10,651,781
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,001
Published Size (KB):         1,059
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.1.20113.7
ASP.NET Core:                5.0.0-preview.1.20120.3
--path "/json" --arg "-e=epoll" --arg "-t=28" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=false" --connections 16384
RequestsPerSecond:           601,867
Max CPU (%):                 96
WorkingSet (MB):             3,359
Avg. Latency (ms):           24.5
Startup (ms):                1
First Request (ms):          55.85
Latency (ms):                0.1
Total Requests:              9,088,326
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             3,501
Published Size (KB):         1,059
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.1.20113.7
ASP.NET Core:                5.0.0-preview.1.20120.3

@adamsitnik
Copy link
Collaborator

This can also be done by command line.

thanks! Now I am going to try the plaintext

-p ScriptName=pipeline -p PipelineDepth=16

@adamsitnik
Copy link
Collaborator

Pipelined: AIO on an off with a single thread:

--path "/plaintext" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=false" --connections 256 -p ScriptName=pipeline -p PipelineDepth=16

--path "/plaintext" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --connections 256 -p ScriptName=pipeline -p PipelineDepth=16
RequestsPerSecond:           3,996,922
Max CPU (%):                 98
WorkingSet (MB):             72
Avg. Latency (ms):           0.81
Startup (ms):                1
First Request (ms):          44.94
Latency (ms):                0.1
Total Requests:              60,353,091
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             3,501
Published Size (KB):         1,059
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.1.20113.7
ASP.NET Core:                5.0.0-preview.1.20120.3

There is almost no difference, which is very surprising to me.

We should most probably add an option to run the "platform" benchmark and use the bare minimum thing which would reduce the aspnet noise and allow us to get to maximum throughput

https://github.com/aspnet/Benchmarks/blob/9cffccb8ad4579b23f5ece871ef537ff6afb6e43/src/BenchmarksApps/Kestrel/PlatformBenchmarks/Program.cs#L23-L44

@adamsitnik
Copy link
Collaborator

Two weeks ago we ran iouring benchmarks successfully on the "perf" machines: Linux asp-perf-lin 5.0.0-37-generic #40~18.04.1-Ubuntu SMP:

@sebastienros thansk! I've tried to run it on the perf machine and got following error

[STDERR] Unhandled exception. IoUring.ErrnoException: Function not implemented
[STDERR]    at IoUring.Internal.ThrowHelper.ThrowErrnoException()
[STDERR]    at IoUring.Ring.Setup(UInt32 entries, io_uring_params* p, RingOptions options)
[STDERR]    at IoUring.Ring..ctor(Int32 entries, RingOptions ringOptions)
[STDERR]    at Tmds.LinuxAsync.IOUringAsyncEngine.IOUringExecutionQueue..ctor() in /tmp/benchmarks-agent/benchmarks-server-161/yunaysw5.uki/Tmds.LinuxAsync/src/Tmds.LinuxAsync/IOUringAsyncEngine.IOUringExecutionQueue.cs:line 67
[STDERR]    at Tmds.LinuxAsync.IOUringAsyncEngine.IOUringThread.CreateResources() in /tmp/benchmarks-agent/benchmarks-server-161/yunaysw5.uki/Tmds.LinuxAsync/src/Tmds.LinuxAsync/IOUringAsyncEngine.IOUringThread.cs:line 241
[STDERR]    at Tmds.LinuxAsync.IOUringAsyncEngine.IOUringThread..ctor() in /tmp/benchmarks-agent/benchmarks-server-161/yunaysw5.uki/Tmds.LinuxAsync/src/Tmds.LinuxAsync/IOUringAsyncEngine.IOUringThread.cs:line 42
[STDERR]    at Tmds.LinuxAsync.IOUringAsyncEngine..ctor(Int32 threadCount) in /tmp/benchmarks-agent/benchmarks-server-161/yunaysw5.uki/Tmds.LinuxAsync/src/Tmds.LinuxAsync/IOUringAsyncEngine.cs:line 17
[STDERR]    at web.Program.CreateAsyncEngine(CommandLineOptions commandLineOptions) in /tmp/benchmarks-agent/benchmarks-server-161/yunaysw5.uki/Tmds.LinuxAsync/test/web/Program.cs:line 51
[STDERR]    at web.Program.CreateHostBuilder(String[] args, CommandLineOptions commandLineOptions) in /tmp/benchmarks-agent/benchmarks-server-161/yunaysw5.uki/Tmds.LinuxAsync/test/web/Program.cs:line 25
[STDERR]    at web.Program.Main(String[] args) in /tmp/benchmarks-agent/benchmarks-server-161/yunaysw5.uki/Tmds.LinuxAsync/test/web/Program.cs:line 19

@tmds Is 5.0.0-37-generic #40~18.04.1-Ubuntu SMP not enough or there is some problem in managed implementation?

@tmds
Copy link
Owner Author

tmds commented Feb 21, 2020

Putting the results in a table:

AIO on vs off TC=1 TC=14 TC=28
CC=256 + 8.8 % + 0.1 % + 0.8 %
CC=16384 - 3.8 % - 1.1 % + 0.1 %

AIO batching relies epoll giving it multiple events of different sockets. So there needs to be enough sockets on the same epoll for this to happen. The CC vs TC for these benchmarks is:

CC/TC TC=1 TC=14 TC=28
CC=256 256 18 9
CC=16384 16384 1170 585

We see two effects in the benchmarks:

  • Enough connections needs to be on the same epoll for batching to occur
  • Not too many connections can be on the same epoll or it is a bottleneck

There is almost no difference, which is very surprising to me.

The pipelining means only 1/16 requests actually needs to read/write to the socket. So 3996922 HTTP requests, is 249807 network requests. This number is far lower than the requests we're making in the JSON benchmark, so there is also lower chance of batching.

@tkp1n
Copy link
Contributor

tkp1n commented Feb 21, 2020

@tmds Is 5.0.0-37-generic #40~18.04.1-Ubuntu SMP not enough or there is some problem in managed implementation?

@adamsitnik
5.1 was the first version of the kernel with io_uring support.
The implementation here requires features (e.g. IORING_FEAT_NODROP, IORING_FEAT_SUBMIT_STABLE, IORING_OP_ASYNC_CANCEL) that were not added before v5.5

@tmds
Copy link
Owner Author

tmds commented Feb 21, 2020

16K connections is very high, is it reasonable? TE doesn't go near to that number.

As reference benchmark we can use json with 256 connections and 1 thread (as long as that gives us Max CPU (%): 100).

The implementation here requires features (e.g. IORING_FEAT_NODROP, IORING_FEAT_SUBMIT_STABLE, IORING_OP_ASYNC_CANCEL) that were not added before v5.5

Yes, 5.5 has the interesting feature set I'd use as a minimal version. Especially IORING_FEAT_NODROP which is needed to handle a large nr of open connections.

@tmds
Copy link
Owner Author

tmds commented Feb 24, 2020

@adamsitnik can we run a benchmarks where we check the effect of defersends/deferreceives with aio while keeping dispatch continuations at the default (dispatching to threadpool)?

--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --connections 256
--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=true" --arg "-r=false" --arg "-c=true" --arg "-a=true" --connections 256
--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=true" --arg "-c=true" --arg "-a=true" --connections 256
--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=true" --arg "-r=true" --arg "-c=true" --arg "-a=true" --connections 256

@adamsitnik
Copy link
Collaborator

Here you go:

--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --connections 256
RequestsPerSecond:           771,453
Max CPU (%):                 100
WorkingSet (MB):             405
Avg. Latency (ms):           0.47
Startup (ms):                1
First Request (ms):          51.58
Latency (ms):                0.1
Total Requests:              11,648,581
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             9,503
Published Size (KB):         1,059
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20120.8
ASP.NET Core:                5.0.0-preview.2.20121.13
--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=true" --arg "-r=false" --arg "-c=true" --arg "-a=true" --connections 256
RequestsPerSecond:           127,836
Max CPU (%):                 43
WorkingSet (MB):             423
Avg. Latency (ms):           2
Startup (ms):                1
First Request (ms):          54.43
Latency (ms):                0.11
Total Requests:              1,930,317
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,001
Published Size (KB):         1,059
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20120.8
ASP.NET Core:                5.0.0-preview.2.20121.13
--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=true" --arg "-c=true" --arg "-a=true" --connections 256
RequestsPerSecond:           169,235
Max CPU (%):                 62
WorkingSet (MB):             394
Avg. Latency (ms):           1.51
Startup (ms):                1
First Request (ms):          51.5
Latency (ms):                0.13
Total Requests:              2,555,339
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,001
Published Size (KB):         1,059
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20120.8
ASP.NET Core:                5.0.0-preview.2.20121.13
--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=true" --arg "-r=true" --arg "-c=true" --arg "-a=true" --connections 256
RequestsPerSecond:           77,807
Max CPU (%):                 39
WorkingSet (MB):             379
Avg. Latency (ms):           3.28
Startup (ms):                1
First Request (ms):          52.31
Latency (ms):                0.12
Total Requests:              1,174,891
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             3,501
Published Size (KB):         1,059
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20120.8
ASP.NET Core:                5.0.0-preview.2.20121.13

@tmds
Copy link
Owner Author

tmds commented Feb 24, 2020

Thanks Adam. The single epoll thread is a bottleneck (Max CPU (%) << 100).
Can you try incrementing t for the last benchmark ("-s=true", "-r=true") until CPU is at 100? And then run all 4 benchmarks with that value for t?

@adamsitnik
Copy link
Collaborator

Sure! BTW I was unable to get 100% CPU, 99% was max.

--path "/json" --arg "-e=epoll" --arg "-t=12" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --connections 256
RequestsPerSecond:           723,621
Max CPU (%):                 99
WorkingSet (MB):             399
Avg. Latency (ms):           0.99
Startup (ms):                1
First Request (ms):          52.13
Latency (ms):                0.1
Total Requests:              10,926,581
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,501
Published Size (KB):         1,059
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20120.8
ASP.NET Core:                5.0.0-preview.2.20121.13
--path "/json" --arg "-e=epoll" --arg "-t=12" --arg "-s=true" --arg "-r=false" --arg "-c=true" --arg "-a=true" --connections 256
RequestsPerSecond:           634,366
Max CPU (%):                 100
WorkingSet (MB):             410
Avg. Latency (ms):           0.5
Startup (ms):                1
First Request (ms):          55.44
Latency (ms):                0.11
Total Requests:              9,578,745
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             3,501
Published Size (KB):         1,059
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20120.8
ASP.NET Core:                5.0.0-preview.2.20121.13
--path "/json" --arg "-e=epoll" --arg "-t=12" --arg "-s=false" --arg "-r=true" --arg "-c=true" --arg "-a=true" --connections 256
RequestsPerSecond:           662,192
Max CPU (%):                 98
WorkingSet (MB):             402
Avg. Latency (ms):           1.05
Startup (ms):                1
First Request (ms):          51.07
Latency (ms):                0.13
Total Requests:              9,998,736
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             3,501
Published Size (KB):         1,059
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20120.8
ASP.NET Core:                5.0.0-preview.2.20121.13
--path "/json" --arg "-e=epoll" --arg "-t=12" --arg "-s=true" --arg "-r=true" --arg "-c=true" --arg "-a=true" --connections 256
RequestsPerSecond:           592,811
Max CPU (%):                 99
WorkingSet (MB):             412
Avg. Latency (ms):           1.13
Startup (ms):                1
First Request (ms):          51.92
Latency (ms):                0.12
Total Requests:              8,950,992
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,001
Published Size (KB):         1,059
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20120.8
ASP.NET Core:                5.0.0-preview.2.20121.13

@tmds
Copy link
Owner Author

tmds commented Feb 24, 2020

BTW I was unable to get 100% CPU, 99% was max.

99 is fine too. The previous benchmarks had values as low as 39%.
With t=12, there is only about 21 sockets per thread. So the batching is low. The net effect is negative due to the overhead of deferring.

batching delta
sends -12.3%
receives -8.4%
both -18%

How much do you get with a value of t=2/t=3?

--path "/json" --arg "-e=epoll" --arg "-t=2" --arg "-s=true" --arg "-r=true" --arg "-c=true" --arg "-a=true" --connections 256
--path "/json" --arg "-e=epoll" --arg "-t=3" --arg "-s=true" --arg "-r=true" --arg "-c=true" --arg "-a=true" --connections 256

@adamsitnik
Copy link
Collaborator

How much do you get with a value of t=2/t=3?

--path "/json" --arg "-e=epoll" --arg "-t=2" --arg "-s=true" --arg "-r=true" --arg "-c=true" --arg "-a=true" --connections 256
RequestsPerSecond:           127,924
Max CPU (%):                 69
WorkingSet (MB):             403
Avg. Latency (ms):           2.01
Startup (ms):                1
First Request (ms):          65.49
Latency (ms):                0.14
Total Requests:              1,931,608
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             3,501
Published Size (KB):         1,059
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20120.8
ASP.NET Core:                5.0.0-preview.2.20121.13
--path "/json" --arg "-e=epoll" --arg "-t=3" --arg "-s=true" --arg "-r=true" --arg "-c=true" --arg "-a=true" --connections 256
RequestsPerSecond:           182,486
Max CPU (%):                 85
WorkingSet (MB):             403
Avg. Latency (ms):           1.45
Startup (ms):                1
First Request (ms):          52.12
Latency (ms):                0.12
Total Requests:              2,755,433
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             3,501
Published Size (KB):         1,059
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20120.8
ASP.NET Core:                5.0.0-preview.2.20121.13

@tmds
Copy link
Owner Author

tmds commented Feb 24, 2020

Thanks!

a value of t=2/t=3?

Those numbers are even far lower.
We haven't seen an improvement from defer send/receive in any benchmark so far.

I assume increasing the threadcount further won't help because that will reduce the nr of connections per socket per thread even more.

TE JSON benchmarks max connections is 512.
For klt, there are ProcessorCount threads by default. So on the 28 core machine, there are only about 9 sockets per thread.

@tmds
Copy link
Owner Author

tmds commented Feb 27, 2020

@adamsitnik I wonder how much performance differs if we batch receives by a. running the receiveloop on epoll thread using c=false, and b. schedule receives from receiveloop on threadpool to the epoll thread using r=true.

Can you run the benchmarks, and also share the perftrace files?

(w=false is set to get rid of 0-byte receives)

--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --arg "-w=false" --connections 256
--path "/json" --arg "-e=epoll" --arg "-t=4" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=true" --arg "-w=false" --connections 256
--path "/json" --arg "-e=epoll" --arg "-t=4" --arg "-s=false" --arg "-r=true" --arg "-c=true" --arg "-a=true" --arg "-w=false" --connections 256

@adamsitnik
Copy link
Collaborator

--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --arg "-w=false" --connections 256
RequestsPerSecond:           426,750
Max CPU (%):                 100
WorkingSet (MB):             184
Avg. Latency (ms):           1.33
Startup (ms):                1
First Request (ms):          85.35
Latency (ms):                1.12
Total Requests:              6,443,964
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             5,002
Published Size (KB):         1,060
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20125.16
ASP.NET Core:                5.0.0-preview.2.20126.7
--path "/json" --arg "-e=epoll" --arg "-t=4" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=true" --arg "-w=false" --connections 256
RequestsPerSecond:           468,014
Max CPU (%):                 100
WorkingSet (MB):             194
Avg. Latency (ms):           0.93
Startup (ms):                1
First Request (ms):          89.34
Latency (ms):                0.68
Total Requests:              7,062,836
Duration: (ms)               15,090
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,001
Published Size (KB):         1,060
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20125.16
ASP.NET Core:                5.0.0-preview.2.20126.7
--path "/json" --arg "-e=epoll" --arg "-t=4" --arg "-s=false" --arg "-r=true" --arg "-c=true" --arg "-a=true" --arg "-w=false" --connections 256
RequestsPerSecond:           400,111
Max CPU (%):                 96
WorkingSet (MB):             191
Avg. Latency (ms):           1
Startup (ms):                1
First Request (ms):          92.74
Latency (ms):                0.78
Total Requests:              6,041,599
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,001
Published Size (KB):         1,060
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20125.16
ASP.NET Core:                5.0.0-preview.2.20126.7

Can you run the benchmarks, and also share the perftrace files?

Do you have any preferences for file shares? I have none. Would g drive be OK?

@tmds
Copy link
Owner Author

tmds commented Feb 27, 2020

Thank you! gdrive works for me.

@tmds
Copy link
Owner Author

tmds commented Mar 2, 2020

@adamsitnik I'd like to know the impact of completing on threadpool (c=true) vs inline (c=false). Can you run these benchmarks?

--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=true" --arg "-w=false" --connections 256
--path "/json" --arg "-e=epoll" --arg "-t=2" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=true" --arg "-w=false" --connections 256
--path "/json" --arg "-e=epoll" --arg "-t=3" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=true" --arg "-w=false" --connections 256
--path "/json" --arg "-e=epoll" --arg "-t=4" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=true" --arg "-w=false" --connections 256

--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --arg "-w=false" --connections 256
--path "/json" --arg "-e=epoll" --arg "-t=2" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --arg "-w=false" --connections 256
--path "/json" --arg "-e=epoll" --arg "-t=3" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --arg "-w=false" --connections 256
--path "/json" --arg "-e=epoll" --arg "-t=4" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --arg "-w=false" --connections 256

@adamsitnik
Copy link
Collaborator

@tmds here you go!

--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=true" --arg "-w=false" --connections 256
RequestsPerSecond:           340,421
Max CPU (%):                 85
WorkingSet (MB):             206
Avg. Latency (ms):           0.75
Startup (ms):                2
First Request (ms):          88.29
Latency (ms):                1.13
Total Requests:              5,140,294
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             8,002
Published Size (KB):         1,060
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20127.14
ASP.NET Core:                5.0.0-preview.2.20128.11
--path "/json" --arg "-e=epoll" --arg "-t=2" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=true" --arg "-w=false" --connections 256
RequestsPerSecond:           420,101
Max CPU (%):                 98
WorkingSet (MB):             184
Avg. Latency (ms):           0.87
Startup (ms):                2
First Request (ms):          91.07
Latency (ms):                0.71
Total Requests:              6,342,673
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,002
Published Size (KB):         1,060
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20127.14
ASP.NET Core:                5.0.0-preview.2.20128.11
--path "/json" --arg "-e=epoll" --arg "-t=3" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=true" --arg "-w=false" --connections 256
RequestsPerSecond:           465,239
Max CPU (%):                 99
WorkingSet (MB):             191
Avg. Latency (ms):           1.02
Startup (ms):                2
First Request (ms):          91.65
Latency (ms):                0.43
Total Requests:              7,024,755
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,502
Published Size (KB):         1,060
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20127.14
ASP.NET Core:                5.0.0-preview.2.20128.11
--path "/json" --arg "-e=epoll" --arg "-t=4" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=true" --arg "-w=false" --connections 256
RequestsPerSecond:           454,632
Max CPU (%):                 99
WorkingSet (MB):             179
Avg. Latency (ms):           1
Startup (ms):                2
First Request (ms):          94.04
Latency (ms):                0.66
Total Requests:              6,857,177
Duration: (ms)               15,080
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,002
Published Size (KB):         1,060
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20127.14
ASP.NET Core:                5.0.0-preview.2.20128.11
--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --arg "-w=false" --connections 256
RequestsPerSecond:           436,574
Max CPU (%):                 100
WorkingSet (MB):             196
Avg. Latency (ms):           1.07
Startup (ms):                2
First Request (ms):          94.26
Latency (ms):                0.55
Total Requests:              6,581,070
Duration: (ms)               15,070
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,502
Published Size (KB):         1,060
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20127.14
ASP.NET Core:                5.0.0-preview.2.20128.11
--path "/json" --arg "-e=epoll" --arg "-t=2" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --arg "-w=false" --connections 256
RequestsPerSecond:           413,480
Max CPU (%):                 99
WorkingSet (MB):             178
Avg. Latency (ms):           1.23
Startup (ms):                2
First Request (ms):          93.33
Latency (ms):                0.62
Total Requests:              6,243,499
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,502
Published Size (KB):         1,060
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20127.14
ASP.NET Core:                5.0.0-preview.2.20128.11
--path "/json" --arg "-e=epoll" --arg "-t=3" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --arg "-w=false" --connections 256
RequestsPerSecond:           415,030
Max CPU (%):                 99
WorkingSet (MB):             187
Avg. Latency (ms):           0.93
Startup (ms):                2
First Request (ms):          91.91
Latency (ms):                0.65
Total Requests:              6,266,858
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,001
Published Size (KB):         1,060
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20127.14
ASP.NET Core:                5.0.0-preview.2.20128.11
--path "/json" --arg "-e=epoll" --arg "-t=4" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --arg "-w=false" --connections 256
RequestsPerSecond:           402,747
Max CPU (%):                 99
WorkingSet (MB):             178
Avg. Latency (ms):           1.16
Startup (ms):                2
First Request (ms):          93.31
Latency (ms):                0.46
Total Requests:              6,081,425
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,502
Published Size (KB):         1,060
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20127.14
ASP.NET Core:                5.0.0-preview.2.20128.11

@tmds
Copy link
Owner Author

tmds commented Mar 2, 2020

Thank you!
Can you run these too (AIO gets disabled)?

--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=false" --arg "-w=false" --connections 256
--path "/json" --arg "-e=epoll" --arg "-t=2" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=false" --arg "-w=false" --connections 256
--path "/json" --arg "-e=epoll" --arg "-t=3" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=false" --arg "-w=false" --connections 256
--path "/json" --arg "-e=epoll" --arg "-t=4" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=false" --arg "-w=false" --connections 256

@adamsitnik
Copy link
Collaborator

--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=false" --arg "-w=false" --connections 256
RequestsPerSecond:           221,780
Max CPU (%):                 99
WorkingSet (MB):             187
Avg. Latency (ms):           1.21
Startup (ms):                1
First Request (ms):          95.33
Latency (ms):                0.62
Total Requests:              3,348,835
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,502
Published Size (KB):         1,061
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20127.14
ASP.NET Core:                5.0.0-preview.2.20128.11
--path "/json" --arg "-e=epoll" --arg "-t=2" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=false" --arg "-w=false" --connections 256
RequestsPerSecond:           360,599
Max CPU (%):                 100
WorkingSet (MB):             184
Avg. Latency (ms):           1.11
Startup (ms):                1
First Request (ms):          96.31
Latency (ms):                0.38
Total Requests:              5,444,835
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,502
Published Size (KB):         1,061
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20127.14
ASP.NET Core:                5.0.0-preview.2.20128.11
--path "/json" --arg "-e=epoll" --arg "-t=3" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=false" --arg "-w=false" --connections 256
RequestsPerSecond:           406,320
Max CPU (%):                 100
WorkingSet (MB):             204
Avg. Latency (ms):           1.76
Startup (ms):                2
First Request (ms):          94.63
Latency (ms):                0.45
Total Requests:              6,135,266
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,002
Published Size (KB):         1,061
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20127.14
ASP.NET Core:                5.0.0-preview.2.20128.11
--path "/json" --arg "-e=epoll" --arg "-t=4" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=false" --arg "-w=false" --connections 256
RequestsPerSecond:           423,430
Max CPU (%):                 100
WorkingSet (MB):             189
Avg. Latency (ms):           1.85
Startup (ms):                1
First Request (ms):          93.64
Latency (ms):                0.55
Total Requests:              6,391,666
Duration: (ms)               15,090
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,502
Published Size (KB):         1,061
SDK:                         5.0.100-preview.1.20106.1
Runtime:                     5.0.0-preview.2.20127.14
ASP.NET Core:                5.0.0-preview.2.20128.11

@tmds
Copy link
Owner Author

tmds commented Mar 18, 2020

@adamsitnik Based on what we've benchmarked so far, I propose we look at these benchmarks and figure out if there is some things we can optimize further from traces.

// use AIO, disable zero-byte read from Kestrel, run continuations on ThreadPool as corefx does
--path "/json" --arg "-e=epoll" --arg "-t=x" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --arg "-w=false" --connections 256
// use AIO, disable zero-byte read from Kestrel, run continuations on epoll thread by setting new property `SocketAsyncEventArgs.RunContinuationsAsynchronously=false`.
--path "/json" --arg "-e=epoll" --arg "-t=x" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=true" --arg "-w=false" --connections 256

I set t=x because we should run benchmark for t=1..ProcessorCount. We'll look at traces for these two scenarios at their best t.

@adamsitnik
Copy link
Collaborator

--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --arg "-w=false" --connections 256
RequestsPerSecond:           405,627
Max CPU (%):                 99
WorkingSet (MB):             193
Avg. Latency (ms):           1.05
Startup (ms):                9
First Request (ms):          134.2
Latency (ms):                0.2
Total Requests:              6,124,667
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             5,506
Published Size (KB):         1,138
SDK:                         5.0.100-preview.2.20120.3
Runtime:                     5.0.0-preview.2.20155.3
ASP.NET Core:                5.0.0-preview.3.20167.1
--path "/json" --arg "-e=epoll" --arg "-t=2" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --arg "-w=false" --connections 256
RequestsPerSecond:           405,903
Max CPU (%):                 99
WorkingSet (MB):             182
Avg. Latency (ms):           1.4
Startup (ms):                2
First Request (ms):          118.2
Latency (ms):                0.34
Total Requests:              6,129,154
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             8,503
Published Size (KB):         1,138
SDK:                         5.0.100-preview.2.20120.3
Runtime:                     5.0.0-preview.2.20155.3
ASP.NET Core:                5.0.0-preview.3.20167.1
--path "/json" --arg "-e=epoll" --arg "-t=3" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --arg "-w=false" --connections 256
RequestsPerSecond:           398,524
Max CPU (%):                 98
WorkingSet (MB):             188
Avg. Latency (ms):           1.36
Startup (ms):                2
First Request (ms):          114.69
Latency (ms):                0.44
Total Requests:              6,017,432
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,002
Published Size (KB):         1,138
SDK:                         5.0.100-preview.2.20120.3
Runtime:                     5.0.0-preview.2.20155.3
ASP.NET Core:                5.0.0-preview.3.20167.1
--path "/json" --arg "-e=epoll" --arg "-t=4" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --arg "-w=false" --connections 256
RequestsPerSecond:           392,457
Max CPU (%):                 99
WorkingSet (MB):             192
Avg. Latency (ms):           1.48
Startup (ms):                2
First Request (ms):          119.35
Latency (ms):                0.5
Total Requests:              5,925,861
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,502
Published Size (KB):         1,138
SDK:                         5.0.100-preview.2.20120.3
Runtime:                     5.0.0-preview.2.20155.3
ASP.NET Core:                5.0.0-preview.3.20167.1
--path "/json" --arg "-e=epoll" --arg "-t=5" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --arg "-w=false" --connections 256
RequestsPerSecond:           369,501
Max CPU (%):                 99
WorkingSet (MB):             195
Avg. Latency (ms):           1.81
Startup (ms):                2
First Request (ms):          106.91
Latency (ms):                0.36
Total Requests:              5,579,341
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,002
Published Size (KB):         1,138
SDK:                         5.0.100-preview.2.20120.3
Runtime:                     5.0.0-preview.2.20155.3
ASP.NET Core:                5.0.0-preview.3.20167.1
--path "/json" --arg "-e=epoll" --arg "-t=6" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=true" --arg "-w=false" --connections 256
RequestsPerSecond:           374,760
Max CPU (%):                 99
WorkingSet (MB):             200
Avg. Latency (ms):           1.53
Startup (ms):                2
First Request (ms):          110.58
Latency (ms):                0.41
Total Requests:              5,658,532
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,002
Published Size (KB):         1,138
SDK:                         5.0.100-preview.2.20120.3
Runtime:                     5.0.0-preview.2.20155.3
ASP.NET Core:                5.0.0-preview.3.20167.1
--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=true" --arg "-w=false" --connections 256
RequestsPerSecond:           323,026
Max CPU (%):                 82
WorkingSet (MB):             181
Avg. Latency (ms):           0.8
Startup (ms):                2
First Request (ms):          121.86
Latency (ms):                0.39
Total Requests:              4,877,719
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,001
Published Size (KB):         1,138
SDK:                         5.0.100-preview.2.20120.3
Runtime:                     5.0.0-preview.2.20155.3
ASP.NET Core:                5.0.0-preview.3.20167.1
--path "/json" --arg "-e=epoll" --arg "-t=2" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=true" --arg "-w=false" --connections 256
RequestsPerSecond:           398,502
Max CPU (%):                 97
WorkingSet (MB):             193
Avg. Latency (ms):           0.72
Startup (ms):                2
First Request (ms):          116.95
Latency (ms):                0.21
Total Requests:              6,017,012
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,002
Published Size (KB):         1,138
SDK:                         5.0.100-preview.2.20120.3
Runtime:                     5.0.0-preview.2.20155.3
ASP.NET Core:                5.0.0-preview.3.20167.1
--path "/json" --arg "-e=epoll" --arg "-t=3" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=true" --arg "-w=false" --connections 256
RequestsPerSecond:           442,633
Max CPU (%):                 99
WorkingSet (MB):             181
Avg. Latency (ms):           0.97
Startup (ms):                2
First Request (ms):          119.11
Latency (ms):                0.29
Total Requests:              6,670,835
Duration: (ms)               15,070
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,502
Published Size (KB):         1,138
SDK:                         5.0.100-preview.2.20120.3
Runtime:                     5.0.0-preview.2.20155.3
ASP.NET Core:                5.0.0-preview.3.20167.1
--path "/json" --arg "-e=epoll" --arg "-t=4" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=true" --arg "-w=false" --connections 256
RequestsPerSecond:           453,413
Max CPU (%):                 99
WorkingSet (MB):             206
Avg. Latency (ms):           1.17
Startup (ms):                1
First Request (ms):          117.1
Latency (ms):                0.32
Total Requests:              6,839,349
Duration: (ms)               15,080
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,002
Published Size (KB):         1,138
SDK:                         5.0.100-preview.2.20120.3
Runtime:                     5.0.0-preview.2.20155.3
ASP.NET Core:                5.0.0-preview.3.20167.1
--path "/json" --arg "-e=epoll" --arg "-t=5" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=true" --arg "-w=false" --connections 256
RequestsPerSecond:           426,864
Max CPU (%):                 99
WorkingSet (MB):             196
Avg. Latency (ms):           1.23
Startup (ms):                2
First Request (ms):          121.2
Latency (ms):                0.32
Total Requests:              6,445,248
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,001
Published Size (KB):         1,138
SDK:                         5.0.100-preview.2.20120.3
Runtime:                     5.0.0-preview.2.20155.3
ASP.NET Core:                5.0.0-preview.3.20167.1
--path "/json" --arg "-e=epoll" --arg "-t=6" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=true" --arg "-w=false" --connections 256
RequestsPerSecond:           439,181
Max CPU (%):                 99
WorkingSet (MB):             190
Avg. Latency (ms):           1.09
Startup (ms):                2
First Request (ms):          120.54
Latency (ms):                0.45
Total Requests:              6,631,221
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,502
Published Size (KB):         1,138
SDK:                         5.0.100-preview.2.20120.3
Runtime:                     5.0.0-preview.2.20155.3
ASP.NET Core:                5.0.0-preview.3.20167.1

@adamsitnik
Copy link
Collaborator

@tmds I've uploaded the traces to a subfolder called "19_03_2020"

@tmds
Copy link
Owner Author

tmds commented Mar 18, 2020

Thank you!

Let's make a graph.

With AIO, continue on threadpool (c=true) vs stay on epoll thread (c=false):

rps

So when we batch and defer to threadpool after receive, we see best performance at t=1.
When we batch and stay on epoll thread after receive, we see best performance at t=4.
The difference is +11%.

Adam, can you also run these benchmarks without AIO?

// no AIO, disable zero-byte read from Kestrel, run continuations on ThreadPool as corefx does
--path "/json" --arg "-e=epoll" --arg "-t=x" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=false" --arg "-w=false" --connections 256
// no AIO, disable zero-byte read from Kestrel, run continuations on epoll thread by setting new property `SocketAsyncEventArgs.RunContinuationsAsynchronously=false`.
--path "/json" --arg "-e=epoll" --arg "-t=x" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=false" --arg "-w=false" --connections 256

@adamsitnik
Copy link
Collaborator

--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=false" --arg "-w=false" --connections 256
RequestsPerSecond:           370,107
Max CPU (%):                 100
WorkingSet (MB):             206
Avg. Latency (ms):           0.79
Startup (ms):                2
First Request (ms):          120.86
Latency (ms):                0.37
Total Requests:              5,588,575
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             8,002
Published Size (KB):         1,138
SDK:                         5.0.100-preview.2.20120.3
Runtime:                     5.0.0-preview.2.20155.3
ASP.NET Core:                5.0.0-preview.3.20167.1
--path "/json" --arg "-e=epoll" --arg "-t=2" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=false" --arg "-w=false" --connections 256
RequestsPerSecond:           382,459
Max CPU (%):                 99
WorkingSet (MB):             198
Avg. Latency (ms):           2.39
Startup (ms):                2
First Request (ms):          120.16
Latency (ms):                0.36
Total Requests:              5,774,832
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,502
Published Size (KB):         1,138
SDK:                         5.0.100-preview.2.20120.3
Runtime:                     5.0.0-preview.2.20155.3
ASP.NET Core:                5.0.0-preview.3.20167.1
--path "/json" --arg "-e=epoll" --arg "-t=3" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=false" --arg "-w=false" --connections 256
RequestsPerSecond:           404,910
Max CPU (%):                 99
WorkingSet (MB):             194
Avg. Latency (ms):           1.18
Startup (ms):                2
First Request (ms):          116.96
Latency (ms):                0.33
Total Requests:              6,114,090
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,502
Published Size (KB):         1,138
SDK:                         5.0.100-preview.2.20120.3
Runtime:                     5.0.0-preview.2.20155.3
ASP.NET Core:                5.0.0-preview.3.20167.1
--path "/json" --arg "-e=epoll" --arg "-t=4" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=false" --arg "-w=false" --connections 256
RequestsPerSecond:           396,620
Max CPU (%):                 99
WorkingSet (MB):             201
Avg. Latency (ms):           1.51
Startup (ms):                1
First Request (ms):          123.04
Latency (ms):                0.37
Total Requests:              5,988,841
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,502
Published Size (KB):         1,138
SDK:                         5.0.100-preview.2.20120.3
Runtime:                     5.0.0-preview.2.20155.3
ASP.NET Core:                5.0.0-preview.3.20167.1
--path "/json" --arg "-e=epoll" --arg "-t=5" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=false" --arg "-w=false" --connections 256
RequestsPerSecond:           373,512
Max CPU (%):                 99
WorkingSet (MB):             190
Avg. Latency (ms):           1.79
Startup (ms):                1
First Request (ms):          119.33
Latency (ms):                0.31
Total Requests:              5,640,049
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,502
Published Size (KB):         1,138
SDK:                         5.0.100-preview.2.20120.3
Runtime:                     5.0.0-preview.2.20155.3
ASP.NET Core:                5.0.0-preview.3.20167.1
--path "/json" --arg "-e=epoll" --arg "-t=6" --arg "-s=false" --arg "-r=false" --arg "-c=true" --arg "-a=false" --arg "-w=false" --connections 256
RequestsPerSecond:           373,213
Max CPU (%):                 99
WorkingSet (MB):             212
Avg. Latency (ms):           1.64
Startup (ms):                2
First Request (ms):          110.26
Latency (ms):                0.39
Total Requests:              5,635,509
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,502
Published Size (KB):         1,138
SDK:                         5.0.100-preview.2.20120.3
Runtime:                     5.0.0-preview.2.20155.3
ASP.NET Core:                5.0.0-preview.3.20167.1
--path "/json" --arg "-e=epoll" --arg "-t=1" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=false" --arg "-w=false" --connections 256
RequestsPerSecond:           196,196
Max CPU (%):                 98
WorkingSet (MB):             193
Avg. Latency (ms):           1.33
Startup (ms):                2
First Request (ms):          118.57
Latency (ms):                0.36
Total Requests:              2,962,539
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,502
Published Size (KB):         1,138
SDK:                         5.0.100-preview.2.20120.3
Runtime:                     5.0.0-preview.2.20155.3
ASP.NET Core:                5.0.0-preview.3.20167.1
--path "/json" --arg "-e=epoll" --arg "-t=2" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=false" --arg "-w=false" --connections 256
RequestsPerSecond:           356,724
Max CPU (%):                 100
WorkingSet (MB):             196
Avg. Latency (ms):           1.08
Startup (ms):                1
First Request (ms):          115.46
Latency (ms):                0.29
Total Requests:              5,386,460
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,001
Published Size (KB):         1,138
SDK:                         5.0.100-preview.2.20120.3
Runtime:                     5.0.0-preview.2.20155.3
ASP.NET Core:                5.0.0-preview.3.20167.1
--path "/json" --arg "-e=epoll" --arg "-t=3" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=false" --arg "-w=false" --connections 256
RequestsPerSecond:           393,252
Max CPU (%):                 99
WorkingSet (MB):             199
Avg. Latency (ms):           1.55
Startup (ms):                2
First Request (ms):          114.16
Latency (ms):                0.21
Total Requests:              5,937,774
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,502
Published Size (KB):         1,138
SDK:                         5.0.100-preview.2.20120.3
Runtime:                     5.0.0-preview.2.20155.3
ASP.NET Core:                5.0.0-preview.3.20167.1
--path "/json" --arg "-e=epoll" --arg "-t=4" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=false" --arg "-w=false" --connections 256
RequestsPerSecond:           422,809
Max CPU (%):                 100
WorkingSet (MB):             202
Avg. Latency (ms):           1.86
Startup (ms):                2
First Request (ms):          125.88
Latency (ms):                0.36
Total Requests:              6,379,289
Duration: (ms)               15,090
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,002
Published Size (KB):         1,138
SDK:                         5.0.100-preview.2.20120.3
Runtime:                     5.0.0-preview.2.20155.3
ASP.NET Core:                5.0.0-preview.3.20167.1
--path "/json" --arg "-e=epoll" --arg "-t=5" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=false" --arg "-w=false" --connections 256
RequestsPerSecond:           431,474
Max CPU (%):                 99
WorkingSet (MB):             199
Avg. Latency (ms):           1.76
Startup (ms):                1
First Request (ms):          116.67
Latency (ms):                0.27
Total Requests:              6,515,183
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,502
Published Size (KB):         1,138
SDK:                         5.0.100-preview.2.20120.3
Runtime:                     5.0.0-preview.2.20155.3
ASP.NET Core:                5.0.0-preview.3.20167.1
--path "/json" --arg "-e=epoll" --arg "-t=6" --arg "-s=false" --arg "-r=false" --arg "-c=false" --arg "-a=false" --arg "-w=false" --connections 256
RequestsPerSecond:           441,245
Max CPU (%):                 99
WorkingSet (MB):             206
Avg. Latency (ms):           1.29
Startup (ms):                1
First Request (ms):          116.5
Latency (ms):                0.41
Total Requests:              6,662,802
Duration: (ms)               15,100
Socket Errors:               0
Bad Responses:               0
Build Time (ms):             4,502
Published Size (KB):         1,138
SDK:                         5.0.100-preview.2.20120.3
Runtime:                     5.0.0-preview.2.20155.3
ASP.NET Core:                5.0.0-preview.3.20167.1

@tmds
Copy link
Owner Author

tmds commented Mar 18, 2020

All in one graph:

rps2

The green line is what is most similar to corefx Socket*.
red = green + AIO
yellow = green + continue on epoll thread
blue = green + AIO + continue on epoll thread

As you can see, when continuing on epoll thread, there need to be enough threads.
Also, the effect of AIO diminishes as connections are spread over more threads.

*: corefx Socket does the socket operation on the threadpool, while we continue on threadpool after the socket operation was performed on epoll thread

cc @antonfirsov

@tmds
Copy link
Owner Author

tmds commented Mar 27, 2020

Closing. New benchmark round coming up: #78.

@tmds tmds closed this as completed Mar 27, 2020
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

4 participants