I am using nghttp2
to implement a RESTful API server. I have defined two GET APIs:
/api/ping
and /api/wait
. While the response to the former is sent immediately, the server does some processing before responding to the latter. I allotted 4 threads to the server.
From a client (also implemented using nghttp2
), I made a connection to the server and made the API calls one by one, /api/wait
first followed by /api/ping
. I observed using Wireshark that the two GET requests are sent over two different TCP packets. However, until the server completes processing of the /api/wait
, it does not not process /api/ping
, although it has other threads available.
I established two TCP connections from the client and made the two API calls on the different connections and the server processed those in parallel.
Does this mean that nghttp2
processes one TCP connection exclusively on one thread and requests from one TCP connection are processed sequentially by design? Is there any setting in nghttp2
to circumvent this? This may be a good feature for a web application (processing requests sequentially) but not an API server where APIs are independent of each other.