Glassfish Thread Pool, Receiver Streams, HTTP Max Connections

Please see attached images, please help me understand the relationship between a thread pool (maximum and minimum thread pool size), acceptor threads and its maximum number of connections and maximum number of HTTP connections.

Thread pool:

enter image description here

HTTP:

enter image description here

TCP Transport:

enter image description here

+6
source share
1 answer

I will give you the official documentation first

Thread pool

A thread pool is the maximum number of concurrent requests that a server can process. The server has a queue of connections waiting to be processed by the thread.

Keep in mind that the flow will be long. That is, not only when reading an HTTP request from a socket, or when writing an HTTP response to a client, but all the time it deals with business logic, waiting for the database to finish, write to the log file, send / receive WS mehtods, ...

Read: https://docs.oracle.com/cd/E18930_01/html/821-2431/abehk.html

Maximum HTTP Connections

The HTTP server listens for client requests, and each client has an associated connection queue where queue requests are processed by a thread from the Thread Pool .

This is where the threads live waiting to be served in the queue.

Read: https://docs.oracle.com/cd/E18930_01/html/821-2431/abegk.html

Acceptor Transport Streams

This is a number that indicates how many threads your server can support in accept mode for each listening socket at any time. The Oracles documentation recommends that this number be lower than the number of processor numbers.

That is, this is the number of sockets that read / write at the same time. You can think of a direct connection with the thread pool, but remember that a thread is not only read / write from / to the client, but also request processing.

Read: http://docs.oracle.com/cd/E18930_01/html/821-2431/gkxjt.html

My Explanation

Thus, your server will have a queue for each client (socket for listening), where there can be no more than Max. connections . These connections will be handled by the thread pool and at the same time there can be no more handlers / sockets accepted .

If a client request expects a longer timeout , it will be rejected. Min Thread Pool provides a minimum thread flow, ready for processing. And max. The number of connections limits the total number of listening sockets you can expect. If this last limit is exceeded, new connections will be rejected.

Hope this helps.

+5
source

All Articles