-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged branch 'jetty-11.0.x' into 'jetty-12.0.x'.
Signed-off-by: Simone Bordet <[email protected]>
- Loading branch information
Showing
22 changed files
with
407 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...c/main/asciidoc/operations-guide/modules/module-threadpool-virtual-preview.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// ======================================================================== | ||
// Copyright (c) 1995-2022 Mort Bay Consulting Pty Ltd and others. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License v. 2.0 which is available at | ||
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
// which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
// ======================================================================== | ||
// | ||
|
||
[[og-module-threadpool-virtual-preview]] | ||
===== Module `threadpool-virtual-preview` | ||
|
||
The `threadpool-virtual-preview` module allows you to configure the server-wide thread pool, similarly to what you can do with the xref:og-module-threadpool[`threadpool`] Jetty module, but also specify to use virtual threads, introduced as a preview feature in Java 19. | ||
|
||
NOTE: To enable preview features, this module needs to specify the `+--enable-preview+` command line option using the xref:og-modules-directive-exec[[exec\] directive], and as such it will fork another JVM. | ||
|
||
Refer to the xref:og-module-threadpool[`threadpool`] Jetty module for the general features provided by that Jetty module that also this Jetty module provides. | ||
|
||
The module properties to configure the thread pool are: | ||
|
||
---- | ||
include::{JETTY_HOME}/modules/threadpool-virtual-preview.mod[tags=documentation] | ||
---- | ||
|
||
The specific properties to configure virtual threads are: | ||
|
||
`jetty.threadPool.virtual.namePrefix`:: | ||
The name prefix to use for the virtual thread names. | ||
|
||
`jetty.threadPool.virtual.allowSetThreadLocals`:: | ||
Whether virtual threads are allowed to set thread locals. | ||
|
||
`jetty.threadPool.useVirtualThreads`:: | ||
Whether virtual threads inherit the values of `InheritableThreadLocal` variables. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...tion/jetty-documentation/src/main/asciidoc/operations-guide/server/chapter.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// ======================================================================== | ||
// Copyright (c) 1995-2022 Mort Bay Consulting Pty Ltd and others. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License v. 2.0 which is available at | ||
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
// which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
// ======================================================================== | ||
// | ||
|
||
[[og-server]] | ||
=== Jetty Server | ||
|
||
The Jetty `Server` object is the central component that links protocol connectors to web applications. | ||
|
||
The `Server` component is defined by the xref:og-module-server[`server` Jetty module], that in turn depends on other Jetty modules that provide key functionalities, in particular: | ||
|
||
* xref:og-server-logging[Logging] | ||
* xref:og-module-bytebufferpool[`ByteBuffer` pooling] | ||
* xref:og-server-threadpool[`Thread` pooling] | ||
|
||
include::server-logging.adoc[] | ||
include::server-threadpool.adoc[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
...-documentation/src/main/asciidoc/operations-guide/server/server-threadpool.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// | ||
// ======================================================================== | ||
// Copyright (c) 1995-2022 Mort Bay Consulting Pty Ltd and others. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License v. 2.0 which is available at | ||
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
// which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
// ======================================================================== | ||
// | ||
|
||
[[og-server-threadpool]] | ||
==== Thread Pooling | ||
|
||
Jetty uses thread pooling to efficiently execute tasks that provide Jetty functionalities. | ||
|
||
Like any other component, the Jetty thread pool is configured and enabled via the xref:og-module-threadpool[`threadpool` Jetty module], that is transitively enabled by the xref:og-module-server[`server` Jetty module] which, in turn, is transitively enabled by a protocol module such as the xref:og-protocols-http[`http` Jetty module]: | ||
|
||
---- | ||
$ java -jar $JETTY_HOME/start.jar --add-modules=http | ||
---- | ||
|
||
The command above gives you the default configuration for the thread pool. | ||
|
||
If you want to explicitly configure the thread pool, it is enough to explicitly specify the xref:og-module-threadpool[`threadpool`] module: | ||
|
||
---- | ||
$ java -jar $JETTY_HOME/start.jar --add-modules=threadpool,http | ||
---- | ||
|
||
After the command above, the `$JETTY_BASE` directory looks like this: | ||
|
||
[source,subs=verbatim] | ||
---- | ||
$JETTY_BASE | ||
├── resources | ||
│ └── jetty-logging.properties | ||
└── start.d | ||
├── http.ini | ||
└── threadpool.ini | ||
---- | ||
|
||
Now you can customize the `threadpool.ini` file to explicitly configure the thread pool. | ||
|
||
[[og-server-threadpool-virtual]] | ||
===== Virtual Threads Support | ||
|
||
Virtual threads have been introduced as a preview feature in Java 19. | ||
|
||
The xref:og-module-threadpool-virtual-preview[`threadpool-virtual-preview`] Jetty module provides support for virtual threads and it is mutually exclusive with the `threadpool` Jetty module. | ||
|
||
If you have already enabled the `threadpool` Jetty module, it is sufficient to remove it by removing the `$JETTY_BASE/start.d/threadpool.ini` file. | ||
|
||
Then, you can enable the xref:og-module-threadpool-virtual-preview[`threadpool-virtual-preview`] module: | ||
|
||
---- | ||
$ java -jar $JETTY_HOME/start.jar --add-modules=threadpool-virtual-preview,http | ||
---- | ||
|
||
After the command above, the `$JETTY_BASE` directory looks like this: | ||
|
||
[source,subs=verbatim] | ||
---- | ||
$JETTY_BASE | ||
├── resources | ||
│ └── jetty-logging.properties | ||
└── start.d | ||
├── http.ini | ||
└── threadpool-virtual-preview.ini | ||
---- | ||
|
||
Now you can customize the `threadpool-virtual-preview.ini` file to explicitly configure the thread pool and the virtual threads and then start Jetty: | ||
|
||
[source,subs=quotes,options=nowrap] | ||
---- | ||
include::jetty[setupArgs="--add-modules=threadpool-virtual-preview,http"] | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.