Glassfish 线程池、接受者线程、HTTP 最大连接数 [英] Glassfish Thread Pool, Acceptor Threads, HTTP Max Connections

查看:22
本文介绍了Glassfish 线程池、接受者线程、HTTP 最大连接数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请看附图,请帮助我理解线程池(最大和最小线程池大小)、接受者线程及其最大连接数和HTTP最大连接数之间的关系.

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.

线程池:

HTTP:

传输 TCP:

推荐答案

先给大家一些官方文档

线程池是服务器可以处理的最大并发请求数.服务器有一个等待线程处理的连接队列.

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.

请记住,一个线程的请求寿命会很长.也就是说,不仅在从套接字读取 HTTP 请求时,或者在向客户端写入 HTTP 响应时,而且所有时间都在处理业务逻辑,等待 DB 完成,写入日志文件,发送/接收 WS mehtods,......

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, ...

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

HTTP Server 正在侦听客户端请求,并且每个客户端都有一个关联的连接队列,请求正在排队等待由 线程池 中的线程处理.

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.

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

是表示在任何时候,每个侦听套接字有多少线程可以让您的服务器处于 accept mode 的数字.Oracles 文档建议将此数字低于 CPU 的数量.

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.

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

因此,您的服务器将为每个客户端(侦听套接字)创建一个队列,其中最多可以有最大连接数.此连接将由线程池处理,同时它不能超过接受线程处理/接受的套接字.

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.

希望有帮助.

这篇关于Glassfish 线程池、接受者线程、HTTP 最大连接数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆