HTTP Server socket
Threads used in HTTP/2
Server threads
ServerListenercreates a Platform thread for each socket we listen on This thread is non-daemon and is blocked onServerSocketChannel.accept()until a connection comesConnectionHandleris created and runs in a dedicated Virtual threadConnectionHandlercreatesConnectionContextinstance, configures theSocketChanneland starts reading data from it. Identifies whichServerConnectionimplementation to use and delegates processing to it. If we should stop reading data, the current thread should be blockedHttp2Connectiontakes over for HTTP/2 requests (represents a single client connection with x streams)
Http2Stream- each runs in its own Virtual thread (once Headers are received)
Socket operations
- Socket reads are happening on the
ConnectionHandlerthread- blocking any stream handler interested in reading data
- Socket writes are happening on either
ConnectionHanlderthread (writes initiated for connection (stream 0x0)) OR onHttp2Stream