You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of version 6, Spring Batch provides support for Java Flight Recorder (JFR) to help you monitor and troubleshoot batch jobs. JFR is a low-overhead, event-based profiling tool built into the Java Virtual Machine (JVM) that allows developers to collect detailed information about the performance and behavior of their applications.
5
+
6
+
JFR can be enabled by adding the following JVM options when starting your Spring Batch application:
Once JFR is enabled, Spring Batch will automatically create JFR events for key batch processing activities, such as job and step executions, item reads and writes, as well as transaction boundaries. These events can be viewed and analyzed using tools such as Java Mission Control (JMC) or other JFR-compatible tools.
Copy file name to clipboardExpand all lines: spring-batch-docs/modules/ROOT/pages/whatsnew.adoc
+33-3Lines changed: 33 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,13 +3,16 @@
3
3
4
4
This section highlights the major changes in Spring Batch 6.0. For the complete list of changes, please refer to the https://github.com/spring-projects/spring-batch/releases[release notes].
5
5
6
-
Spring Batch 6.0 includes the following features:
6
+
Spring Batch 6.0 includes the following features and improvements:
* xref:whatsnew.adoc#new-command-line-operator[New command line operator]
12
13
* xref:whatsnew.adoc#ability-to-recover-failed-job-executions[Ability to recover failed job executions]
14
+
* xref:whatsnew.adoc#ability-to-stop-all-kind-of-steps[Ability to stop all kinds of steps]
15
+
* xref:whatsnew.adoc#observability-with-jfr[Observability support with the Java Flight Recorder (JFR)]
13
16
* xref:whatsnew.adoc#deprecations-and-pruning[Deprecations and pruning]
14
17
15
18
[[dependencies-upgrade]]
@@ -70,7 +73,8 @@ In this release, several changes have been made to simplify the batch infrastruc
70
73
71
74
* The `JobRepository` now extends the `JobExplorer` interface, so there is no need to define a separate `JobExplorer` bean.
72
75
* The `JobOperator` now extends the `JobLauncher` interface, so there is no need to define a separate `JobLauncher` bean.
73
-
* The `JobRegistry` is now smart enough to register jobs automatically, so there is no need to define a separate `JobRegistrySmartInitializingSingleton` bean.
76
+
* The `JobRegistry` is now optional, and smart enough to register jobs automatically, so there is no need to define a separate `JobRegistrySmartInitializingSingleton` bean.
77
+
* The transaction manager is now optional, and a default `ResourcelessTransactionManager` is used if none is provided.
74
78
75
79
This reduces the number of beans required for a typical batch application and simplifies the configuration code.
76
80
@@ -121,7 +125,7 @@ public Step faulTolerantChunkOrientedStep(JobRepository jobRepository, JdbcTrans
121
125
// skip policy configuration
122
126
int skipLimit = 50;
123
127
var skippableExceptions = Set.of(FlatFileParseException.class);
124
-
SkipPolicy skipPolicy = new LimitCheckingItemSkipPolicy(skipLimit, skippableExceptions);
128
+
SkipPolicy skipPolicy = new LimitCheckingExceptionHierarchySkipPolicy(skippableExceptions, skipLimit);
125
129
126
130
// step configuration
127
131
int chunkSize = 100;
@@ -138,6 +142,15 @@ public Step faulTolerantChunkOrientedStep(JobRepository jobRepository, JdbcTrans
138
142
139
143
Please refer to the https://github.com/spring-projects/spring-batch/wiki/Spring-Batch-6.0-Migration-Guide[migration guide] for more details on how to migrate from the previous implementation to the new one.
140
144
145
+
[[new-concurrency-model]]
146
+
== New concurrency model
147
+
148
+
Prior to this release, the concurrency model based on the "parallel iteration" concept required a lot of state synchronization at different levels and had several limitations related to throttling and backpressure leading to confusing transaction semantics and poor performance.
149
+
150
+
This release revisits that model and comes with a new, simplified approach to concurrency based on the producer-consumer pattern. A concurrent chunk-oriented step now uses a bounded internal queue between the producer thread and consumer threads. Items are put in the queue as soon as they are ready to be processed, and consumer threads take items from the queue as soon as they are available for processing. Once a chunk is ready to be written, the producer thread pauses until the chunk is written, and then resumes producing items.
151
+
152
+
This new model is more efficient, easier to understand and provides better performance for concurrent executions.
153
+
141
154
[[new-command-line-operator]]
142
155
== New command line operator
143
156
@@ -154,6 +167,23 @@ Prior to this release, if a job execution fails abruptly, it was not possible to
154
167
155
168
This release introduces a new method named `recover` in the `JobOperator` interface that allows you to recover failed job executions consistently across all job repositories.
156
169
170
+
[[ability-to-stop-all-kind-of-steps]]
171
+
== Ability to stop all kinds of steps
172
+
173
+
As of v5.2, it is only possible to externally stop `Tasklet` steps through `JobOperator#stop`.
174
+
If a custom `Step` implementation wants to handle external stop signals, it just can't.
175
+
176
+
This release adds a new interface, named `StoppableStep`, that extends `Step` and which can be implemented by any step that is able to handle stop signals.
177
+
178
+
[[observability-with-jfr]]
179
+
== Observability with the Java Flight Recorder (JFR)
180
+
181
+
In addition to the existing Micrometer metrics, Spring Batch 6.0 introduces support for the Java Flight Recorder (JFR) to provide enhanced observability capabilities.
182
+
183
+
JFR is a powerful profiling and event collection framework built into the Java Virtual Machine (JVM). It allows you to capture detailed information about the runtime behavior of your applications with minimal performance overhead.
184
+
185
+
This release introduces several JFR events to monitor key aspects of a batch job execution, including job and step executions, item reads and writes, as well as transaction boundaries.
0 commit comments