Skip to content

Commit e5a36b8

Browse files
committed
perf(server): increase max threads and switch to ExecutorThreadPool
The max threads were increased from 20 to 50 to handle more concurrent requests. Replaced QueuedThreadPool with ExecutorThreadPool for better performance.
1 parent a5d4221 commit e5a36b8

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/main/java/mindustrytool/handler/HttpServer.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import java.util.function.Predicate;
99
import java.util.stream.Collectors;
1010

11-
import org.eclipse.jetty.util.thread.QueuedThreadPool;
11+
import org.eclipse.jetty.util.thread.ExecutorThreadPool;
1212

1313
import com.fasterxml.jackson.databind.DeserializationFeature;
1414
import com.fasterxml.jackson.databind.JsonNode;
@@ -73,15 +73,14 @@ public HttpServer(ServerController controller) {
7373

7474
}));
7575

76-
int maxThreads = 20;
76+
int maxThreads = 50;
7777
int minThreads = 0;
78-
int idleTimeoutMillis = 5_000;
7978
// to finish
8079
config.http.asyncTimeout = 5_000;
8180
config.useVirtualThreads = true;
8281

83-
config.jetty.threadPool = new QueuedThreadPool(maxThreads, minThreads, idleTimeoutMillis);
84-
config.jetty.modifyServer(server -> server.setStopTimeout(5_000)); // wait 5 seconds for existing requests
82+
config.jetty.threadPool = new ExecutorThreadPool(maxThreads, minThreads);
83+
config.jetty.modifyServer(server -> server.setStopTimeout(5_000)); // wait 5 seconds for existing requests
8584

8685
config.registerPlugin(new RouteOverviewPlugin());
8786

0 commit comments

Comments
 (0)