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

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

问题描述

请参阅附件中的图片,请帮助我理解线程池(最大和最小线程池大小),acceptor线程以及其最大连接数和HTTP最大连接数之间的关系。



线程池:





HTTP:





传输TCP:

$ b $首先我会给你一些官方文档

线程池

$ b
$ b

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



请记住,一个线程将会延长请求的寿命。也就是说,不仅在读取来自套接字的HTTP请求时,或者在写入HTTP响应给客户端时,而且它总是处理业务逻辑,等待数据库完成,写入日志文件,发送/接收WS消息,......



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



HTTP最大连接数



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



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



传送接受者线程



t在任何时候声明每个监听套接字有多少线程可以在接受模式中保存你的服务器。 ORACLE文档建议这个数字低于CPU数量。



也就是说,这是同时读取/写入套接字的数量。您可以考虑与线程池的直接关系,但请记住,一个线程不仅可以从客户端读取/写入,也可以处理请求。



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



我的解释



所以,你的服务器将会有每个客户端(监听套接字)的队列,其中不能超过最大连接数。此连接将由线程池进行处理,同时它不能超过接受者线程处理/接受的套接字。



如果客户端请求正在等待更多时间超时,它将被拒绝。 最小线程池确保您拥有最少的线程,随时可以处理。并且最大连接数限制了您可以等待的侦听套接字的总数。如果这个最后限制超过,新的连接将被拒绝。



希望它有帮助。


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 :

HTTP:

Transport TCP:

解决方案

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.

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

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