Add the scheduling module

Three replicas of one application against one PostgreSQL database, proving
duplicate @Scheduled execution and then removing it with ShedLock: 24
executions where 8 were due, then 7 for 7 ticks.

Also measured: @SchedulerLock without @EnableSchedulerLock does nothing and
warns about nothing; spring.task.scheduling.pool.size=1 does not starve a
fixedRate job but delays it and fires 35 of 40 executions in a burst; and a
node whose clock is 40 seconds fast takes a live lock unless the provider
uses usingDbTime().
This commit is contained in:
2026-09-01 23:28:06 +05:30
parent 243cccd4ca
commit 6af6e4a3f1
31 changed files with 1373 additions and 1 deletions

16
scheduling/scripts/run-all.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# Regenerates every file under docs/output/. Takes about three minutes: two three-replica runs of
# 30 seconds each plus the test suite, and three JVMs need roughly ten seconds to start on a
# small box.
set -euo pipefail
cd "$(dirname "$0")/.."
mkdir -p docs/output
scripts/postgres.sh start >/dev/null
mvn -B -q -DskipTests package
mvn -B test 2>&1 | grep -E 'Running |Tests run:|BUILD ' > docs/output/tests.txt
scripts/three-replicas.sh unlocked > docs/output/three-replicas-unlocked.txt
scripts/three-replicas.sh locked > docs/output/three-replicas-locked.txt
echo "regenerated:"; ls -1 docs/output