* weed: report the host transparent huge page policy at startup Go maps the heap with MADV_HUGEPAGE, so the host THP policy applies to a SeaweedFS process whether or not the operator asked for it, and the advice in the Go GC guide depends on the heap size. Operators had no way to see which mode a node actually runs in. Log enabled/defrag/khugepaged.max_ptes_none once at startup from the long-running commands, and print the Go toolchain in `weed version` so a support bundle identifies the runtime that produced the binary. Nothing changes the policy: THP is host-wide, and GODEBUG=disablethp=1 remains the only per-process control. Refs #5437 * build: declare Go 1.27.4, the toolchain the releases already use The 4.55 release binaries report go1.27.4 (`go version -m` on the published tarball), while go.mod still said 1.26.6, the Dockerfiles pinned golang:1.26, and the release workflows left the Go version to the action default of "the latest stable at build time". A source build, a container and a downloaded tarball therefore ran different toolchains from the same tag, and the next release could silently pick up another one. Set the go directive to 1.27.4 in the root module and in the four modules that build in CI, bump the 16 Dockerfiles, and pin goversion: 1.27.4 in the 16 release and dev action steps. `go mod tidy` now emits the two require blocks Go 1.27 expects; no dependency version changed. Go 1.27's gofmt realigns 8 files. * weed mini: report the THP policy after quieting stderr The startup line ran from the dispatch point before runMini applied quietMiniLogs, so every weed mini start on Linux printed it to stderr, which mini keeps for the welcome banner, warnings and errors. Log it from runMini after quietMiniLogs so it lands in the log file only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: report whether the Go heap can use huge pages The runtime advises only GC metadata with MADV_HUGEPAGE and leaves the heap arenas to the host default, so under enabled=madvise the heap stays on small pages. The log still printed go_heap_disabled=false there, which reads as "the heap uses THP". Report go_heap_thp, true only under enabled=always without GODEBUG=disablethp, and drop the struct comment that said the heap is mapped with MADV_HUGEPAGE. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: count an inherited PR_SET_THP_DISABLE in go_heap_thp A launcher can disable THP for the process with prctl, and children inherit it, so enabled=always alone does not mean the heap gets huge pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: read GODEBUG disablethp the way the runtime does The runtime applies GODEBUG left to right, so with disablethp=1,disablethp=0 the heap keeps THP, while the helper stopped at the first disablethp=1. The helper also missed other nonzero values such as disablethp=2, which the runtime treats as disabled, and trimmed spaces around keys, which the runtime keeps. Take the last disablethp with an integer value, treat any nonzero value as disabled, and match keys exactly. The parser now takes the GODEBUG string, so it is tested without changing the environment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: honor per-size THP policies in go_heap_thp Since Linux 6.8 each anonymous huge page size has its own policy in hugepages-<size>kB/enabled, and only "inherit" follows the top-level knob. A 64kB size set to "always" gives the unadvised heap huge pages under a top-level "madvise" or "never", and a 2048kB size set to "never" takes them away under "always", but the log judged only the top-level value. Read the per-size policies and report go_heap_thp=true when any size reaches the heap. Under a top-level "never", the "disabled by the host" line is now printed only when no size reaches the heap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: report go_heap_thp=unknown when the process setting is unreadable If PR_GET_THP_DISABLE fails, for example because a seccomp profile rejects it, the process THP setting is not known, but the log treated it as allowed and could print go_heap_thp=true. Print go_heap_thp=unknown in that case. It stays false when the host or GODEBUG already rules out heap huge pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * util: report go_heap_thp=unknown when a per-size THP policy is unreadable An unreadable hugepages-<size>kB/enabled was skipped, so the log could say the host disabled THP while that size allowed it. Keep it as an empty mode and report unknown unless a readable size already allows huge pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ci: take the Go version from go.mod in tests and releases posix-compliance pinned GO_VERSION 1.26 and built go 1.27.4 modules only through the GOTOOLCHAIN auto-switch; nine workflows used go-version ^1.26 and the kafka jobs ran in golang:1.26-alpine. Read the version from go.mod with go-version-file, as the other setup-go steps already do, moving checkout ahead of setup-go where it came after so the file exists. The posix report takes the version from the setup-go output. The release and dev builds pinned goversion 1.27.4 in 16 places. The pinned go-release-action reads the go directive when goversion is go.mod, so the binaries now follow go.mod without a second copy of the version. * weed: report the THP policy from every long-running command mount, worker, iam, master.follower, the filer sync/backup/remote/replicate daemons and the mq agent and kafka gateway keep serving after startup like the commands already listed; mount is likely where heap size matters most. fuse is not listed: its first process starts a child with the same arguments and waits, so logging at dispatch would print the line twice. It logs in runFuse just before handing over to runMount, which only the child reaches. --------- Co-authored-by: Konstantin Lebedev <whitefox@mayflower.work> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Kafka Client Load Test for SeaweedFS
This comprehensive load testing suite validates the SeaweedFS MQ stack using real Kafka client libraries. Unlike the existing SMQ tests, this uses actual Kafka clients (sarama and confluent-kafka-go) to test the complete integration through:
- Kafka Clients → SeaweedFS Kafka Gateway → SeaweedFS MQ Broker → SeaweedFS Storage
Architecture
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐
│ Kafka Client │ │ Kafka Gateway │ │ SeaweedFS MQ │
│ Load Test │───▶│ (Port 9093) │───▶│ Broker │
│ - Producers │ │ │ │ │
│ - Consumers │ │ Protocol │ │ Topic Management │
│ │ │ Translation │ │ Message Storage │
└─────────────────┘ └──────────────────┘ └─────────────────────┘
│
▼
┌─────────────────────┐
│ SeaweedFS Storage │
│ - Master │
│ - Volume Server │
│ - Filer │
└─────────────────────┘
Features
🚀 Multiple Test Modes
- Producer-only: Pure message production testing
- Consumer-only: Consumption from existing topics
- Comprehensive: Full producer + consumer load testing
📊 Rich Metrics & Monitoring
- Prometheus metrics collection
- Grafana dashboards
- Real-time throughput and latency tracking
- Consumer lag monitoring
- Error rate analysis
🔧 Configurable Test Scenarios
- Quick Test: 1-minute smoke test
- Standard Test: 5-minute medium load
- Stress Test: 10-minute high load
- Endurance Test: 30-minute sustained load
- Custom: Fully configurable parameters
📈 Message Types
- JSON: Structured test messages
- Avro: Schema Registry integration
- Binary: Raw binary payloads
🛠 Kafka Client Support
- Sarama: Native Go Kafka client
- Confluent: Official Confluent Go client
- Schema Registry integration
- Consumer group management
Quick Start
Prerequisites
- Docker & Docker Compose
- Make (optional, but recommended)
1. Run Default Test
make test
This runs a 5-minute comprehensive test with 10 producers and 5 consumers.
2. Quick Smoke Test
make quick-test
1-minute test with minimal load for validation.
3. Stress Test
make stress-test
10-minute high-throughput test with 20 producers and 10 consumers.
4. Test with Monitoring
make test-with-monitoring
Includes Prometheus + Grafana dashboards for real-time monitoring.
Detailed Usage
Manual Control
# Start infrastructure only
make start
# Run load test against running infrastructure
make test TEST_MODE=comprehensive TEST_DURATION=10m
# Stop everything
make stop
# Clean up all resources
make clean
Using Scripts Directly
# Full control with the main script
./scripts/run-loadtest.sh start -m comprehensive -d 10m --monitoring
# Check service health
./scripts/wait-for-services.sh check
# Setup monitoring configurations
./scripts/setup-monitoring.sh
Environment Variables
export TEST_MODE=comprehensive # producer, consumer, comprehensive
export TEST_DURATION=300s # Test duration
export PRODUCER_COUNT=10 # Number of producer instances
export CONSUMER_COUNT=5 # Number of consumer instances
export MESSAGE_RATE=1000 # Messages/second per producer
export MESSAGE_SIZE=1024 # Message size in bytes
export TOPIC_COUNT=5 # Number of topics to create
export PARTITIONS_PER_TOPIC=3 # Partitions per topic
make test
Configuration
Main Configuration File
Edit config/loadtest.yaml to customize:
- Kafka Settings: Bootstrap servers, security, timeouts
- Producer Config: Batching, compression, acknowledgments
- Consumer Config: Group settings, fetch parameters
- Message Settings: Size, format (JSON/Avro/Binary)
- Schema Registry: Avro/Protobuf schema validation
- Metrics: Prometheus collection intervals
- Test Scenarios: Predefined load patterns
Example Custom Configuration
test_mode: "comprehensive"
duration: "600s" # 10 minutes
producers:
count: 15
message_rate: 2000
message_size: 2048
compression_type: "snappy"
acks: "all"
consumers:
count: 8
group_prefix: "high-load-group"
max_poll_records: 1000
topics:
count: 10
partitions: 6
replication_factor: 1
Test Scenarios
1. Producer Performance Test
make producer-test TEST_DURATION=10m PRODUCER_COUNT=20 MESSAGE_RATE=3000
Tests maximum message production throughput.
2. Consumer Performance Test
# First produce messages
make producer-test TEST_DURATION=5m
# Then test consumption
make consumer-test TEST_DURATION=10m CONSUMER_COUNT=15
3. Schema Registry Integration
# Enable schemas in config/loadtest.yaml
schemas:
enabled: true
make test
Tests Avro message serialization through Schema Registry.
4. High Availability Test
# Test with container restarts during load
make test TEST_DURATION=20m &
sleep 300
docker restart kafka-gateway
Monitoring & Metrics
Real-Time Dashboards
When monitoring is enabled:
- Prometheus: http://localhost:9090
- Grafana: http://localhost:3000 (admin/admin)
Key Metrics Tracked
- Throughput: Messages/second, MB/second
- Latency: End-to-end message latency percentiles
- Errors: Producer/consumer error rates
- Consumer Lag: Per-partition lag monitoring
- Resource Usage: CPU, memory, disk I/O
Grafana Dashboards
- Kafka Load Test: Comprehensive test metrics
- SeaweedFS Cluster: Storage system health
- Custom Dashboards: Extensible monitoring
Advanced Features
Schema Registry Testing
# Test Avro message serialization
export KAFKA_VALUE_TYPE=avro
make test
The load test includes:
- Schema registration
- Avro message encoding/decoding
- Schema evolution testing
- Compatibility validation
Multi-Client Testing
The test supports both Sarama and Confluent clients:
// Configure in producer/consumer code
useConfluent := true // Switch client implementation
Consumer Group Rebalancing
- Automatic consumer group management
- Partition rebalancing simulation
- Consumer failure recovery testing
Chaos Testing
chaos:
enabled: true
producer_failure_rate: 0.01
consumer_failure_rate: 0.01
network_partition_probability: 0.001
Troubleshooting
Common Issues
Services Not Starting
# Check service health
make health-check
# View detailed logs
make logs
# Debug mode
make debug
Low Throughput
- Increase
MESSAGE_RATEandPRODUCER_COUNT - Adjust
batch_sizeandlinger_msin config - Check consumer
max_poll_recordssetting
High Latency
- Reduce
linger_msfor lower latency - Adjust
ackssetting (0, 1, or "all") - Monitor consumer lag
Memory Issues
# Reduce concurrent clients
make test PRODUCER_COUNT=5 CONSUMER_COUNT=3
# Adjust message size
make test MESSAGE_SIZE=512
Debug Commands
# Execute shell in containers
make exec-master
make exec-filer
make exec-gateway
# Attach to load test
make attach-loadtest
# View real-time stats
curl http://localhost:8080/stats
Development
Building from Source
# Set up development environment
make dev-env
# Build load test binary
make build
# Run tests locally (requires Go 1.26+)
cd cmd/loadtest && go run main.go -config ../../config/loadtest.yaml
Extending the Tests
- Add new message formats in
internal/producer/ - Add custom metrics in
internal/metrics/ - Create new test scenarios in
config/loadtest.yaml - Add monitoring panels in
monitoring/grafana/dashboards/
Contributing
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass:
make test - Submit a pull request
Performance Benchmarks
Expected Performance (on typical hardware)
| Scenario | Producers | Consumers | Rate (msg/s) | Latency (p95) |
|---|---|---|---|---|
| Quick | 2 | 2 | 200 | <10ms |
| Standard | 5 | 3 | 2,500 | <20ms |
| Stress | 20 | 10 | 40,000 | <50ms |
| Endurance | 10 | 5 | 10,000 | <30ms |
Results vary based on hardware, network, and SeaweedFS configuration
Tuning for Maximum Performance
producers:
batch_size: 1000
linger_ms: 10
compression_type: "lz4"
acks: "1" # Balance between speed and durability
consumers:
max_poll_records: 5000
fetch_min_bytes: 1048576 # 1MB
fetch_max_wait_ms: 100
Comparison with Existing Tests
| Feature | SMQ Tests | Kafka Client Load Test |
|---|---|---|
| Protocol | SMQ (SeaweedFS native) | Kafka (industry standard) |
| Clients | SMQ clients | Real Kafka clients (Sarama, Confluent) |
| Schema Registry | ❌ | ✅ Full Avro/Protobuf support |
| Consumer Groups | Basic | ✅ Full Kafka consumer group features |
| Monitoring | Basic | ✅ Prometheus + Grafana dashboards |
| Test Scenarios | Limited | ✅ Multiple predefined scenarios |
| Real-world | Synthetic | ✅ Production-like workloads |
This load test provides comprehensive validation of the SeaweedFS Kafka Gateway using real-world Kafka clients and protocols.
Quick Reference
# Essential Commands
make help # Show all available commands
make test # Run default comprehensive test
make quick-test # 1-minute smoke test
make stress-test # High-load stress test
make test-with-monitoring # Include Grafana dashboards
make clean # Clean up all resources
# Monitoring
make monitor # Start Prometheus + Grafana
# → http://localhost:9090 (Prometheus)
# → http://localhost:3000 (Grafana, admin/admin)
# Advanced
make benchmark # Run full benchmark suite
make health-check # Validate service health
make validate-setup # Check configuration