Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(storage): Refactor improving performance and atomicity. #8

Merged
merged 4 commits into from
Feb 14, 2024

Conversation

ajnavarro
Copy link
Collaborator

Overview:

This commit overhauls the Storage layer to set the foundation for a high-performance filtering system based on bitmap indexing. The refactoring introduces a more efficient data handling model and resolves critical issues that affect stability and performance.

Key Changes:

  • Introduced the concept of 'WriteBatch' in the Storage interface to support efficient data operations.
  • Removed the DB interface to eliminate excessive abstraction, making difficult the implementation of database-specific optimizations.
  • Fixed the handling of byte arrays in Pebble's closer method to prevent data corruption. The Storage layer now parses data correctly before the Get operation is closed, eliminating the risk of random failures.
  • Implemented batching for data writing from remote nodes, enhancing data consistency and speed.
  • Restructured Mock objects into an internal package, restricting access to internals and eliminating the need for specific build tags.

Overview:
This commit overhauls the Storage layer to set the foundation for a high-performance filtering system based on bitmap indexing. The refactoring introduces a more efficient data handling model and resolves critical issues that affected stability and performance.

Key Changes:
- Introduced the concept of 'WriteBatch' in the Storage interface to support efficient data operations.
- Removed the DB interface to eliminate excessive abstraction, making difficult the implementation of database-specific optimizations.
- Fixed the handling of byte arrays in Pebble's closer method to prevent data corruption. The Storage layer now ensures that data is parsed correctly before the Get operation is closed, eliminating the risk of random failures.
- Implemented batching for data writting from remote nodes, enhancing data consistency and speed.
- Restructured Mock objects into an internal package, restricting access to internals and eliminating the need for specific build tags.

Signed-off-by: Antonio Navarro Perez <[email protected]>
@ajnavarro ajnavarro requested a review from a team as a code owner February 1, 2024 14:15
Signed-off-by: Antonio Navarro Perez <[email protected]>
Copy link
Member

@zivkovicmilos zivkovicmilos left a comment

Choose a reason for hiding this comment

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

Looks great 💯

Thank you for adding these improvements 🙏

I've ran this on the test3 testnet, which at the moment had ~252 250 blocks. It synced and indexed the entire chain in ~3min:

2024-02-08T11:47:53.430+0100 # start
2024-02-08T11:50:50.378+0100 # end

Just to give perspective, it used to take ~30min to sync the entire chain (less blocks than this) before this PR, so a x10 improvement 👏

storage/types.go Outdated Show resolved Hide resolved
storage/types.go Outdated Show resolved Hide resolved
storage/types.go Outdated Show resolved Hide resolved
storage/pebble.go Outdated Show resolved Hide resolved
storage/pebble.go Show resolved Hide resolved
internal/mock/storage.go Show resolved Hide resolved
fetch/fetch.go Show resolved Hide resolved
Signed-off-by: Antonio Navarro Perez <[email protected]>
Signed-off-by: Antonio Navarro Perez <[email protected]>
@ajnavarro ajnavarro merged commit d5bb902 into main Feb 14, 2024
3 checks passed
@ajnavarro ajnavarro deleted the chore/refactor-storage-layer branch February 14, 2024 10:46
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.

2 participants