Skip to content

Commit c20644c

Browse files
committed
Update documentation
1 parent 6591657 commit c20644c

File tree

7 files changed

+76
-19
lines changed

7 files changed

+76
-19
lines changed

spring-batch-docs/modules/ROOT/nav.adoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@
5353
** xref:spring-batch-integration/launching-jobs-through-messages.adoc[]
5454
** xref:spring-batch-integration/available-attributes-of-the-job-launching-gateway.adoc[]
5555
** xref:spring-batch-integration/sub-elements.adoc[]
56-
* xref:monitoring-and-metrics.adoc[]
57-
* xref:tracing.adoc[]
56+
* xref:spring-batch-observability.adoc[]
57+
** xref:spring-batch-observability/micrometer.adoc[]
58+
** xref:spring-batch-observability/jfr.adoc[]
5859
* Appendices
5960
** xref:appendix.adoc[]
6061
** xref:schema-appendix.adoc[]

spring-batch-docs/modules/ROOT/pages/index.adoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ xref:common-patterns.adoc#commonPatterns[Common Patterns] :: Common batch proces
2828
and guidelines.
2929
xref:spring-batch-integration.adoc[Spring Batch Integration] :: Integration
3030
between Spring Batch and Spring Integration projects.
31-
xref:monitoring-and-metrics.adoc[Monitoring and metrics] :: Batch jobs
31+
xref:spring-batch-observability.adoc[Spring Batch Observability] :: Batch jobs
3232
monitoring and metrics.
33-
xref:tracing.adoc[Tracing] :: Tracing with Micrometer.
3433

3534
The following appendices are available:
3635

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
[[springBatchObservability]]
3+
= Spring Batch Observability
4+
5+
Observability is a critical aspect of modern applications, and Spring Batch provides robust support for monitoring and tracing batch jobs.
6+
7+
This section covers the integration of Spring Batch with popular observability tools such as Micrometer and Java Flight Recorder (JFR):
8+
9+
[role="xmlContent"]
10+
* xref:spring-batch-observability/micrometer.adoc[Micrometer Support]
11+
* xref:spring-batch-observability/jfr.adoc[Java Flight Recorder Support]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[[jfr]]
2+
= Java Flight Recorder (JFR) support
3+
4+
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:
7+
8+
[source, bash]
9+
----
10+
java -XX:StartFlightRecording:filename=my-batch-job.jfr,dumponexit=true -jar my-batch-job.jar
11+
----
12+
13+
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.

spring-batch-docs/modules/ROOT/pages/monitoring-and-metrics.adoc renamed to spring-batch-docs/modules/ROOT/pages/spring-batch-observability/micrometer.adoc

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
[[micrometer]]
2+
= Micrometer support
13

2-
[[monitoring-and-metrics]]
3-
= Monitoring and metrics
44

5+
[[monitoring-and-metrics]]
6+
== Monitoring and metrics
57

68
Since version 4.2, Spring Batch provides support for batch monitoring and metrics
79
based on link:$$https://micrometer.io/$$[Micrometer]. This section describes
@@ -82,4 +84,14 @@ Metrics.globalRegistry.config().meterFilter(MeterFilter.denyNameStartsWith("spri
8284
----
8385

8486
See Micrometer's link:$$http://micrometer.io/docs/concepts#_meter_filters$$[reference documentation]
85-
for more details.
87+
for more details.
88+
89+
[[tracing]]
90+
== Tracing
91+
92+
As of version 5, Spring Batch provides tracing through Micrometer's `Observation` API. By default, tracing is enabled
93+
when using `@EnableBatchProcessing`. Spring Batch will create a trace for each job execution and a span for each
94+
step execution.
95+
96+
If you do not use `EnableBatchProcessing`, you need to register a `BatchObservabilityBeanPostProcessor` in your
97+
application context, which will automatically setup Micrometer's observability in your jobs and steps beans.

spring-batch-docs/modules/ROOT/pages/tracing.adoc

Lines changed: 0 additions & 9 deletions
This file was deleted.

spring-batch-docs/modules/ROOT/pages/whatsnew.adoc

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33

44
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].
55

6-
Spring Batch 6.0 includes the following features:
6+
Spring Batch 6.0 includes the following features and improvements:
77

88
* xref:whatsnew.adoc#dependencies-upgrade[Dependencies upgrade]
99
* xref:whatsnew.adoc#batch-infrastrucutre-configuration-improvements[Batch infrastructure configuration improvements]
1010
* xref:whatsnew.adoc#new-implementation-of-the-chunk-oriented-processing-model[New implementation of the chunk-oriented processing model]
11+
* xref:whatsnew.adoc#new-concurrency-model[New concurrency model]
1112
* xref:whatsnew.adoc#new-command-line-operator[New command line operator]
1213
* 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)]
1316
* xref:whatsnew.adoc#deprecations-and-pruning[Deprecations and pruning]
1417

1518
[[dependencies-upgrade]]
@@ -70,7 +73,8 @@ In this release, several changes have been made to simplify the batch infrastruc
7073

7174
* The `JobRepository` now extends the `JobExplorer` interface, so there is no need to define a separate `JobExplorer` bean.
7275
* 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.
7478

7579
This reduces the number of beans required for a typical batch application and simplifies the configuration code.
7680

@@ -121,7 +125,7 @@ public Step faulTolerantChunkOrientedStep(JobRepository jobRepository, JdbcTrans
121125
// skip policy configuration
122126
int skipLimit = 50;
123127
var skippableExceptions = Set.of(FlatFileParseException.class);
124-
SkipPolicy skipPolicy = new LimitCheckingItemSkipPolicy(skipLimit, skippableExceptions);
128+
SkipPolicy skipPolicy = new LimitCheckingExceptionHierarchySkipPolicy(skippableExceptions, skipLimit);
125129
126130
// step configuration
127131
int chunkSize = 100;
@@ -138,6 +142,15 @@ public Step faulTolerantChunkOrientedStep(JobRepository jobRepository, JdbcTrans
138142

139143
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.
140144

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+
141154
[[new-command-line-operator]]
142155
== New command line operator
143156

@@ -154,6 +167,23 @@ Prior to this release, if a job execution fails abruptly, it was not possible to
154167

155168
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.
156169

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.
186+
157187
[[deprecations-and-pruning]]
158188
== Deprecations and pruning
159189

0 commit comments

Comments
 (0)