配置 Jetty 接受器线程

Configuring Jetty Acceptor Threads

jetty中acceptor线程的数量可以配置吗?默认情况下accpetor线程数是机器内核数的两倍吗?根据文档接受器线程在等待请求时进入阻塞状态。有很多没有请求的接受器线程(处于阻塞状态)有问题吗?

Blocked Acceptor线程正常运行。

由于您使用的是 embedded-jetty,只需使用 ServerConnector.setAcceptors(int) 来设置您想要的受体数量。

如果您使用的是 jetty-distribution,则将开始 属性 设置为适合您的需要...

jetty.http.acceptors 表示 non-ssl http 接受器数量的整数(-1 表示 auto-configuration 基于 hardware/os 设置)

jetty.ssl.acceptors 与上面相同的 int,但用于 ssl/https 连接器。

Note: The default behavior for Acceptor count is the best configuration. You would want to configure a different (lower number then default) if you have more then 4 connectors, or are running some crazy custom virtualization (ignore this for well behaved virtualization such as docker, virtualbox, or vmware)