Issue metadata
Sign in to add a comment
|
Investigating shrinking SSLClientSocket read/write buffers |
||||||||||||||||||||||||
Issue descriptionFrom traces, these look to be one of net's largest contributors to idle memory consumption on Android. Visit a couple sites, and these buffers can easily hit 1.5+ MB combined, even ignoring other objects owned by the sockets. The issue isn't so much their size when in use, but the fact that their size always contributes to memory use, even when Chrome is idle, and we can keep a lot of idle sockets around. Ideally, we'd just free the buffers when not in use, but the BIO API doesn't exactly make it clear how to do that. It's also worth thinking about more aggressively closing idle sockets, but I'll file another bug for that.
,
Jun 17 2016
Have a link to the incident? I had assumed I could trace back when the buffer size limit was set, but it was added when adding the BIO pair thing, and before that...the limit lays deep within the depths of the hazardous BIO code (Which, frankly, scares me, and I'd rather not dig into).
,
Jun 17 2016
Oh, nevermind, that other issue has a link.
,
Jun 17 2016
Yeah, the BIO pair code is awful, and it got even worse after this crazy "zero copy" thing was added (it should have done a custom BIO in C++). https://bugs.chromium.org/p/chromium/issues/detail?id=524258#c5 has the history here.
,
Jun 17 2016
The crazy "zero copy" thing was added from Opera seeing memcpy's in tracing. Just wanting to make sure we're remembering why the fence ( http://www.chesterton.org/taking-a-fence-down/ ) was placed there. If I were thinking on the purely pragmatic side, we'd treat it similar to kernel socket buffers - we start at size X, we grow to size Y, and we shrink when idle, repeating the process. The complexity of the growth strategy may be not worth it - I'd totally buy releasing the sockets after some T period idle, and make the allocator reallocate when a new request comes in.
,
Jun 17 2016
Right, the problem is not that it avoided the copy. It's that it was implemented by making BIO pair more complicated rather than doing a custom BIO. A custom BIO could be done in C++ and would be aware of StreamSocket::{Read,Write}'s needs. That's the way to go w.r.t. dropping the buffers when the socket is idle.
,
Jun 17 2016
|
|||||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||||
Comment 1 by davidben@chromium.org
, Jun 17 2016