Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Glassfish Thread Pool, Acceptor Threads, HTTP Max Connections

Please see the attached images, Please help me to understand the relationship between thread pool(max and min thread pool size), acceptor threads and its max connection count and HTTP max connection count.

Thread Pool :

enter image description here

HTTP:

enter image description here

Transport TCP:

enter image description here

like image 275
Kenshin Avatar asked Oct 13 '15 06:10

Kenshin


People also ask

How many simultaneous HTTP requests can Glassfish handle?

Maximum number of concurrent users, n, that the system can support at peak load is 5,000. Maximum number of requests, r, the system can process at peak load is 1,000 per second.

What is the max thread pool size?

Starting thread pool size is 1, core pool size is 5, max pool size is 10 and the queue is 100. As requests come in, threads will be created up to 5 and then tasks will be added to the queue until it reaches 100. When the queue is full new threads will be created up to maxPoolSize .

What is thread pool in Java?

What is ThreadPool in Java? A thread pool reuses previously created threads to execute current tasks and offers a solution to the problem of thread cycle overhead and resource thrashing.


1 Answers

First I'll give you some official documentation

Thread Pool

The thread pool is the max number of simultaneous requests the server can handle. The server has a queue of connections awaiting to be processed by a thread.

Keep in mind that a thread will be a long the request life. That is, not only when reading HTTP request from socket, or when writing HTTP response to client, but all time it is dealing with business logic, awaiting DB to finish, writing to a log file, sending/receiving WS mehtods, ...

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

HTTP Max Connections

HTTP Server is listening to clients requests, and every client has an associated connection queue where requests are queuing to be processed by a thread from the Thread Pool.

Here is where live the threads waiting to serve queued requests.

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

Transport acceptor threads

Is the number that states how many threads can hold your server in accept mode for every listen socket at any time. Oracles documentation recommends to have this number below of number of the numbers of CPU's.

That is, this is the number of sockets that are reading/writing simultaneously. You can think of a direct relation with thread pool, but remember a thread is not only to read/write from/to client, but for processing request too.

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

My Explanation

So, your server will have a queue for every client (listen socket) where there can be no more than Max Connections. This connections will be processed by a Thread Pool and at the same time it can not be more than Acceptor Threads processing/accepted sockets.

If a client request is awaiting more thant Time out it will be rejected. Min Thread Pool ensures you to have a minimun of threads, ready to processing. And Max Connection Count limits the total of listen sockets you can have waiting. If this last limit is exceed, new connections will be rejected.

Hope it helps.

like image 153
malaguna Avatar answered Oct 30 '22 11:10

malaguna