MCPcopy Index your code
hub / github.com/CurvineIO/curvine

github.com/CurvineIO/curvine @v0.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.1.0 ↗ · + Follow
4,858 symbols 12,948 edges 556 files 665 documented · 14%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

curvine-font-dark curvine-font-light

English || 简体中文 | Deutsch | Español | français | 日本語 | 한국어 | Português | Русский

License Rust

Curvine 是一个用 Rust 编写的高性能、并发分布式缓存系统,专为低延迟和高吞吐量工作负载设计。

📚 文档资源

更多详细信息,请参阅:

应用场景

use_case

  • 场景1: 训练加速
  • 场景2: 模型分发
  • 场景3: 热表数据加速
  • 场景4: 大数据Shuffle加速
  • 场景5: 多云数据缓存

🚀 核心特性

  • 高性能 RPC 框架:基于 Tokio 的异步通信框架,支持高并发请求处理。
  • 分布式架构:采用 Master-Worker 架构设计,支持水平扩展。
  • 多级缓存:支持内存、SSD 和 HDD 的多级缓存策略。
  • FUSE 接口:提供 FUSE 文件系统接口,可无缝集成到现有系统中。
  • 底层存储集成:支持与多种底层存储系统集成。
  • Raft 共识:采用 Raft 算法确保数据一致性与高可用性。
  • 监控与指标:内置监控与性能指标收集功能。
  • Web 界面:提供 Web 管理界面,便于系统监控与管理。

🧩 模块化架构

Curvine 采用模块化设计,主要由以下核心组件构成:

  • orpc: 一个支持异步 RPC 调用的高性能网络通信框架
  • curvine-common: 包含协议定义、错误处理和通用工具的共享库
  • curvine-server: 服务端组件,包含 Master 和 Worker 实现
  • curvine-client: 提供与服务器交互 API 的客户端库
  • curvine-fuse: FUSE 文件系统接口,支持将 Curvine 挂载为本地文件系统
  • curvine-libsdk: 支持多语言访问的 SDK 库
  • curvine-web: Web 管理界面和 API
  • curvine-tests: 测试框架与性能基准测试工具

📦 系统要求

  • Rust 1.80+
  • Linux 或 macOS (Windows 支持有限)
  • FUSE 库 (用于文件系统功能)

🗂️ 缓存文件系统访问

🦀 Rust API (原生集成推荐)

use curvine_common::conf::ClusterConf;
use curvine_common::fs::Path;
use std::sync::Arc;

let conf = ClusterConf::from(conf_path);
let rt = Arc::new(conf.client_rpc_conf().create_runtime());
let fs = CurvineFileSystem::with_rt(conf, rt)?;

let path = Path::from_str("/dir")?;
fs.mkdir(&path).await?;

📌 FUSE (用户空间文件系统)

ls /curvine-fuse

官方支持的 Linux 发行版

操作系统发行版 内核要求 测试版本 依赖项
CentOS 7 ≥3.10.0 7.6 fuse2-2.9.2
CentOS 8 ≥4.18.0 8.5 fuse3-3.9.1
Rocky Linux 9 ≥5.14.0 9.5 fuse3-3.10.2
RHEL 9 ≥5.14.0 9.5 fuse3-3.10.2
Ubuntu 22 ≥5.15.0 22.4 fuse3-3.10.5

🐘 Hadoop 兼容 API

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.*;

Configuration conf = new Configuration();
conf.set("fs.cv.impl", "io.curvine.CurvineFileSystem");

FileSystem fs = FileSystem.get(URI.create("cv://master:8995"), conf);
FSDataInputStream in = fs.open(new Path("/user/test/file.txt"));

🛠 构建指南

本项目需要以下依赖项,请确保在继续之前已安装:

📋 先决条件

  • GCC: 10 或更高版本 (安装指南)
  • Rust: 1.86 或更高版本 (安装指南)
  • Protobuf: 3.x 版本
  • Maven: 3.8 或更高版本 (安装指南)
  • LLVM: 12 或更高版本 (安装指南)
  • FUSE: libfuse2 或 libfuse3 开发包
  • JDK: 1.8 或更高版本 (OpenJDK 或 Oracle JDK)
  • npm: 9 或更高版本 (Node.js 安装)
  • Python: 3.7 或更高版本 (安装指南)

您可以选择:

  1. 使用预配置的 curvine-docker/compile/Dockerfile_rocky9 来构建编译镜像
  2. 参考此 Dockerfile 为其他操作系统版本创建编译镜像
  3. curvine在dockerhub上提供了curvine/curvine-compile:latest 镜像(基于rocky9),可以使用此镜像进行编译

🚀 构建步骤 (Linux - Ubuntu/Debian 示例)

使用 make 编译:

# 编译所有模块
make all

# 只编译核心模块: server client cli
make build ARGS="-p core"

# 编译fuse和核心模块
make build ARGS="-p core -p fuse"

使用build.sh编译:

# 编译所有模块
sh build/build.sh 

# 输出命令帮助 
sh build/build.sh -h

# 只编译核心模块: server client cli
sh build/build.sh -p core

# 编译fuse和核心模块
sh build/build.sh -p core -p fuse

构建镜像:

# or use curvine-compile:latest docker images to build
make docker-build

# or use curvine-compile:build-cached docker images to build, this image already cached most dependency crates
make docker-build-cached

编译成功后,目标文件将生成在 build/dist 目录中。该文件是可用于部署或构建镜像的 Curvine 安装包。

🖥️ 启动单节点集群

cd build/dist

# Start the master node
bin/curvine-master.sh start

# Start the worker node
bin/curvine-worker.sh start

挂载文件系统

# The default mount point is /curvine-fuse
bin/curvine-fuse.sh start

查看集群概览:

bin/cv report

执行文件系统命令:

bin/dfs fs mkdir /a
bin/dfs fs ls /

访问 Web 界面:

http://your-hostname:9000

Curvine 使用 TOML 格式的配置文件。示例配置位于 conf/curvine-cluster.toml,主要配置项包括:

  • 网络设置(端口、地址等)
  • 存储策略(缓存大小、存储类型)
  • 集群配置(节点数量、副本因子)
  • 性能调优参数

🏗️ 架构设计

Curvine 采用主从架构:

  • 主节点:负责元数据管理、工作节点协调和负载均衡
  • 工作节点:负责数据存储和处理
  • 客户端:通过 RPC 与主节点和工作节点通信

该系统使用 Raft 共识算法确保元数据一致性,并支持多种存储策略(内存、SSD、HDD)以优化性能和成本。

📈 性能表现

Curvine 在高并发场景下表现优异,支持:

  • 高吞吐量数据读写
  • 低延迟操作
  • 大规模并发连接

📜 许可证

Curvine 采用 Apache License 2.0 开源协议授权。

星标历史

Star History Chart

Extension points exported contracts — how you extend this code

HandlerService (Interface)
The message processor runs and manages the following functions: 1. Manage the creation of MessageHandler. 2. Global vari [6 …
orpc/src/handler/handler_service.rs
WorkerPolicy (Interface)
Worker selects a policy [4 implementers]
curvine-server/src/master/fs/policy/worker_policy.rs
AppStorage (Interface)
Application layer storage. Replay raft log [3 implementers]
curvine-common/src/raft/storage/app_storage.rs
FileSystem (Interface)
(no doc) [4 implementers]
curvine-fuse/src/fs/file_system.rs
PollRead (Interface)
(no doc) [4 implementers]
curvine-s3-gateway/src/utils/mod.rs
RouterHandler (Interface)
(no doc) [4 implementers]
curvine-web/src/router/router_handler.rs
ToPyErr (Interface)
(no doc) [1 implementers]
curvine-libsdk/src/python/python_abi.rs
AsyncChunkReader (Interface)
(no doc) [1 implementers]
curvine-ufs/src/fs/buffer_transfer.rs

Core symbols most depended-on inside this repo

to_string
called by 631
orpc/src/common/speed_counter.rs
clone
called by 369
curvine-server/src/master/meta/inode/inode_view.rs
clone
called by 320
curvine-web/src/router/load_handler.rs
as_ref
called by 191
orpc/src/sys/raw_ptr.rs
push
called by 186
curvine-server/src/master/journal/entry.rs
block_on
called by 80
orpc/src/runtime/async_runtime.rs
build
called by 77
curvine-common/src/state/job.rs
set_status
called by 75
curvine-s3-gateway/src/http/axum.rs

Shape

Method 3,653
Class 596
Function 442
Enum 115
Interface 47
Struct 5

Languages

Rust89%
Java5%
Python4%
Go2%
TypeScript1%

Modules by API surface

curvine-s3-gateway/src/s3/s3_api.rs86 symbols
curvine-libsdk/python/curvinefs/curvineFileSystem.py73 symbols
curvine-s3-gateway/src/test/s3_test.py61 symbols
curvine-server/src/master/meta/fs_dir.rs52 symbols
curvine-fuse/src/fs/curvine_file_system.rs50 symbols
orpc/src/message/rpc_message.rs43 symbols
curvine-common/src/utils/proto_utils.rs43 symbols
curvine-server/src/master/meta/inode/inode_view.rs42 symbols
curvine-client/src/file/curvine_filesystem.rs41 symbols
curvine-fuse/src/fs/operator.rs40 symbols
curvine-fuse/src/raw/fuse_abi.rs37 symbols
curvine-common/src/state/opts.rs37 symbols

For agents

$ claude mcp add curvine \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact