* feat(mimalloc): add arena diagnostics and configuration Based on mimalloc maintainer feedback (microsoft/mimalloc#1372), add diagnostics to check mimalloc arena configuration at runtime. Changes: - Add rustfs-mimalloc-sys to workspace dependencies - Add log_mimalloc_diagnostics() function to check: - arena_max_object_size - pagemap_commit status - mimalloc version - Add memory_observability module with mimalloc diagnostics This helps diagnose why allocations might be going outside arenas, which is the suspected root cause of futex contention. Ref: rustfs/backlog#2005 Ref: microsoft/mimalloc#1372 Co-Authored-By: heihutu <heihutu@gmail.com> * perf(ecstore): add Vec<u8> buffer pool for EC operations Add a general-purpose buffer pool to reduce Vec<u8> allocations in hot paths like EC encoding/decoding. Changes: - Add BufferPool struct in crates/ecstore/src/erasure/codec/buffer_pool.rs - Thread-safe pool with capacity-based bucketing (power-of-two) - Global EC_BUFFER_POOL instance with 16 buffers per bucket - Add buffer_pool module to codec/mod.rs Expected impact: - Reduce heap allocations in EC encode/decode paths - Avoid memzero overhead (proven 4.8% CPU saving in ShardBufferPool) - Reduce mimalloc lock contention Note: Main bottleneck remains mimalloc internal synchronization (futex 98.64% time). Buffer pool provides modest improvement (+2-5%). Ref: rustfs/backlog#2005 Co-Authored-By: heihutu <heihutu@gmail.com> * style: apply cargo fmt to buffer pool and related files Co-Authored-By: heihutu <heihutu@gmail.com> * fix(ecstore): add #[allow(dead_code)] to buffer pool The BufferPool infrastructure is ready but not yet integrated into the EC hot paths. Add #[allow(dead_code)] with clear documentation about integration status. Co-Authored-By: heihutu <heihutu@gmail.com> * perf(ecstore): integrate BufferPool into bitrot verify path Replace vec![0; shard_size] with get_ec_buffer() in the bitrot verification hot path to reduce heap allocations and avoid memzero. Co-Authored-By: heihutu <heihutu@gmail.com> * style: apply cargo fmt to buffer pool and bitrot changes Co-Authored-By: heihutu <heihutu@gmail.com> * refactor(ecstore): clean up buffer pool code - Remove unnecessary #[allow(dead_code)] attributes - Update module documentation to reflect current integration status - Simplify code structure Co-Authored-By: heihutu <heihutu@gmail.com> * perf(runtime): cap default worker threads at 16 Testing showed 16 worker threads outperforms 32+ for 1KiB PUT workloads due to reduced mimalloc lock contention. A/B test results (testing 4-node cluster, c=64): - worker_threads=32: 740 obj/s (baseline) - worker_threads=16: 785 obj/s (+6.1%) The default was detect_cores() which returned 32 on our testing nodes. Cap at 16 for optimal small-object performance. Ref: rustfs/backlog#2005 Co-Authored-By: heihutu <heihutu@gmail.com> * style: apply cargo fmt to buffer pool and runtime changes Co-Authored-By: heihutu <heihutu@gmail.com> * fix(ecstore): remove unused BufferPool::new() function The new() function was never used since EC_BUFFER_POOL initializes directly with with_limits(16). Co-Authored-By: heihutu <heihutu@gmail.com> * fix(ecstore): update buffer_pool tests to use with_limits Replace BufferPool::new() with BufferPool::with_limits(16) in tests since new() was removed in favor of with_limits(). Co-Authored-By: heihutu <heihutu@gmail.com> --------- Co-authored-by: hector <hetor@rustfs.com> Co-authored-by: heihutu <heihutu@gmail.com>
RustFS Docker Infrastructure
This directory contains the complete Docker infrastructure for building, deploying, and monitoring RustFS. It provides ready-to-use configurations for development, testing, and production-grade observability.
📂 Directory Structure
| Directory | Description | Status |
|---|---|---|
observability/ |
[RECOMMENDED] Full-stack observability (Prometheus, Grafana, Tempo, Loki). | ✅ Production-Ready |
compose/ |
Specialized setups (e.g., 4-node distributed cluster testing). | ⚠️ Testing Only |
mqtt/ |
EMQX Broker configuration for MQTT integration testing. | 🧪 Development |
openobserve-otel/ |
Alternative lightweight observability stack using OpenObserve. | 🔄 Alternative |
📄 Root Directory Files
The following files in the project root are essential for Docker operations:
Build Scripts & Dockerfiles
| File | Description | Usage |
|---|---|---|
docker-buildx.sh |
Multi-Arch Build Script Automates building and pushing Docker images for amd64 and arm64. Supports release and dev channels. |
./docker-buildx.sh --push |
Dockerfile |
Production Image (Alpine) Lightweight image using musl libc. Downloads pre-built binaries from GitHub Releases. |
docker build -t rustfs:latest . |
Dockerfile.glibc |
Production Image (Ubuntu) Standard image using glibc. Useful if you need specific dynamic libraries. |
docker build -f Dockerfile.glibc . |
Dockerfile.source |
Development Image Builds RustFS from source code. Includes build tools. Ideal for local development and CI. |
docker build -f Dockerfile.source . |
Docker Compose Configurations
| File | Description | Usage |
|---|---|---|
docker-compose.yml |
Main Development Setup Comprehensive setup with profiles for development, observability, and proxying. |
docker compose up -ddocker compose --profile observability up -d |
docker-compose-simple.yml |
Quick Start Setup Minimal configuration running a single RustFS instance with 4 volumes. Perfect for first-time users. |
docker compose -f docker-compose-simple.yml up -d |
🌟 Observability Stack (Recommended)
Located in: .docker/observability/
We provide a comprehensive, industry-standard observability stack designed for deep insights into RustFS performance. This is the recommended setup for both development and production monitoring.
Components
- Metrics: Prometheus (Collection) + Grafana (Visualization)
- Traces: Tempo (Storage) + Jaeger (UI)
- Logs: Loki
- Ingestion: OpenTelemetry Collector
Key Features
- Full Persistence: All metrics, logs, and traces are saved to Docker volumes, ensuring no data loss on restarts.
- Correlation: Seamlessly jump between Logs, Traces, and Metrics in Grafana.
- High Performance: Optimized configurations for batching, compression, and memory management.
Quick Start
cd .docker/observability
docker compose up -d
🧪 Specialized Environments
Located in: .docker/compose/
These configurations are tailored for specific testing scenarios that require complex topologies.
Distributed Cluster (4-Nodes)
Simulates a real-world distributed environment with 4 RustFS nodes running locally.
docker compose -f .docker/compose/docker-compose.cluster.yaml up -d
Integrated Observability Test
A self-contained environment running 4 RustFS nodes alongside the full observability stack. Useful for end-to-end testing of telemetry.
docker compose -f .docker/compose/docker-compose.observability.yaml up -d
📡 MQTT Integration
Located in: .docker/mqtt/
Provides an EMQX broker for testing RustFS MQTT features.
Quick Start
cd .docker/mqtt
docker compose up -d
- Dashboard: http://localhost:18083 (Default:
admin/public) - MQTT Port:
1883
👁️ Alternative: OpenObserve
Located in: .docker/openobserve-otel/
For users preferring a lightweight, all-in-one solution, we support OpenObserve. It combines logs, metrics, and traces into a single binary and UI.
Quick Start
cd .docker/openobserve-otel
docker compose up -d
🔧 Common Operations
Cleaning Up
To stop all containers and remove volumes (WARNING: deletes all persisted data):
docker compose down -v
Viewing Logs
To follow logs for a specific service:
docker compose logs -f [service_name]
Checking Status
To see the status of all running containers:
docker compose ps