longhorn-engine
longhorn-engine copied to clipboard
Ublk
Which issue(s) this PR fixes: Issues https://github.com/longhorn/longhorn/issues/5159 , https://github.com/longhorn/longhorn/issues/6600
I am reposting this PR because i think it is a solid solution on integrating ublk with longhorn updated with more benchmarks on a more real-life enviroment
What this PR does / why we need it: This PR uses @derekbit 's POC ubdsrv to integrate ublk with longhorn-engine and adds support for multiple frontend queues.
Using ublk as a frontend option significantly boosts the IOPS in the frontend part of the engine. In our tests, we measure up to ~280k IOPS at the frontend (before the controller communicates with the replicas). Those IOPS are bounded because of my setup.
For the benchmarks i used the folowing setup : CPU : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz RAM: 128GB Disk: Samsung 860 Evo SSD 250GB Network : 10Gbps
One replica , one controller , 2 machines in a local cluster On the ublk : Ublk frontend queues : 6 Controller-Replica connections : 6
The fio command used for testing IOPS:
sudo fio --name=read_iops --filename=/dev/ublkb0 --size=5G --numjobs=12 --time_based --runtime=30s --ramp_time=2s --ioengine=libaio --direct=1 --verify=0 --bs=4K --iodepth=64 --rw=randwrite --group_reporting=1
fio command used for testing Bandwidth:
sudo fio --name=bandwidth --filename=/dev/ublkb0 --size=5G --numjobs=12--time_based --runtime=30s --ramp_time=2s --ioengine=libaio --direct=1 --verify=0 --bs=1M --iodepth=64 --rw=read --group_reporting=1
*Replica R/W disabled means that the replica code is altered in order to answer dummy replies and not do the actual R/W in the Linux sparse files.
Note that the frontend performance was bounded by my pc's process power. Using a more powerful pc , ublk can achieve close to raw disk speeds. Based on these findings we can see that there is also need to improve other parts of the system too in order to utilize ublk fully.
Special notes for your reviewer: In order to replicate the results you will need my version of ubdsrv installed: https://github.com/Kampadais/ubdsrv
To run the controller with ublk frontend, 6 frontend queues and 6 replica-streams:
./longhorn controller test --frontend ublk --size 1g --current-size 1g --frontend-queues 6 --replica-streams 6 --replica tcp://....:9502
We are still the need of a go-ublk-helper because the whole startup procedure is within the frontend.go file and monitoring status is limited. There is also a limitation regarding the name of the block device provided by ublk.
Additional documentation or context
Summary by CodeRabbit
-
New Features
- Introduced a new command-line flag
frontend-queuesfor specifying the number of frontend queues. - Added a new
ublkfrontend package for managing ublk devices, including methods for initialization, starting, and shutting down the device.
- Introduced a new command-line flag
-
Bug Fixes
- Enhanced error handling for the new command-line flag integration.
-
Documentation
- Updated comments to reflect the addition of new parameters and functionalities.
-
Chores
- Modified the Dockerfile to include new dependencies and build steps for the
ubdsrvcomponent.
- Modified the Dockerfile to include new dependencies and build steps for the
This pull request is now in conflict. Could you fix it @Kampadais? 🙏
This PR is stale because it has been open for 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.
Walkthrough
The changes introduce a new command-line flag frontend-queues in the ControllerCmd function, allowing users to specify the number of frontend queues. This flag is integrated into the controller's initialization process and affects the instantiation of the ublk frontend. Additionally, the Dockerfile is updated to include dependencies for a new component, ubdsrv, along with its build steps. A new package ublk is created to manage ublk devices, encapsulating various functionalities related to their operation.
Changes
| File | Change Summary |
|---|---|
| app/cmd/controller.go | Added frontend-queues command-line flag; updated method signatures for NewFrontend and NewController to include frontendQueues. |
| package/Dockerfile | Added installation commands for development tools; introduced UBD_COMMIT_ID environment variable; added build steps for liburing and ubdsrv. |
| pkg/controller/control.go | Added frontendQueues field to Controller struct; updated NewController method signature to include frontendQueues. |
| pkg/controller/init_frontend.go | Updated NewFrontend method signature to include frontendQueues; added case for ublk frontend type. |
| pkg/frontend/ublk/frontend.go | Introduced ublk package with methods for managing ublk devices; added multiple methods and a struct DataProcessorWrapper for handling data operations. |
Assessment against linked issues
| Objective | Addressed | Explanation |
|---|---|---|
| Implementation of the single queue longhorn-ublk (#5159) | ✅ | |
| Implementation of go-ublk-helper (#5159) | ✅ | |
| Integrate go-ublk-helper and longhorn-engine (#5159) | ✅ | |
| Error handling (#5159) | ❌ | Specific error handling not detailed. |
| Performance benchmark (#5159) | ❓ | Changes do not specify benchmarks. |
Poem
🐇 In the meadow where changes bloom,
A flag for queues dispels the gloom.
With ublk's might, we pave the way,
For faster paths in bright array.
So hop along, let’s cheer and play,
For Longhorn's future shines today! 🌼
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Generate unit testing code for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and generate unit testing code.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR. (Experiment)@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
Adding the PR in backlog milestone so that it won't stale