Skip to content

feat: implement global bounded buffer pool singleton - #2979

Merged
oferchen merged 1 commit into
masterfrom
feat/global-buffer-pool
Mar 22, 2026
Merged

oferchen merged 1 commit into
masterfrom
feat/global-buffer-pool

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Add a process-wide BufferPool singleton using OnceLock<Arc>, replacing per-subsystem pool instances with a shared memory budget
  • Provide global_buffer_pool() for lazy initialization and init_global_buffer_pool(config) for explicit early configuration via GlobalBufferPoolConfig
  • Update CopyContext and prefetch_checksums (parallel checksum) to use the global pool instead of creating their own

Test plan

  • Unit tests for GlobalBufferPoolConfig default and custom values
  • Singleton identity test (Arc::ptr_eq) confirms same instance across calls
  • Thread safety test spawns 8 threads acquiring buffers concurrently
  • Buffer reuse test verifies returned buffers re-enter the pool
  • Double-init test confirms init_global_buffer_pool returns Err after lazy init
  • CI: fmt, clippy, nextest on all platforms

Replace per-subsystem BufferPool instances with a process-wide
singleton backed by OnceLock<Arc<BufferPool>>. A shared memory
budget is more efficient than independent pools that each size
themselves to hardware parallelism.

- Add global.rs with global_buffer_pool() lazy accessor and
  init_global_buffer_pool(config) for explicit initialization
- Add GlobalBufferPoolConfig for custom max_buffers / buffer_size
- Update CopyContext and parallel_checksum to use the global pool
- Include tests for singleton semantics, thread safety, and reuse
@github-actions github-actions Bot added the enhancement New feature or request label Mar 22, 2026
@oferchen
oferchen merged commit f27f27f into master Mar 22, 2026
12 of 17 checks passed
@oferchen
oferchen deleted the feat/global-buffer-pool branch March 22, 2026 14:38
oferchen added a commit that referenced this pull request May 1, 2026
Replace per-subsystem BufferPool instances with a process-wide
singleton backed by OnceLock<Arc<BufferPool>>. A shared memory
budget is more efficient than independent pools that each size
themselves to hardware parallelism.

- Add global.rs with global_buffer_pool() lazy accessor and
  init_global_buffer_pool(config) for explicit initialization
- Add GlobalBufferPoolConfig for custom max_buffers / buffer_size
- Update CopyContext and parallel_checksum to use the global pool
- Include tests for singleton semantics, thread safety, and reuse
oferchen added a commit that referenced this pull request May 5, 2026
Replace per-subsystem BufferPool instances with a process-wide
singleton backed by OnceLock<Arc<BufferPool>>. A shared memory
budget is more efficient than independent pools that each size
themselves to hardware parallelism.

- Add global.rs with global_buffer_pool() lazy accessor and
  init_global_buffer_pool(config) for explicit initialization
- Add GlobalBufferPoolConfig for custom max_buffers / buffer_size
- Update CopyContext and parallel_checksum to use the global pool
- Include tests for singleton semantics, thread safety, and reuse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant