mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #4461] [Store] Proposal: S3-compatible ObjectStorageAdapter for the distributed storage backend #1130
Labels
No labels
ascend
auto-closed
bug
bug
CI/Build
Common
documentation
enhancement
feature request
good first issue
help wanted
high priority
MetaX
nightly-failure
pull-request
PyTorch Backend
question
RFC
Roadmap
stale
Store
Tests
Transfer Engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/Mooncake#1130
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @pingqiu on GitHub (Oct 3, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/4461
Proposal: an S3-compatible
ObjectStorageAdapterfor the distributed storage backenddocs/source/design/store/oss-backend.mdnotes that key-based storage services such as OSS and S3 plug in through service-specific adapters, and that S3 needs a compatible adapter rather than a different endpoint. We would like to contribute that adapter, so Mooncake Store can offload to any S3-compatible store: AWS S3, SeaweedFS, MinIO, Ceph RGW and others.Proposed shape
"s3"value forfs_adapter_type, next to"oss"instorage_backend.cpp, behind the same libcurl + OpenSSL build condition.oss_adapter.cpp, almost everything is protocol-neutral: URI encoding, canonical query, LIST XML parsing, the curl multi batch engine, iovec uploads and range reads. The OSS-specific parts areBuildUrl,BuildAuthorizationand thex-oss-*header names inPrepareRequest. We would factor the shared part into a common base and add an S3 subclass with AWS Signature V4 (AWS4-HMAC-SHA256,x-amz-*headers), path-style addressing and a custom endpoint. The OSS adapter's behaviour would not change.MOONCAKE_S3_*environment variables (or whatever prefix you prefer).Tests
oss_adapter_test.cppandoss_adapter_config_test.cpp, and a live test helper likeoss_live_test_helpers.h.kDistributed+s3and reads everything back.Questions before we start
common/s3_helper.h)?Happy to adjust the plan to whatever fits the project best.
@github-actions[bot] commented on GitHub (Oct 3, 2026):
Thanks for opening this issue, @pingqiu!
6647175A maintainer will triage this when possible. To help us respond faster, please include:
Useful links: Documentation · Contributing guide
@pingqiu commented on GitHub (Oct 7, 2026):
A follow-up with a working implementation, so the design question has something concrete behind it.
Branch: https://github.com/pingqiu/Mooncake/compare/main...store-s3-standalone (based on current
main)Shape: a standalone S3 adapter. The OSS adapter is not modified.
"s3"is a newfs_adapter_type, registered next to"oss"instorage_backend.cppunder the same libcurl + OpenSSL build condition.S3ObjectStorageAdaptersits on its own protocol-neutral request engine,RestObjectStorageAdapter. It does not touchoss_adapter.cpp/.h, so existing OSS users see no change. The cost is that the OSS adapter and the new engine duplicate some code for now.name=, and the ListObjectsV2 continuation token goes back unencoded, as S3 returns it.MOONCAKE_S3_*, withAWS_*fallbacks.AWS_SESSION_TOKENis never sent withMOONCAKE_S3_*keys.AWS_REGION, thenAWS_DEFAULT_REGION, then us-east-1 with a warning.localhostendpoints use path-style addressing.Tests
Signing. SigV4 known-answer tests check against values computed independently with botocore.
Configuration. Tests cover credential sets, region fallback, scheme and addressing.
Scripted servers. Tests cover the continuation token, retry on 503 and dropped connections, no retry on 403, and giving up after 3 attempts.
Request engine. Because the S3 engine is separate, 24 of the engine tests in
oss_adapter_test.cppare ported to it ins3_adapter_engine_test.cpp, plus a connect-timeout test:Where retry changes an outcome, the test says so. The slow timeout tests are gated behind
MOONCAKE_RUN_S3_FAULT_TIMEOUT_TESTS=1.Live object tests. Lifecycle, 1105-object batches with paginated listing, and a wrong-secret negative control pass against SeaweedFS, MinIO and AWS S3 (us-east-1, repeated runs).
Store-level round trip. This goes through
CreateStorageBackendwithMOONCAKE_DISTRIBUTED_FS_TYPE=s3:BatchOffloadof 33 objects, including an opaque key containing NUL,/,%and\;BatchLoadcompared byte for byte;IsExist.It passes against SeaweedFS, MinIO and AWS S3.
Existing tests. The OSS and file storage tests pass unchanged.
Questions
OssObjectStorageAdapterandS3ObjectStorageAdaptershareRestObjectStorageAdapter(no duplication, no public API change), and I can open that separately if you prefer it. An implementation on the AWS SDK already linked for HA snapshots (common/s3_helper.h) is also possible if that is the direction you want.MOONCAKE_S3_*names and the reuse of theHAVE_OSS_ADAPTERbuild flag fine?If the shape is OK, I'll open the PR as one squashed commit.
@he-yufeng commented on GitHub (Oct 7, 2026):
Thanks for putting a working branch behind the proposal. Answering the two questions with current main as reference.
Standalone adapter first: yes, that is the right sequencing. Rewriting the shipped OSS adapter in the same PR that introduces a new backend mixes a behavior-preserving refactor with a feature, and review has to verify both at once. Land s3 standalone, then send the shared RestObjectStorageAdapter variant as a follow-up refactor with two real consumers to validate against. On the AWS SDK route: I would not take it. The SDK is linked for HA snapshots, but pulling it into the store client build for everyone is heavier than the libcurl + OpenSSL baseline the OSS adapter already keys on, and your ported engine tests would no longer exercise the same request path.
Names: MOONCAKE_S3_* primary with AWS_* fallback matches the house pattern exactly (oss_adapter_config.cpp does MOONCAKE_OSS_* primary, OSS_* alias, via ReadPrimaryOrAlias). Fine as proposed.
One thing I would not reuse literally: HAVE_OSS_ADAPTER. Today that define just means "CURL and OpenSSL were found" (mooncake-store/src/CMakeLists.txt:213-223), but the name and the status line both say OSS. If s3 registers under the same define, a build without the deps prints "OSS adapter: Disabled" and says nothing about s3, and the #else branch at the dispatch site (storage_backend.cpp:5618-5625) would tell an s3 user to install "libcurl and OpenSSL" with an OSS-flavored message. Give s3 its own define (HAVE_S3_ADAPTER) keyed off the same CURL+OpenSSL find_package, with its own status line and its own #else error string at dispatch. Cheap, and keeps the build output honest per adapter.
Two details to make explicit in the PR when you open it:
One squashed commit is fine, [Store] prefix. The SigV4 known-answer tests against botocore values plus the wrong-secret negative control are exactly the coverage this area needs.