【发布时间】:2016-07-06 21:11:54
【问题描述】:
我正在运行 WildFly 10(最终版本)并且我有一个非常简单的 JAX-RS 服务器应用程序。它只有一个测试端点,等待一秒,然后返回 HTTP OK 状态。
@Path("/test")
public class TestEndpoint {
@GET
@Produces("application/json;charset=UTF-8")
public Response get() {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
return Response.ok().build();
}
}
问题在于,使用此设置,我只能达到 每秒 10 个请求。没有了。我正在使用 SoapUI LoadTest 进行测试——100 个线程,请求之间有 1 毫秒的延迟。当另一台计算机上的另一个用户连接到此类 WildFly 应用程序时,他每秒最多也会收到 10 个请求。所以看起来限制是每个用户。
我已经在不同的服务器甚至本地主机上尝试过该应用程序,它似乎总是每秒 10 个请求(大约每秒 9.8 - 10.5 个请求)。所有 CPU 内核的使用率都很低(平均为 8 %)。
我买了一本名为 WildFly 管理指南的书并尝试了一些暗流设置:
- 堆栈大小 (500)
- IO 线程 (500)
没有任何帮助。即使在压力测试下,jboss-cli 也会显示:
{
"outcome" => "success",
"result" => {
"active-sessions" => 0,
"context-root" => "/",
"expired-sessions" => 0,
"max-active-sessions" => 200,
"rejected-sessions" => 0,
"server" => "default-server",
"session-avg-alive-time" => 0,
"session-max-alive-time" => 0,
"sessions-created" => 0,
"virtual-host" => "default-host",
"servlet" => {"com.test.ApiConfiguration" => undefined},
"websocket" => undefined
}
}
这部分很有趣
"servlet" => {"com.test.ApiConfiguration" => undefined},
"websocket" => undefined
这是我的配置:
<thread-pools>
<thread-pool name="default">
<max-threads count="1000"/>
<keepalive-time time="100" unit="milliseconds"/>
</thread-pool>
</thread-pools>
Web 部件的性能 我还将 JSF 用于应用程序的另一部分。此应用程序打包在同一个 WAR 中。当部署到同一台服务器上时,应用程序每秒可以处理 600-700 个请求,但请求完成所需的时间更少,所以看起来限制仍然是一样的。
当然,我在 WildFly 中使用 Resteasy 作为默认的 JAX-RS 实现。
这是与 WildFly 相关的问题,还是其他问题?
【问题讨论】:
-
我对Wildfly不熟悉,但是它有工作线程数的配置选项吗? (一个快速的谷歌告诉我它可能是
task-core-threads) -
我发现:
-
Provided that there are enough io-threads to serve your http request, the core-max-threads (first) and the task-max-threads (after) are used to determine in the request is served or if it is going to be discarded.来源:mastertheboss.com/jboss-server/jboss-performance/… -
尝试设置 core-max-threads 实际上会导致 "failure-description" => "WFLYCTL0201: Unknown attribute 'task-core-threads'
-
这个参数现在没有实现。 developer.jboss.org/thread/261489
标签: jakarta-ee jax-rs wildfly resteasy