3.3 KiB
11. Production checklist
Everything below is a consequence of an earlier chapter, not a new claim — this is the condensed version to check a real job against.
-
Confirm your
Partitioneractually readsgridSizebefore sizing anything by it.MultiResourcePartitionerdoes not (chapter 3). The number of partitions that run is whatever your partitioner'spartition()map returns, full stop — check that, not thegridSizeproperty, when something needs exactly N partitions. -
Size the thread pool to at least gridSize, with a queue, not a bare
AbortPolicyat zero capacity. An undersized pool withAbortPolicydoes not fail loudly — it leaves rejected partitions'StepExecutions parked atSTARTINGforever and makes every future restart throwJobExecutionAlreadyRunningException(chapter 7, chapter 9). If you must useAbortPolicyfor fail-fast behavior, have an operational runbook that callsJobOperator#recoverbefore anyone tries to restart. -
Benchmark gridSize against your actual data volume, not just your core count. More partitions than cores got worse, not flat, at both scales this module measured; at the smaller of the two, over-partitioning lost to not partitioning at all (chapter 10). A gridSize tuned for a large nightly batch is not automatically safe for a smaller one.
-
Check what your worker steps write to. A single-writer embedded database (this module's H2 file) caps the speedup partitioning can deliver regardless of thread count or core count (chapter 6, chapter 10). A database built for concurrent writers changes this ceiling; measure again against the real target rather than assuming.
-
Make the writer idempotent if partitions can retry.
MERGE ... KEY(order_id)here, notINSERT(chapter 4) — a partition that fails after partially writing and then restarts writes some rows twice on a plainINSERT. -
Delete the diagnostic endpoint (chapter 5) or put it behind real authentication before this leaves a sandbox.
-
Don't reach for
BeanPropertySqlParameterSource/beanMapped()with Java records without checking it actually populated your columns (chapter 4) — it fails by silently writingNULL, not by throwing. -
If migrating a 5.x partitioned job to 6.0, budget time for the
org.springframework.batch.item.*→org.springframework.batch.infrastructure.item.*import rewrite across every reader, writer, andExecutionContextreference before anything else compiles (docs/output/03-package-repackaging-javap.txt), and rename any@Beanmethods that were only distinguished by@Profile(docs/output/04-enforceuniquemethods-error.txt).