Networking/Archive/Overview Notes
From MozillaWiki
< Networking | Archive
ARCHIVED
This page has been archived and its contents may be out of date.
Request
- DNS prefetch
- Possible improvement: pre-open connections to known TCP hosts for a given page
- The channel is opened using nsIChannel::AsyncOpen
- Proxy resolution
- Observer events (like http-on-modify-request)
- May be used by add-ons
- Pre-open the TCP connection to the target "speculatively"
- The number of connections to the same host is limited
- Where the "host" is actually a combination of hostname, port and maybe other data
- The total number of TCP connections made by Necko is also limited
- There is a connection handling thread, notified by NSPR when data is available
- The number of connections to the same host is limited
- App Cache Lookup
- This uses SQLite (Storage API)
- Disk or Memory Cache Lookup
- Actual request, with data dispatched as it becomes available
- OnStartRequest callback, after HTTP headers are received
- OnDataAvailable callback, data comes from NSPR via the socket I/O thread
- OnStopRequest, with error status code if required
Mentioned components
- HTTP transaction object
- Connection Manager
- Finds persistent connections, or pre-started ones
- Concurrency: we may start different connections during handshake
- This may have limited performance in some cases, like single-threaded servers
Other notes
The max-connections preference controls how many connections are made, to avoid hitting limits of the underlying TCP layer in the operating system, which could cause the layer to stop responding in some cases.
- 256 on Desktop
- 64 on some Windows 32-bit variants
- 32 on Desktop when using a proxy
- 20 on Android (to avoid using too much memory for buffers)
Docs
Existing documentation that may be relevant: