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

[For Testing] Bundled Memory Changes #386

Closed
wants to merge 30 commits into from

Conversation

benaadams
Copy link
Contributor

Don't alloc header names #391
Consume body without allocating or reading #335 (PR has changed)
Reduce GetString allocs and conversions #312 (PR has changed)
ConcurrentStack -> ConcurrentQueue #390
GC.Collect before pinning starts #331
Dispose of MemoryPool2; suppress its finalizers #343
Pre-allocate memory pool #362
Initialize the work queue sizes #363
Precomputed header bytes #367
OnCompleted doesn't need threadpool #380

@benaadams
Copy link
Contributor Author

Also resolved some slight conflicts

@benaadams
Copy link
Contributor Author

Now the difference in allocations between ConcurrentQueue and ConcurrentStack are showing; swapping MemoryPool

@benaadams
Copy link
Contributor Author

Pre Allocs

pre bundle

Post Allocs

post bundle

Not sure about stack vs queue; reverting and will hold on to block for longer

@benaadams
Copy link
Contributor Author

Gone back to Queue rather than Stack

Stack allocs
stack allocks

Queue allocs
queue allocs

@NickCraver
Copy link
Contributor

I setup benchmarks on the Stack Overflow web tier to give us a good idea of what our actual performance will be and @benaadams was kind enough to bundle the changes. Here's current aspnet/dev:

-bash-4.2$ ./wrk -s pipeline.lua -t32 -c256 -d10s http://co-web11:5001/plaintext -- 16
Running 10s test @ http://co-web11:5001/plaintext
  32 threads and 256 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    20.98ms   61.39ms 906.56ms   92.04%
    Req/Sec    22.08k     4.13k   73.21k    88.44%
  6969114 requests in 10.10s, 0.86GB read
Requests/sec: 690161.21
Transfer/sec:     86.88MB

...and here's this branch:

-bash-4.2$ ./wrk -s pipeline.lua -t32 -c256 -d10s http://co-web11:5001/plaintext -- 16
Running 10s test @ http://co-web11:5001/plaintext
  32 threads and 256 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    29.87ms   71.90ms 479.58ms   83.73%
    Req/Sec    38.22k     8.93k   79.89k    79.82%
  12034366 requests in 10.10s, 1.48GB read
Requests/sec: 1191674.89
Transfer/sec:    150.01MB

@benaadams
Copy link
Contributor Author

Almost there, down another 719,992 bytes and 8,000 objects

further reductions

@benaadams benaadams force-pushed the socket-memorypool2 branch 3 times, most recently from d132eb0 to 4ea87d4 Compare November 14, 2015 20:49
@NickCraver
Copy link
Contributor

Updating numbers, regression on the memory pool commit (look at latency specifically) and we're hitting 100% CPU on the web server now (didn't get comparison CPU before the rebase/force):

Running 10s test @ http://co-web11:5001/plaintext
  32 threads and 256 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    62.12ms  100.42ms 946.49ms   78.24%
    Req/Sec    35.08k    11.44k   86.41k    73.63%
  10963259 requests in 10.10s, 1.35GB read
Requests/sec: 1085653.38
Transfer/sec:    136.67MB

@benaadams
Copy link
Contributor Author

I removed a commit is the middle of the chain and rebasing got upset; all the other commits are individually open as PRs and referenced at the top; so will ignore the last two for now :)

@benaadams
Copy link
Contributor Author

Stashed the "experi-mental" changes; and just gone for the merges - hopefully back to previous pref...

@benaadams
Copy link
Contributor Author

Other changes (SocketOutput taking MemoryPool2 inputs) here https://github.com/benaadams/KestrelHttpServer/tree/so-testing-exotic

@AspNetSmurfLab
Copy link

Benchmark results from the SmurfLab:

Running 10s test @ http://10.0.0.100:5001/plaintext
  32 threads and 256 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     6.56ms   14.11ms 264.13ms   94.59%
    Req/Sec    20.66k     2.35k   28.12k    81.86%
  6496342 requests in 10.10s, 817.79MB read
  Socket errors: connect 0, read 0, write 600, timeout 0
Requests/sec: 643225.30
Transfer/sec:     80.97MB
``

@benaadams
Copy link
Contributor Author

Closing this, as testing done

@benaadams benaadams closed this Nov 17, 2015
@benaadams benaadams deleted the socket-memorypool2 branch May 10, 2016 02:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants