Add destination concurrency support to znapzendzetup#687
Open
nickilby wants to merge 4 commits into
Open
Conversation
- Introduced `--dst-concurrency` option for parallel destination sends. - Updated documentation to reflect new concurrency feature. - Enhanced validation for `dst_concurrency` and `dst_concurrency_enabled` settings. - Added tests for new functionality in znapzendzetup.
Owner
|
thanks, please update the CHANGES file |
- Implemented explicit opt-in for destination concurrency in `znapzendzetup`. - Updated existing configurations to maintain compatibility while new backup sets default to serial processing. - Adjusted regex patterns to exclude `dst_concurrency` from destination key matches.
Author
|
Hi CHANGES file updated, and tests corrected |
Owner
|
you set it to draft ? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make Destination Concurrency Opt-In with Backward Compatibility
Executive Summary
This pull request introduces an improvement for znapzend users by making destination replication concurrency opt-in. The change preserves 100% backward compatibility with existing configurations while introducing safer defaults for new backup sets.
Key Impact:
--dst-concurrencyflag during create/edit operationsProblem Statement
Current Behavior (Before)
When a znapzend backup plan is created with multiple destination targets, znapzend processes destinations serially by default (one destination at a time):
Current serial processing is safe and predictable, but it has limitations:
Why This Is A Need For Improvement
Real-World Impact Example
An operator configures 3 remote backup destinations for their production database:
Result: Destinations process serially, each taking 5 minutes. Total backup window: 15+ minutes per cycle. Network link remains at 20% utilization (could safely push to 60% with stricter concurrency limits).
Solution: Explicit Opt-In for Parallelism
This PR introduces an explicit concurrency control mechanism that allows operators to choose parallelism when beneficial, while maintaining safe serial defaults.
Key Design Principles
Technical Implementation
New Property:
dst_concurrency_enabledA new ZFS property controls whether destination concurrency is active:
onoffNew CLI Flag:
--dst-concurrencyThe
--dst-concurrencyflag enables parallel destination processing with optional worker limit:Behavior Matrix: All Scenarios
Scenario 1: New Backup Set (No Flag)
Result:
dst_concurrency_enabled=offScenario 2: New Backup Set with Full Parallelism
Result:
dst_concurrency_enabled=ondst_concurrency(unset, defaults to all destinations)Scenario 3: New Backup Set with Bounded Parallelism
Result:
dst_concurrency_enabled=ondst_concurrency=2Scenario 4: Existing Configuration (No Changes Needed)
Result:
Scenario 5: Editing Existing Config (Without Concurrency Flag)
Result:
dst_concurrency_enabled(unchanged)Scenario 6: Editing Existing Config (With Concurrency Flag)
Result:
dst_concurrency_enabled=ondst_concurrency=3Configuration Examples
Example 1: Conservative Setup (Default for New Configs)
Config stored in ZFS:
Runtime behavior:
Example 2: High-Throughput Setup (Opt-In Parallelism)
Config stored in ZFS:
Runtime behavior:
Example 3: Upgrading Existing Config (No Changes)
An operator has an existing config from before this PR:
After upgrade to this PR version:
dst_concurrency_enabledis not presentIf operator NOW wants to enable parallelism:
Result:
dst_concurrency_enabled=onanddst_concurrency=2are added to config, enabling 2-worker parallelism going forward.Changed Behavior Summary
For New Configurations
For Existing Configurations
Migration and Upgrade Guide
For System Administrators
TL;DR: Do nothing. Existing systems are unaffected.
For New Deployments
Start with the safe default and opt-in to parallelism only if needed:
Decision Tree: Should I Use --dst-concurrency?
Implementation Details
Files Changed
bin/znapzendzetup
--dst-concurrency:sflag (optional argument supporting bare flag or value)dst_concurrency_enabled=offby defaultlib/ZnapZend.pm
dst_concurrency_enabledfirst, then use the marker-not-set compatibility pathlib/ZnapZend/Config.pm
dst_concurrency_enabledvalues (on|off)doc/znapzendzetup.pod
README.md
t/znapzendzetup.t
--dst-concurrencyflagSafety and Risk Mitigation
Safety Measures
Validation
dst_concurrency_enabledmust beonoroff(dies on invalid value)dst_concurrencymust be positive integer >= 1 (existing rule, unchanged)Testing
Logging and Observability
Runtime Decision Logging
When processing backup sets, znapzend emits per-destination send logs. Sanitized example:
When destination concurrency is enabled, multiple destinations start at nearly the same
timestamp (often with different worker PIDs), indicating parallel send workers.
Backward Compatibility Promise
This PR Guarantees
✅ Zero breaking changes for systems using existing backup sets
✅ Automatic compatibility-path detection — no manual migration required
✅ Composable with future enhancements (other properties are unaffected)
✅ Invertible — can be undone with explicit property edits if needed
This PR Does NOT
❌ Change behavior of existing backup sets
Operational Safety
Questions and Answers
Q: Will my existing backups break?
A: No. Existing backup sets continue working exactly as before. This PR does not silently change behavior on existing sets. The property
dst_concurrency_enabledis optional and parallelism remains an explicit operator choice.Q: How do I enable parallelism in new configs?
A: Use
--dst-concurrencyduring create:znapzendzetup create --dst-concurrency .... Use--dst-concurrency=2to limit to 2 parallel workers. Without the flag, new configs default to serial processing for safety.Q: What if I want to edit an existing config without changing concurrency?
A: Just don't use the
--dst-concurrencyflag during edit. Only properties you explicitly pass are updated (and concurrency behavior remains unchanged).Q: Can I convert an existing config to use the new opt-in concurrency?
A: Yes. Run
znapzendzetup edit --dst-concurrency=<limit> ...and it will add the marker and enable parallelism with the specified limit.Q: What happens if dst_concurrency_enabled is on but the numeric limit is not set?
A: It defaults to "all destinations in parallel" (unbounded parallelism for maximum throughput).
Q: Why use a separate marker property instead of checking if dst_concurrency exists?
A: The marker (
dst_concurrency_enabled) cleanly separates "user wants parallelism" (on/off) from "how many workers" (the numeric limit). This avoids overloading one property for two meanings and keeps concurrency intent explicit.Conclusion
This PR adds explicit opt-in parallelism for destination processing while maintaining 100% backward compatibility with existing deployments. The feature transparently enhances the znapzend toolbox for operators who need faster backup completion, while keeping safe serial defaults for new configurations.
The implementation is minimal and focused: a single marker property (
dst_concurrency_enabled) and a CLI flag (--dst-concurrency) enable parallelism when desired. Users upgrading to this version need take no action; their existing backup schedules continue working unchanged. New deployments benefit from the safer default and have the option to opt-in to parallelism when capacity permits.