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

SslStream disproportionately allocates #11826

Closed
benaadams opened this Issue Sep 17, 2016 · 9 comments

Comments

Projects
None yet
7 participants
@benaadams
Copy link
Collaborator

benaadams commented Sep 17, 2016

Switching from http

to https goes via SslStream and causes the allocations to increase dramatically (new in red below)

(The missing int[] allocation only happens at a higher load which I can't reach using Ssl)

Comparison is to WebSocketReceiveResult which already has over allocations #4530

/cc @davidfowl @stephentoub @blowdart

@benaadams benaadams changed the title SslStream gratuitously allocates SslStream disproportionately allocates Sep 17, 2016

@davidsh davidsh assigned davidsh and stephentoub and unassigned davidsh Sep 17, 2016

@stephentoub

This comment has been minimized.

Copy link
Member

stephentoub commented Sep 17, 2016

@davidsh, curious why you assigned this to me? The specific profiling example is with websockets but the concern is about SslStream in general... the websockets implementation just uses SslStream.

@davidsh

This comment has been minimized.

Copy link
Member

davidsh commented Sep 17, 2016

@stephentoub I saw the System.Net.WebSockets.ManagedWebSockets class on the stack and assumed that this issue is related to that codebase which is something you wrote/ported.

@davidsh

This comment has been minimized.

Copy link
Member

davidsh commented Sep 17, 2016

cc: @CIPop

@davidsh davidsh assigned CIPop and unassigned stephentoub Sep 17, 2016

@stephentoub

This comment has been minimized.

Copy link
Member

stephentoub commented Sep 17, 2016

@benaadams, I expect there's some low-hanging fruit here, if you want to take a look, too.

@benaadams

This comment has been minimized.

Copy link
Collaborator Author

benaadams commented Sep 17, 2016

I do also get stuttering at a much much lower load when using SslStream; the only thing that looks related that seems like it make do any kind of blocking/resource consumption is LazyAsyncResult

However there's not a huge amount of time spent there; so is more likely to be much higher levels of GC caused by these allocations; though the WaitHandle may be temporarily poisoning the threadpool. Still investigating.

@davidfowl

This comment has been minimized.

Copy link
Contributor

davidfowl commented Sep 17, 2016

@CIPop once you handle all of the low hanging fruit, a CopyToAsync implementation would be great 😄

@CIPop

This comment has been minimized.

Copy link
Member

CIPop commented Sep 19, 2016

Thanks for reporting @benaadams! Feel free to submit a PR if there is an obvious fix for SslStream.

[...] a CopyToAsync implementation would be great

@davidfowl Please open a new tracking issue (a comment can be easy to miss in the future).

@stephentoub

This comment has been minimized.

Copy link
Member

stephentoub commented Sep 24, 2016

@davidfowl Please open a new tracking issue (a comment can be easy to miss in the future).

I opened #12037

@davidfowl

This comment has been minimized.

Copy link
Contributor

davidfowl commented Sep 24, 2016

@stephentoub Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment