Skip to content

Conversation

@zwoop
Copy link
Contributor

@zwoop zwoop commented Nov 4, 2025

The idea here is to allow a configurable amount of directory synchronization to disk, where -1 means "as much parallelism as there are drives". This does have the downside of consuming additional memory during the sync phase.

The default is no parallelization still (same behavior as before). This does however move the sync continuation to the ET_TASK threads, even though most of their work is done on the AIO threads (but feels more correct to move these away from ET_NET).

@zwoop zwoop added this to the 10.2.0 milestone Nov 4, 2025
@zwoop zwoop self-assigned this Nov 4, 2025
@zwoop zwoop added the Cache label Nov 4, 2025
@zwoop
Copy link
Contributor Author

zwoop commented Nov 4, 2025

Behavior with the setting set to "1":

[Nov  4 17:38:31.792] [ET_NET 1] DIAG: <CacheDir.cc:888 (dir_sync_init)> (dir_sync) Disk /tmp/CACHE2/cache.db: 4 stripe(s) assigned to task 0
[Nov  4 17:38:31.792] [ET_NET 1] DIAG: <CacheDir.cc:888 (dir_sync_init)> (dir_sync) Disk /tmp/CACHE/cache.db: 4 stripe(s) assigned to task 0

Behavior when set to -1:

[Nov  4 17:39:56.977] [ET_NET 1] DIAG: <CacheDir.cc:888 (dir_sync_init)> (dir_sync) Disk /tmp/CACHE/cache.db: 4 stripe(s) assigned to task 0
[Nov  4 17:39:56.977] [ET_NET 1] DIAG: <CacheDir.cc:888 (dir_sync_init)> (dir_sync) Disk /tmp/CACHE2/cache.db: 4 stripe(s) assigned to task 1

@zwoop zwoop force-pushed the BetterDirSync branch 4 times, most recently from d9ed36b to 19221e0 Compare November 5, 2025 14:27
@zwoop zwoop requested a review from Copilot November 5, 2025 15:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces parallel directory synchronization for cache stripes to improve performance on multi-drive cache configurations. The implementation replaces the single global CacheSync instance with multiple task-based sync instances, distributing stripe sync operations across ET_TASK threads.

Key changes:

  • Added proxy.config.cache.dir.sync_parallel_tasks configuration parameter to control sync parallelism
  • Refactored from global cacheDirSync to per-stripe cache_sync pointers with task-based scheduling
  • Enhanced CacheSync destructor to properly clean up resources

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/records/RecordsConfig.cc Adds the new sync_parallel_tasks configuration record
src/proxy/http/HttpTransact.cc Adds blank line at file start (formatting change)
src/iocore/cache/StripeSM.h Adds cache_sync pointer to StripeSM and aligns member declarations
src/iocore/cache/StripeSM.cc Updates references from global cacheDirSync to per-stripe cache_sync
src/iocore/cache/P_CacheInternal.h Removes global cacheDirSync declaration and adds cache_config_dir_sync_parallel_tasks extern
src/iocore/cache/P_CacheDir.h Adds destructor, stripe tracking members, and includes to CacheSync struct
src/iocore/cache/CacheDir.cc Implements parallel sync initialization, task distribution logic, and shutdown cleanup
src/iocore/cache/Cache.cc Removes global cacheDirSync and adds configuration loading for new parameter
doc/developer-guide/cache-architecture/architecture.en.rst Documents directory synchronization architecture and configuration
doc/admin-guide/files/records.yaml.en.rst Adds user-facing documentation for the new configuration parameter

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zwoop zwoop requested a review from Copilot November 5, 2025 15:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zwoop zwoop requested a review from Copilot November 5, 2025 15:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant