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

Reduce DI Allocations #288

Closed
benaadams opened this issue Sep 14, 2015 · 10 comments
Closed

Reduce DI Allocations #288

benaadams opened this issue Sep 14, 2015 · 10 comments
Assignees
Labels
Milestone

Comments

@benaadams
Copy link
Contributor

For 2000 plantext requests DI allocates 16,009 objects:

image

Clocking in at 788,304 bytes:

image

Which would mean if you were performing 1M rps the GC would have to flush 8,004,500 objects and 394 Mbytes per second, 788 Mbytes per second for 2M rps and 2.76GBytes (56M objects) per second for 7M rps (~10GbE saturation)

benaadams added a commit to benaadams/DependencyInjection that referenced this issue Sep 14, 2015
@benaadams
Copy link
Contributor Author

This change cuts the object allocations for 2400 plantext requests from 16,009 to 58:

image

The bytes allocated from 788,304 to 4,664, also it should not grow per request:

image

As shown by 4800 plaintext requests demonstrating the same allocation:

image

So the GC should have limited work to do related to DI.

@benaadams
Copy link
Contributor Author

Question should _createServiceAccessor be reset each time?

@benaadams
Copy link
Contributor Author

Question should _createServiceAccessor be reset each time?

No, has no state, is pointer to current object's function

@benaadams
Copy link
Contributor Author

Updated images @rynowak are they displaying?

@benaadams
Copy link
Contributor Author

See aspnet/HttpAbstractions#402 (comment) for details on server run improvements (61.5k rps -> 1.49M rps)

@benaadams
Copy link
Contributor Author

Tests were actually done for 2000 plaintext responses, so results are worse than reported at top. @davidfowl wanted some more details so breakdown for bytes as follows:

d0

d1

d2
...
d3

@benaadams
Copy link
Contributor Author

Updated top numbers for actual requests performed

@benaadams
Copy link
Contributor Author

All change... will update the figures from both sides

@rynowak
Copy link
Member

rynowak commented Sep 25, 2015

Closing this due to 49520a2a73251a9f718743df4a43d26514021767

Reopen if you find more actionable work here.

@benaadams
Copy link
Contributor Author

49520a2a73251a9f718743df4a43d26514021767 is an inscrutable reason... I assume you mean bbb9acf101d4f9b3b818834c60572f67ec16ac63 😀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants