Skip to content

Finishing transition to LMDB (Rayon, Async, Zstd, Dynamic resizing)#10

Merged
ReCore-sys merged 2 commits into
ferrumc-rs:devfrom
Asurar0:database_part2
Sep 12, 2024
Merged

Finishing transition to LMDB (Rayon, Async, Zstd, Dynamic resizing)#10
ReCore-sys merged 2 commits into
ferrumc-rs:devfrom
Asurar0:database_part2

Conversation

@Asurar0
Copy link
Copy Markdown
Contributor

@Asurar0 Asurar0 commented Sep 11, 2024

Important

This PR completes the transition from RocksDB to LMDB for FerrumC, making it fully functional. However, further optimizations are still necessary to unlock its full performance.

Closes: #8

The PR includes the following changes:

  • Implemented Zstd compression (level 6) over a Zstd<T> structure, simplifying the code and enabling future optimizations.
  • Created a dedicated rayon threadpool (LMDB_THREADPOOL) or LMDB, utilizing half of the available CPU cores.
  • Cleaned up imports for better organization.
  • Replaced tokio::task::spawn_blocking with the spawn_blocking_db function, which leverages the rayon threadpool.
  • Implemented a close function to the database
  • Updated all chunks table opens to use Zstd<Chunk> instead of Bytes
  • Implemented dynamic page resizing, starting at 100MB and increasing by 200MB when the environment size limit is reached, with a warning emitted upon each resize.

Additional testing by at least one other contributor is required. My testing has been successful, with a map imported and explored without issues.

- Implemented Zstd compression over a Zstd<T> structure which implements heed BytesEncode and BytesDecode trait
- Implemented a dedicated rayon threadpool (LMDB_THREADPOOL) for LMDB to operate.
- Cleaned up imports a little
- Replaced tokio::task::spawn_blocking by spawn_blocking_db function which uses the rayon threadpool
- Implemented a close function to the database
- Replaces all chunks table open with Zstd<Chunk> instead of Bytes
@Asurar0 Asurar0 changed the title Refactored compression and implemented LMDB over rayon Finish up LMDB (Rayon, Async, Zstd, Dynamic resizing) Sep 12, 2024
@Asurar0 Asurar0 changed the title Finish up LMDB (Rayon, Async, Zstd, Dynamic resizing) Finishing transition to LMDB (Rayon, Async, Zstd, Dynamic resizing) Sep 12, 2024
@ReCore-sys ReCore-sys merged commit 23890b9 into ferrumc-rs:dev Sep 12, 2024
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.

Swap database

2 participants