Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

[Testing] Combined Alloc PRs for testing #425

Closed
wants to merge 12 commits into from

Conversation

benaadams
Copy link
Contributor

PRs
#424 Improved RequestProcessingAsync legibility
#411 [Proposal] Request header Stringpool
#408 Remove CreateLinkedTokenSource
#363 Resuse writes, initalize queues

Before 7,625,384 bytes used for 4k requests

kestrel-before

After 3,817,438 bytes used for 4k requests

kestrel-after

Down 3,807,946 bytes (~50% reduction)

benaadams and others added 12 commits November 19, 2015 21:50
Avoid allocating the CancellationTokenSource unless it's actually requested.  This makes it pay-for-play with regards to code that actually asks for the RequestAborted token and requests that are aborted.
Lazily allocate the RequestAborted CTS
With precomputed tasks

Hopefully aspnet#391, the good bits...
… into pr-combined

Conflicts:
	src/Microsoft.AspNet.Server.Kestrel/Http/Frame.cs
@benaadams
Copy link
Contributor Author

Remaining big spenders (4k requests):

Function Name Exclusive Bytes
Microsoft.AspNet.Hosting.Internal.HostingEngine.<>.<>d.MoveNext() 160000
Microsoft.AspNet.Hosting.Internal.RequestServicesContainerMiddleware..MoveNext() 192000
Microsoft.AspNet.Http.Internal.DefaultHttpContext..ctor() 512000
Microsoft.AspNet.Http.Internal.HttpContextFactory.Create() 448000
Microsoft.AspNet.Server.Kestrel.Http.Frame.d__104.MoveNext() 640000
Microsoft.AspNet.Server.Kestrel.Http.MessageBody.For() 160000
Microsoft.AspNet.Server.Kestrel.Http.SocketOutput.WriteAsync() 288
Microsoft.AspNet.Server.Kestrel.Http.SocketOutput.WriteContext..ctor() 408
Microsoft.AspNet.Server.Kestrel.KestrelThread.DoPostWork() 192000
System.Collections.Concurrent.ConcurrentQueue`1.Enqueue() 8800
System.Collections.Generic.List`1..ctor() 192
System.DateTimeFormat.Format amortized by time not request 11200
System.Runtime.CompilerServices.AsyncTaskMethodBuilder.AwaitUnsafeOnCompleted 844080
System.Runtime.CompilerServices.AsyncTaskMethodBuilder.AwaitUnsafeOnCompleted 338312
System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult(!0) 704
System.String.CtorCharPtrStartLength 133926
System.Threading.ThreadPool.QueueUserWorkItem 175528

@AspNetSmurfLab
Copy link

Very nice gain of ~9%:

Running 10s test @ http://10.0.0.100:5001/plaintext
  32 threads and 256 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    19.22ms   52.34ms 537.25ms   89.63%
    Req/Sec    23.94k     2.43k   38.72k    74.73%
  7616398 requests in 10.10s, 0.94GB read
  Socket errors: connect 0, read 0, write 299, timeout 0
Requests/sec: 754102.55
Transfer/sec:     94.93MB

@benaadams
Copy link
Contributor Author

Put [Proposal] back on #411 "Request header Stringpool" needs to looked at in isolation since there wasn't a giant leap.

@ErikSchierboom
Copy link

A 50% reduction in memory, the GC will like that 👍

@benaadams
Copy link
Contributor Author

@halter73 need to do some updates to this.

@benaadams benaadams closed this Dec 1, 2015
@benaadams benaadams deleted the pr-combined branch May 10, 2016 02:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants