filer: improve FoundationDB performance by disabling batch by default (#7770)
* filer: improve FoundationDB performance by disabling batch by default This PR addresses a performance issue where FoundationDB filer was achieving only ~757 ops/sec with 12 concurrent S3 clients, despite FDB being capable of 17,000+ ops/sec. Root cause: The write batcher was waiting up to 5ms for each operation to batch, even though S3 semantics require waiting for durability confirmation. This added artificial latency that defeated the purpose of batching. Changes: - Disable write batching by default (batch_enabled = false) - Each write now commits immediately in its own transaction - Reduce batch interval from 5ms to 1ms when batching is enabled - Add batch_enabled config option to toggle behavior - Improve batcher to collect available ops without blocking - Add benchmarks comparing batch vs no-batch performance Benchmark results (16 concurrent goroutines): - With batch: 2,924 ops/sec (342,032 ns/op) - Without batch: 4,625 ops/sec (216,219 ns/op) - Improvement: +58% faster Configuration: - Default: batch_enabled = false (optimal for S3 PUT latency) - For bulk ingestion: set batch_enabled = true Also fixes ARM64 Docker test setup (shell compatibility, fdbserver path). * fix: address review comments - use atomic counter and remove duplicate batcher - Use sync/atomic.Uint64 for unique filenames in concurrent benchmarks - Remove duplicate batcher creation in createBenchmarkStoreWithBatching (initialize() already creates batcher when batchEnabled=true) * fix: add realistic default values to benchmark store helper Set directoryPrefix, timeout, and maxRetryDelay to reasonable defaults for more realistic benchmark conditions.
This commit is contained in:
@@ -27,6 +27,10 @@ export WEED_FOUNDATIONDB_API_VERSION=740
|
||||
export WEED_FOUNDATIONDB_TIMEOUT=5s
|
||||
export WEED_FOUNDATIONDB_MAX_RETRY_DELAY=1s
|
||||
export WEED_FOUNDATIONDB_DIRECTORY_PREFIX=seaweedfs
|
||||
# Write batching (disabled by default)
|
||||
export WEED_FOUNDATIONDB_BATCH_ENABLED=false
|
||||
export WEED_FOUNDATIONDB_BATCH_SIZE=100
|
||||
export WEED_FOUNDATIONDB_BATCH_INTERVAL=1ms
|
||||
```
|
||||
|
||||
### 3. Command Line Arguments
|
||||
@@ -56,6 +60,18 @@ While not directly supported, configuration can be specified via config files pa
|
||||
|--------|------|---------|-------------|
|
||||
| `directory_prefix` | string | `seaweedfs` | Directory prefix for key organization |
|
||||
|
||||
### Write Batching Options
|
||||
|
||||
| Option | Type | Default | Description |
|
||||
|--------|------|---------|-------------|
|
||||
| `batch_enabled` | boolean | `false` | Enable write batching. Disabled by default for optimal S3 PUT latency. |
|
||||
| `batch_size` | integer | `100` | Maximum number of operations per batch (when batching is enabled) |
|
||||
| `batch_interval` | duration | `1ms` | Maximum time to wait before flushing a batch (when batching is enabled) |
|
||||
|
||||
**Note:** Write batching is **disabled by default**. Each write commits immediately in its own
|
||||
transaction, providing optimal latency for S3 PUT operations. Enable batching only for
|
||||
high-throughput bulk ingestion workloads where you can tolerate slightly higher per-operation latency.
|
||||
|
||||
## Configuration Examples
|
||||
|
||||
### Development Environment
|
||||
@@ -82,7 +98,25 @@ max_retry_delay = "5s"
|
||||
directory_prefix = "seaweedfs_prod"
|
||||
```
|
||||
|
||||
### High-Performance Setup
|
||||
### High-Performance Setup (Low Latency)
|
||||
|
||||
For S3 workloads requiring low latency per operation:
|
||||
|
||||
```toml
|
||||
[foundationdb]
|
||||
enabled = true
|
||||
cluster_file = "/etc/foundationdb/fdb.cluster"
|
||||
api_version = 740
|
||||
timeout = "5s"
|
||||
max_retry_delay = "1s"
|
||||
directory_prefix = "sw" # Shorter prefix for efficiency
|
||||
# Batching disabled (default) for optimal per-operation latency
|
||||
batch_enabled = false
|
||||
```
|
||||
|
||||
### High-Throughput Bulk Ingestion
|
||||
|
||||
For bulk data loading where throughput matters more than per-operation latency:
|
||||
|
||||
```toml
|
||||
[foundationdb]
|
||||
@@ -91,7 +125,11 @@ cluster_file = "/etc/foundationdb/fdb.cluster"
|
||||
api_version = 740
|
||||
timeout = "60s"
|
||||
max_retry_delay = "10s"
|
||||
directory_prefix = "sw" # Shorter prefix for efficiency
|
||||
directory_prefix = "sw"
|
||||
# Enable batching for higher throughput
|
||||
batch_enabled = true
|
||||
batch_size = 100
|
||||
batch_interval = "1ms"
|
||||
```
|
||||
|
||||
### Path-Specific Configuration
|
||||
|
||||
Reference in New Issue
Block a user