Supported option to specify maximum threads used to handle HTTP requests (#26659)
* added a mapper for the thread-pool.max-threads raw quarkus option Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
This commit is contained in:
parent
4338f44955
commit
d1764dbcb2
9 changed files with 43 additions and 2 deletions
|
@ -124,4 +124,12 @@ public class HttpOptions {
|
||||||
"Use this to shed load in an overload situation. Excess requests will return a \"503 Server not Available\" response.")
|
"Use this to shed load in an overload situation. Excess requests will return a \"503 Server not Available\" response.")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
public static final Option<Integer> HTTP_POOL_MAX_THREADS = new OptionBuilder<>("http-pool-max-threads", Integer.class)
|
||||||
|
.category(OptionCategory.HTTP)
|
||||||
|
.description("The maximum number of threads. If this is not specified then it will be automatically sized " +
|
||||||
|
"to the greatest of 8 * the number of available processors and 200. " +
|
||||||
|
"For example if there are 4 processors the max threads will be 200. " +
|
||||||
|
"If there are 48 processors it will be 384.")
|
||||||
|
.build();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,6 +110,10 @@ final class HttpPropertyMappers {
|
||||||
fromOption(HttpOptions.HTTP_MAX_QUEUED_REQUESTS)
|
fromOption(HttpOptions.HTTP_MAX_QUEUED_REQUESTS)
|
||||||
.to("quarkus.thread-pool.queue-size")
|
.to("quarkus.thread-pool.queue-size")
|
||||||
.paramLabel("requests")
|
.paramLabel("requests")
|
||||||
|
.build(),
|
||||||
|
fromOption(HttpOptions.HTTP_POOL_MAX_THREADS)
|
||||||
|
.to("quarkus.thread-pool.max-threads")
|
||||||
|
.paramLabel("threads")
|
||||||
.build()
|
.build()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,8 +42,7 @@ public class HttpDistTest {
|
||||||
@Test
|
@Test
|
||||||
@TestProvider(TestRealmResourceTestProvider.class)
|
@TestProvider(TestRealmResourceTestProvider.class)
|
||||||
public void maxQueuedRequestsTest(KeycloakDistribution dist) {
|
public void maxQueuedRequestsTest(KeycloakDistribution dist) {
|
||||||
dist.setQuarkusProperty("quarkus.thread-pool.max-threads", "1");
|
dist.run("start-dev", "--http-max-queued-requests=1", "--http-pool-max-threads=1");
|
||||||
dist.run("start-dev", "--http-max-queued-requests=1");
|
|
||||||
|
|
||||||
// run requests async
|
// run requests async
|
||||||
List<CompletableFuture<Integer>> statusCodesFuture = new ArrayList<>();
|
List<CompletableFuture<Integer>> statusCodesFuture = new ArrayList<>();
|
||||||
|
|
|
@ -143,6 +143,11 @@ HTTP(S):
|
||||||
--http-max-queued-requests <requests>
|
--http-max-queued-requests <requests>
|
||||||
Maximum number of queued HTTP requests. Use this to shed load in an overload
|
Maximum number of queued HTTP requests. Use this to shed load in an overload
|
||||||
situation. Excess requests will return a "503 Server not Available" response.
|
situation. Excess requests will return a "503 Server not Available" response.
|
||||||
|
--http-pool-max-threads <threads>
|
||||||
|
The maximum number of threads. If this is not specified then it will be
|
||||||
|
automatically sized to the greatest of 8 * the number of available
|
||||||
|
processors and 200. For example if there are 4 processors the max threads
|
||||||
|
will be 200. If there are 48 processors it will be 384.
|
||||||
--http-port <port> The used HTTP port. Default: 8080.
|
--http-port <port> The used HTTP port. Default: 8080.
|
||||||
--http-relative-path <path>
|
--http-relative-path <path>
|
||||||
Set the path relative to '/' for serving resources. The path must start with a
|
Set the path relative to '/' for serving resources. The path must start with a
|
||||||
|
|
|
@ -143,6 +143,11 @@ HTTP(S):
|
||||||
--http-max-queued-requests <requests>
|
--http-max-queued-requests <requests>
|
||||||
Maximum number of queued HTTP requests. Use this to shed load in an overload
|
Maximum number of queued HTTP requests. Use this to shed load in an overload
|
||||||
situation. Excess requests will return a "503 Server not Available" response.
|
situation. Excess requests will return a "503 Server not Available" response.
|
||||||
|
--http-pool-max-threads <threads>
|
||||||
|
The maximum number of threads. If this is not specified then it will be
|
||||||
|
automatically sized to the greatest of 8 * the number of available
|
||||||
|
processors and 200. For example if there are 4 processors the max threads
|
||||||
|
will be 200. If there are 48 processors it will be 384.
|
||||||
--http-port <port> The used HTTP port. Default: 8080.
|
--http-port <port> The used HTTP port. Default: 8080.
|
||||||
--http-relative-path <path>
|
--http-relative-path <path>
|
||||||
Set the path relative to '/' for serving resources. The path must start with a
|
Set the path relative to '/' for serving resources. The path must start with a
|
||||||
|
|
|
@ -144,6 +144,11 @@ HTTP(S):
|
||||||
--http-max-queued-requests <requests>
|
--http-max-queued-requests <requests>
|
||||||
Maximum number of queued HTTP requests. Use this to shed load in an overload
|
Maximum number of queued HTTP requests. Use this to shed load in an overload
|
||||||
situation. Excess requests will return a "503 Server not Available" response.
|
situation. Excess requests will return a "503 Server not Available" response.
|
||||||
|
--http-pool-max-threads <threads>
|
||||||
|
The maximum number of threads. If this is not specified then it will be
|
||||||
|
automatically sized to the greatest of 8 * the number of available
|
||||||
|
processors and 200. For example if there are 4 processors the max threads
|
||||||
|
will be 200. If there are 48 processors it will be 384.
|
||||||
--http-port <port> The used HTTP port. Default: 8080.
|
--http-port <port> The used HTTP port. Default: 8080.
|
||||||
--http-relative-path <path>
|
--http-relative-path <path>
|
||||||
Set the path relative to '/' for serving resources. The path must start with a
|
Set the path relative to '/' for serving resources. The path must start with a
|
||||||
|
|
|
@ -144,6 +144,11 @@ HTTP(S):
|
||||||
--http-max-queued-requests <requests>
|
--http-max-queued-requests <requests>
|
||||||
Maximum number of queued HTTP requests. Use this to shed load in an overload
|
Maximum number of queued HTTP requests. Use this to shed load in an overload
|
||||||
situation. Excess requests will return a "503 Server not Available" response.
|
situation. Excess requests will return a "503 Server not Available" response.
|
||||||
|
--http-pool-max-threads <threads>
|
||||||
|
The maximum number of threads. If this is not specified then it will be
|
||||||
|
automatically sized to the greatest of 8 * the number of available
|
||||||
|
processors and 200. For example if there are 4 processors the max threads
|
||||||
|
will be 200. If there are 48 processors it will be 384.
|
||||||
--http-port <port> The used HTTP port. Default: 8080.
|
--http-port <port> The used HTTP port. Default: 8080.
|
||||||
--http-relative-path <path>
|
--http-relative-path <path>
|
||||||
Set the path relative to '/' for serving resources. The path must start with a
|
Set the path relative to '/' for serving resources. The path must start with a
|
||||||
|
|
|
@ -83,6 +83,11 @@ HTTP(S):
|
||||||
--http-max-queued-requests <requests>
|
--http-max-queued-requests <requests>
|
||||||
Maximum number of queued HTTP requests. Use this to shed load in an overload
|
Maximum number of queued HTTP requests. Use this to shed load in an overload
|
||||||
situation. Excess requests will return a "503 Server not Available" response.
|
situation. Excess requests will return a "503 Server not Available" response.
|
||||||
|
--http-pool-max-threads <threads>
|
||||||
|
The maximum number of threads. If this is not specified then it will be
|
||||||
|
automatically sized to the greatest of 8 * the number of available
|
||||||
|
processors and 200. For example if there are 4 processors the max threads
|
||||||
|
will be 200. If there are 48 processors it will be 384.
|
||||||
--http-port <port> The used HTTP port. Default: 8080.
|
--http-port <port> The used HTTP port. Default: 8080.
|
||||||
--https-certificate-file <file>
|
--https-certificate-file <file>
|
||||||
The file path to a server certificate or certificate chain in PEM format.
|
The file path to a server certificate or certificate chain in PEM format.
|
||||||
|
|
|
@ -83,6 +83,11 @@ HTTP(S):
|
||||||
--http-max-queued-requests <requests>
|
--http-max-queued-requests <requests>
|
||||||
Maximum number of queued HTTP requests. Use this to shed load in an overload
|
Maximum number of queued HTTP requests. Use this to shed load in an overload
|
||||||
situation. Excess requests will return a "503 Server not Available" response.
|
situation. Excess requests will return a "503 Server not Available" response.
|
||||||
|
--http-pool-max-threads <threads>
|
||||||
|
The maximum number of threads. If this is not specified then it will be
|
||||||
|
automatically sized to the greatest of 8 * the number of available
|
||||||
|
processors and 200. For example if there are 4 processors the max threads
|
||||||
|
will be 200. If there are 48 processors it will be 384.
|
||||||
--http-port <port> The used HTTP port. Default: 8080.
|
--http-port <port> The used HTTP port. Default: 8080.
|
||||||
--https-certificate-file <file>
|
--https-certificate-file <file>
|
||||||
The file path to a server certificate or certificate chain in PEM format.
|
The file path to a server certificate or certificate chain in PEM format.
|
||||||
|
|
Loading…
Reference in a new issue