xunjieli | 629230d | 2017-06-21 19:14:14 | [diff] [blame] | 1 | # Network Stack Memory Tracing |
| 2 | |
| 3 | This is an overview of the Net column in [MemoryInfra][memory-infra]. |
| 4 | |
| 5 | [TOC] |
| 6 | |
| 7 | ## Quick Start |
| 8 | |
| 9 | To get an overview of total network stack memory usage, select the Browser |
| 10 | process' *net* category and look at *effective_size* or *size* column. |
| 11 | |
| 12 | ![net stack column][net-stack-column] |
| 13 | |
| 14 | [memory-infra]: README.md |
| 15 | [net-stack-column]: https://storage.googleapis.com/chromium-docs.appspot.com/net_category.png |
| 16 | |
| 17 | ## Detailed Information |
| 18 | |
| 19 | The numbers are reported by the network stack’s MemoryDumpProvider, which is |
| 20 | implemented by URLRequestContext class. URLRequestContext calls into major |
| 21 | network stack objects (such as HttpNetworkSession, SSLClientSessionCache, |
| 22 | HttpCache) to aggregate memory usage numbers. The total number reported in |
| 23 | “net” is a lower bound of the memory used by the network stack. It is not |
| 24 | intended to be an accurate measurement. Please use |
| 25 | [heap profiler][heap-profiler] instead to see all allocations. |
| 26 | |
| 27 | **URLRequestContext** (“url_request_context”) |
| 28 | |
| 29 | This is a top-level network stack object used to create url requests. There are |
| 30 | several URLRequestContexts in Chrome. See |
| 31 | [Anatomy of the Network Stack][anatomy-of-network-stack] for what these |
| 32 | URLRequestContexts are created for. The number of URLRequestContexts increases |
| 33 | with the number of profiles. |
| 34 | |
| 35 | For a “url_request_context” row, the “object_count” column indicates the number |
| 36 | of live URLRequests created by that context. |
| 37 | |
| 38 | + Sub rows |
| 39 | |
| 40 | - HttpCache (“http_cache”) |
| 41 | |
| 42 | This cache can be a disk cache (backed by either block file or simple |
| 43 | cache backend) or an in-memory cache. An incognito profile, for example, |
| 44 | has an in-memory HttpCache. You can tell this by whether |
| 45 | *mem_backend_size* column is present for that particular |
| 46 | URLRequestContext. |
| 47 | |
| 48 | |
| 49 | **HttpNetworkSession** (“http_network_session”) |
| 50 | |
| 51 | This network stack object owns socket pools, the HTTP/2 and QUIC session pools. |
| 52 | There is usually a 1:1 correspondence from a URLRequestContext to an |
| 53 | HttpNetworkSession, but there are exceptions. For example, the “main” |
| 54 | URLRequestContext shares the same HttpNetworkSession with “main_media” |
| 55 | URLRequestContext and “main_isolated_media” URLRequestContext. |
| 56 | |
| 57 | + Sub rows |
| 58 | |
| 59 | - HttpStreamFactory(“stream_factory”) |
| 60 | |
| 61 | This object is an entry to establish HTTP/1.1, HTTP/2 and QUIC |
| 62 | connections. |
| 63 | |
| 64 | - SpdySessionPool (“spdy_session_pool”) |
| 65 | |
| 66 | This object owns HTTP/2 sessions. |
| 67 | |
Dustin J. Mitchell | 795c736 | 2024-01-18 16:50:52 | [diff] [blame] | 68 | - QuicSessionPool (“quic_session_pool”) |
xunjieli | 629230d | 2017-06-21 19:14:14 | [diff] [blame] | 69 | |
| 70 | This object owns QUIC sessions and streams. |
| 71 | |
| 72 | **SSLClientSessionCache** (“ssl_session_cache”) |
| 73 | |
| 74 | This is a global singleton that caches SSL session objects which retain |
| 75 | references to refcounted SSL Certificates. |
| 76 | |
| 77 | [heap-profiler]: /docs/memory-infra/heap_profiler.md |
| 78 | [anatomy-of-network-stack]: /net/docs/life-of-a-url-request.md |
| 79 | |