Skip to content

Performance improvements and guide update - #20

Merged
tishun merged 3 commits into
Codarama:mainfrom
tishun:topic/tishun/revamp-perf-tests
Jul 22, 2026
Merged

Performance improvements and guide update#20
tishun merged 3 commits into
Codarama:mainfrom
tishun:topic/tishun/revamp-perf-tests

Conversation

@tishun

@tishun tishun commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Revamps the performance/benchmark suite, lands two structural performance improvements to the core locking paths (parallel multi-node I/O and configurable exponential backoff with jitter), brings the documentation back in line with the current API, and streamlines CI. Core code changes are additive and non-breaking.

Core performance

  • Parallel multi-node I/O (MultiNodeStrategy): acquire/release/extend now fan out per-node Redis operations concurrently via CompletableFuture on a shared daemon thread pool, waiting for the quorum on join. Per-attempt cost drops from ~N×RTT to ~max(RTT) on multi-node clusters.
  • Exponential backoff with jitter: new BackoffCalculator (delay = min(maxRetryDelay, retryDelay × multiplier^attempt), optional jitter), applied in PollingWaitStrategy, the Redlock retry-loop fallback, and RedlockReadWriteLock. Replaces the fixed retry delay that caused contention storms. FairLock intentionally stays on tight polling.
  • Config: RedlockConfiguration adds maxRetryDelay, retryDelayMultiplier (≥ 1.0), and retryDelayJitterRatio ([0.0, 1.0]), validated. Defaults preserve prior behavior (multiplier 1.0, jitter 0.0).
  • LockWaitStrategy: attempt-aware waitForRelease(key, timeout, attempt) and a backoff-parameterized initialize(...) overload (both default-provided).

Benchmarks & tests

  • New JsonReportGenerator emits machine-readable JSON alongside markdown; per- primitive *-benchmark-results.json added; scenarios/clients and aggregation refactored; new benchmark-analysis.md with methodology and cross-library standings.
  • Added BackoffCalculatorTest, PollingWaitStrategyTest, and new RedlockConfigurationTest cases.

Documentation

  • Full accuracy pass against the current API. Rewrote the getting-started path (index, quick-start, basic-usage, redis-clients, best-practices) off the removed legacy new Redlock(pool…) / redlock.lock(key, ttl) API to the
    RedlockManager factory (withJedis/withLettucecreateLock, JDK Lock, try-with-resources on the manager).
  • API reference: fixed RxRedlock method names/return types, documented the new backoff config options and database node option.
  • Architecture: corrected native CAS/CAD to Redis 8.4+, clarified polling uses the configurable retryDelay (default 200ms); regenerated stale benchmark tables to match the current results.
  • Comparison docs: switched to factory usage, corrected CountDownLatch.countDown to atomic (decrAndPublishIfZero), fixed signatures, removed leftover fragments.
  • Removed decorative emoji across the docs.

CI

  • ci.yml: consolidated unit + integration test steps, moved performance tests to -Dgroups=performance, and removed redundant report/code-quality/build-info jobs.
  • Removed the standalone pr-validation.yml workflow.
  • nightly.yml: dropped a redundant unit-test step.
  • Added a Codecov coverage badge to the README.

Compatibility

No breaking API changes. New config options are additive; new interface methods have defaults. Behavior is unchanged unless backoff is explicitly configured.

@tishun
tishun merged commit 756fa91 into Codarama:main Jul 22, 2026
6 checks passed
@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.18519% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.07%. Comparing base (371dfe9) to head (2d85413).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...codarama/redlock4j/strategy/BackoffCalculator.java 66.66% 2 Missing and 3 partials ⚠️
...codarama/redlock4j/strategy/MultiNodeStrategy.java 82.14% 5 Missing ⚠️
...n/java/org/codarama/redlock4j/AbstractRedlock.java 62.50% 2 Missing and 1 partial ⚠️
...a/org/codarama/redlock4j/RedlockReadWriteLock.java 85.71% 0 Missing and 1 partial ⚠️
.../redlock4j/configuration/RedlockConfiguration.java 95.23% 0 Missing and 1 partial ⚠️
...darama/redlock4j/strategy/PollingWaitStrategy.java 91.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##               main      #20       +/-   ##
=============================================
+ Coverage     61.21%   74.07%   +12.86%     
=============================================
  Files            25       27        +2     
  Lines          1748     1809       +61     
  Branches        200      208        +8     
=============================================
+ Hits           1070     1340      +270     
+ Misses          597      341      -256     
- Partials         81      128       +47     
Flag Coverage Δ
unittests 74.07% <85.18%> (+12.86%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant