DiskCacheBasedQuicServerInfo holds on read and write buffers |
||||
Issue descriptionDiskCacheBasedQuicServerInfo currently holds onto ~8KiB read and write buffers when these buffers are not needed. This amounts to a non-trivial amount of memory usage when the number of Quic sessions is big. (In a 2min browsing session, I have 8 Quic session and 64kiB buffers owned by DiskCacheBasedQuicServerInfo.) We need to release these read/write buffers when done reading/writing from disk cache.
,
Jan 24 2017
net::DiskCacheBasedQuicServerInfo::DoRead() and net::DiskCacheBasedQuicServerInfo::DoWrite() has 16 IOBuffers totaling 34*2KiB. Attached is the trace file.
,
Jan 24 2017
If it's 64KiB that we are not using on a 2 minute session in Android, then it sounds like a higher priority bug. I do not understand why we have write buffers in the first place. It looks like DiskCacheBasedQuicServerInfo::DoWrite is the only function that uses the buffer and it clears it at every call. there is no state stored here.
,
Jan 24 2017
https://cs.chromium.org/chromium/src/net/disk_cache/disk_cache.h?rcl=0&l=228 scoped_refptr<IOBuffer> write_buffer_; Disk Cache writes happen asynchronously. We pass the pointer to the data to disk cache backend (it could write data at some point in future). When did you take the logs? Is it after the data is flushed to the disk? We use scoped_refptr to define the IOBuffer (at other places where disk_cache entry is used). https://cs.chromium.org/chromium/src/gpu/ipc/host/shader_disk_cache.cc?rcl=0&l=204
,
Jan 24 2017
But can we free the write buffer in DoWriteComplete()?
,
Jan 24 2017
Good point. I don't know the answer (please pardon me for my ignorance). Experts of disk cache would know. The following is another example of scoped_refptr being used with disk cache entry. https://cs.chromium.org/chromium/src/net/tools/stress_cache/stress_cache.cc?q=entry_-%3EWriteData&sq=package:chromium&l=217&dr=C
,
Jan 25 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/e60eae52ad27b1d5814eeecf6575916be0e5b14c commit e60eae52ad27b1d5814eeecf6575916be0e5b14c Author: xunjieli <xunjieli@chromium.org> Date: Wed Jan 25 00:23:58 2017 Make DiskCacheBasedQuicServerInfo release buffers when no longer needed When read/write is completed in DiskCacheBasedQuicServerInfo, release read/write IOBuffer. BUG= 684732 Review-Url: https://codereview.chromium.org/2649043005 Cr-Commit-Position: refs/heads/master@{#445873} [modify] https://crrev.com/e60eae52ad27b1d5814eeecf6575916be0e5b14c/net/http/disk_cache_based_quic_server_info.cc
,
Jan 25 2017
correct. No need to keep the buffer after the op completes.
,
Jan 25 2017
Thanks rvargas@.
,
Jan 25 2017
I forgot to say that I have a CL in review when I filed the bug.
,
Jan 25 2017
Would be good to fix the other places where IOBuffer is not being free'ed immediately in the write complete callback (if it makes sense).
,
Jan 25 2017
I have fixed the write buffer case as well (in https://codereview.chromium.org/2649043005). Am I missing something?
,
Jan 25 2017
Thanks xunjieli@. I was suggesting for the memory performance team to see if there are other similar uses outside net. The following shows all the calls where we call WriteData. Sometimes, wrong patterns of the code are copied. https://cs.chromium.org/search/?q=%22+entry_-%3EWriteData%22&sq=package:chromium&type=cs
,
Jan 25 2017
Got it. Thanks Raman. I will look through other call places of the disk cache API. |
||||
►
Sign in to add a comment |
||||
Comment 1 by xunji...@chromium.org
, Jan 24 2017Components: Internals>Network>Cache