Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9e20ef5
feat: add authentication module structure
ElioNeto Mar 6, 2026
f439c8a
feat: add authentication dependencies
ElioNeto Mar 6, 2026
0ce037d
feat: add authentication configuration
ElioNeto Mar 6, 2026
161a025
feat: integrate authentication into API with admin endpoints
ElioNeto Mar 6, 2026
dd73644
docs: add authentication configuration and usage guide
ElioNeto Mar 6, 2026
5a2bb4d
feat: add actix-web-httpauth dependency
ElioNeto Mar 6, 2026
3c06ae5
fix: resolve compilation errors (gen keyword, base64, borrow checker)
ElioNeto Mar 6, 2026
f5bdb5d
fix: collapse nested if statement per clippy suggestion
ElioNeto Mar 6, 2026
03bf6bf
Merge pull request #56 from ElioNeto/feature/bearer-auth
ElioNeto Mar 6, 2026
09c81db
feat: enhance workflows with automatic issue closing and comment stac…
ElioNeto Mar 6, 2026
882e59b
docs: add comprehensive workflow documentation
ElioNeto Mar 6, 2026
9243bb4
fix: make workflows work gracefully without issue references
ElioNeto Mar 6, 2026
e0533c6
docs: update workflows documentation - issues are optional
ElioNeto Mar 6, 2026
b9cf507
Merge pull request #58 from ElioNeto/feature/bearer-auth
ElioNeto Mar 6, 2026
3324a81
fix: correctly calculate next version considering existing tags
ElioNeto Mar 6, 2026
3fe4c24
fix: adjust bloom filter test threshold to be more realistic
ElioNeto Mar 6, 2026
e5ac00b
Merge pull request #59 from ElioNeto/feature/bearer-auth
ElioNeto Mar 6, 2026
3ee6ea4
feat: enable concurrent reads in SstableReader (#36)
ElioNeto Mar 6, 2026
713abee
fix: use GlobalBlockCache directly without extra Mutex wrapper
ElioNeto Mar 6, 2026
cc0f415
fix: remove non-existent sstable_bench reference
ElioNeto Mar 6, 2026
21c6174
fix: correct serde dependency and add missing crates
ElioNeto Mar 6, 2026
1048ba6
fix: replace let chains with nested if for Rust 2021 compatibility
ElioNeto Mar 6, 2026
ed923fb
fix: add 'api' feature and tracing_subscriber dependency
ElioNeto Mar 6, 2026
ceb620e
fix: add missing rand dependency
ElioNeto Mar 6, 2026
17ef8f5
Merge pull request #61 from ElioNeto/feature/concurrent-reads
ElioNeto Mar 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
285 changes: 33 additions & 252 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,262 +1,43 @@
# ============================================================
# ApexStore Comprehensive Configuration
# ============================================================
# ApexStore Configuration
# High-Performance LSM-Tree Key-Value Store
# Copy this file to .env and customize as needed.
# All settings can be changed without recompilation!

# ============================================================
# SERVER CONFIGURATION
# ============================================================

# Network Settings
# ===================================
# Server Configuration
# ===================================
HOST=0.0.0.0
PORT=8080

# Payload Limits (in bytes)
# Adjust these for stress testing or large datasets
# Default: 50MB (52428800 bytes)
# For stress testing: 100MB (104857600 bytes)
# For production: 10MB (10485760 bytes)
MAX_JSON_PAYLOAD_SIZE=52428800
MAX_RAW_PAYLOAD_SIZE=52428800

# HTTP Server Tuning
# Number of worker threads (0 = number of CPU cores)
SERVER_WORKERS=0

# Keep-alive timeout in seconds (0 = disabled)
SERVER_KEEP_ALIVE=75

# Client request timeout in seconds
SERVER_CLIENT_TIMEOUT=60

# Shutdown timeout in seconds
SERVER_SHUTDOWN_TIMEOUT=30

# Maximum number of pending connections
SERVER_BACKLOG=2048

# Maximum concurrent connections per worker
SERVER_MAX_CONNECTIONS=25000

# ============================================================
# LSM ENGINE CONFIGURATION
# ============================================================

# Storage Directory
DATA_DIR=./.apexstore_data

# MemTable Configuration
# Size threshold before flushing to disk (in bytes)
# Default: 4MB (4194304 bytes)
# High-throughput writes: 8MB (8388608 bytes)
# Memory-constrained: 2MB (2097152 bytes)
MEMTABLE_MAX_SIZE=4194304

# ============================================================
# SSTABLE CONFIGURATION
# ============================================================

# Block Size (in bytes)
# Affects read granularity and compression efficiency
# Default: 4096 (4KB)
# Larger blocks: 8192 (8KB) - better compression, higher latency
# Smaller blocks: 2048 (2KB) - lower latency, less compression
BLOCK_SIZE=4096

# Block Cache Size (in MB)
# In-memory cache for frequently accessed blocks
# Default: 64MB
# Read-heavy workloads: 256MB or higher
# Memory-constrained: 32MB
BLOCK_CACHE_SIZE_MB=64

# Sparse Index Interval
# Number of blocks between index entries
# Lower = more memory, faster lookups
# Higher = less memory, slower lookups
# Default: 16
# Dense index: 8
# Sparse index: 32
SPARSE_INDEX_INTERVAL=16

# ============================================================
# BLOOM FILTER CONFIGURATION
# ============================================================

# False Positive Rate (0.0 to 1.0)
# Lower = more memory usage, fewer false positives
# Higher = less memory usage, more false positives
# Default: 0.01 (1%)
# High accuracy: 0.001 (0.1%)
# Memory-constrained: 0.05 (5%)
BLOOM_FALSE_POSITIVE_RATE=0.01

# ============================================================
# WRITE-AHEAD LOG (WAL) CONFIGURATION
# ============================================================

# Maximum WAL record size (in bytes)
# Safety limit to prevent corrupted enormous records
# Default: 32MB (33554432 bytes)
MAX_WAL_RECORD_SIZE=33554432

# WAL buffer size (in bytes)
# Buffer for batching writes before flushing
# Default: 64KB (65536 bytes)
# High-throughput: 256KB (262144 bytes)
WAL_BUFFER_SIZE=65536

# WAL sync mode
# Options: always, every_second, manual
# always = fsync after every write (safest, slowest)
# every_second = fsync every second (balanced)
# manual = no automatic fsync (fastest, least safe)
WAL_SYNC_MODE=always

# ============================================================
# COMPACTION CONFIGURATION
# ============================================================
# Payload size limits (in bytes)
MAX_JSON_PAYLOAD_SIZE=52428800 # 50MB
MAX_RAW_PAYLOAD_SIZE=52428800 # 50MB

# Compaction Strategy
# Options: leveled, tiered, lazy_leveling
# leveled = better read performance
# tiered = better write performance
# lazy_leveling = balanced (default)
COMPACTION_STRATEGY=lazy_leveling

# Size Ratio Between Levels
# How much larger each level is compared to the previous
# Default: 10
# More levels: 4-6
# Fewer levels: 15-20
SIZE_RATIO=10

# Level 0 SSTable Count Threshold
# Trigger compaction when this many L0 files exist
# Default: 4
# Aggressive: 2
# Lazy: 8
LEVEL0_COMPACTION_THRESHOLD=4

# Max Level Count
# Maximum number of levels in the LSM tree
# Default: 7
# Shallow tree: 5
# Deep tree: 10
MAX_LEVEL_COUNT=7

# Compaction Thread Count
# Number of background threads for compaction
# Default: 2
# High-throughput: 4-8
COMPACTION_THREADS=2

# ============================================================
# FEATURE FLAGS CONFIGURATION
# ============================================================

# Feature flags cache TTL (in seconds)
# How long to cache feature flag values
# Default: 10 seconds
# Frequently changing: 1-5 seconds
# Stable: 60-300 seconds
# Feature flag cache TTL (in seconds)
FEATURE_CACHE_TTL=10

# ============================================================
# PERFORMANCE TUNING PROFILES
# ============================================================
# Uncomment one of the profiles below for quick configuration

# --- STRESS TESTING PROFILE ---
# MAX_JSON_PAYLOAD_SIZE=104857600
# MAX_RAW_PAYLOAD_SIZE=104857600
# MEMTABLE_MAX_SIZE=16777216
# BLOCK_SIZE=8192
# BLOCK_CACHE_SIZE_MB=256
# WAL_SYNC_MODE=every_second

# --- HIGH WRITE THROUGHPUT PROFILE ---
# MEMTABLE_MAX_SIZE=8388608
# BLOCK_SIZE=8192
# BLOOM_FALSE_POSITIVE_RATE=0.05
# WAL_SYNC_MODE=every_second
# WAL_BUFFER_SIZE=262144
# COMPACTION_THREADS=4
# LEVEL0_COMPACTION_THRESHOLD=8

# --- HIGH READ THROUGHPUT PROFILE ---
# BLOCK_CACHE_SIZE_MB=512
# BLOOM_FALSE_POSITIVE_RATE=0.001
# SPARSE_INDEX_INTERVAL=8
# COMPACTION_STRATEGY=leveled

# --- MEMORY CONSTRAINED PROFILE ---
# MEMTABLE_MAX_SIZE=2097152
# BLOCK_CACHE_SIZE_MB=32
# BLOOM_FALSE_POSITIVE_RATE=0.05
# SPARSE_INDEX_INTERVAL=32
# SERVER_MAX_CONNECTIONS=5000

# --- BALANCED PRODUCTION PROFILE ---
# MEMTABLE_MAX_SIZE=4194304
# BLOCK_SIZE=4096
# BLOCK_CACHE_SIZE_MB=128
# BLOOM_FALSE_POSITIVE_RATE=0.01
# WAL_SYNC_MODE=always
# COMPACTION_THREADS=2
# SERVER_WORKERS=4

# ============================================================
# MONITORING & LOGGING
# ============================================================

# Rust log level
# Options: error, warn, info, debug, trace
RUST_LOG=info

# Enable performance metrics
# Set to 'true' to enable detailed metrics collection
ENABLE_METRICS=false

# Metrics export interval (in seconds)
METRICS_INTERVAL=60

# ============================================================
# ADVANCED TUNING
# ============================================================

# I/O Thread Pool Size
# Number of threads for async I/O operations
# Default: 4
IO_THREAD_POOL_SIZE=4

# Read Ahead Size (in bytes)
# Amount of data to prefetch during sequential reads
# Default: 131072 (128KB)
READ_AHEAD_SIZE=131072

# Write Buffer Pool Size
# Number of write buffers to keep in pool
# Default: 3
WRITE_BUFFER_POOL_SIZE=3

# Enable mmap for SSTables
# Use memory-mapped files for SSTable reads
# Default: false (use regular file I/O)
ENABLE_SSTABLE_MMAP=false
# ===================================
# Authentication Configuration
# ===================================
# Enable/disable Bearer Token authentication
# Set to 'true' to require authentication for API endpoints
# Default: false (backward compatible)
API_AUTH_ENABLED=false

# Token expiry in days (optional)
# If not set, tokens will never expire
API_TOKEN_EXPIRY_DAYS=30

# ===================================
# Storage Configuration
# ===================================
DIR_PATH=./data
MEMTABLE_MAX_SIZE=16777216 # 16MB

# Block and cache configuration
BLOCK_SIZE=4096 # 4KB
BLOCK_CACHE_SIZE_MB=64

# Enable direct I/O
# Bypass OS page cache (requires aligned buffers)
# Default: false
ENABLE_DIRECT_IO=false
# Bloom filter configuration
BLOOM_FALSE_POSITIVE_RATE=0.01 # 1%

# ============================================================
# NOTES
# ============================================================
# - All size values in bytes unless specified
# - Restart the server after changing configuration
# - Monitor memory usage when increasing cache sizes
# - Profile your workload before tuning
# - Start with defaults and adjust incrementally
# Index configuration
INDEX_INTERVAL=16
Loading