English | 中文
StarAvail is a high-performance proxy service designed to provide partial availability for StarRocks single-replica deployments and optimize data ingestion pipelines. It serves as an intelligent middleware layer that enables graceful degradation during BE node failures and provides efficient Avro data processing capabilities.
- All-or-Nothing Limitation: In StarRocks single-replica deployments, any BE node failure causes complete table unavailability, even when only a fraction of tablets are affected
- Data Ingestion Bottlenecks: Current Pulsar → StarRocks pipeline suffers from OCF format incompatibility, blocking decoding, and StreamLoad inefficiencies
- Performance Degradation: Frequent small file generation leads to compaction pressure and chain-level backpressure
- Partial Availability: Continue serving queries and writes for healthy tablets during BE failures
- Enhanced Data Pipeline: Seamless Avro OCF/Binary processing with Schema Registry integration
- Performance Optimization: Built-in tuning framework with advanced caching and batching strategies
- Zero Internal Changes: Works as a transparent proxy without modifying StarRocks core
// Query degradation example
result, err := client.Query(ctx, &QueryRequest{
SQL: "SELECT * FROM user_events WHERE date >= '2024-01-01'",
Policy: PartialAvailabilityPolicy{
Mode: SKIP_FAILED_TABLETS,
WarningMessage: "Some data may be incomplete due to maintenance",
},
})// Streamlined data processing
pipeline := &IngestionPipeline{
Source: pulsar.NewConsumer("persistent://tenant/ns/topic"),
Decoder: avro.NewOCFDecoder(schemaRegistry),
Transformer: starrocks.NewBinaryTransformer(),
Sink: starrocks.NewBatchSink(batchSize: 1000),
}// Built-in metrics and optimization
metrics := client.GetMetrics()
fmt.Printf("Throughput: %d EPS, Latency: %dms, Compaction Score: %d",
metrics.ThroughputEPS, metrics.AvgLatencyMs, metrics.CompactionScore)StarAvail employs a layered architecture designed for high availability and performance:
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Client Apps │────│ StarAvail │────│ StarRocks │
│ │ │ Proxy │ │ Cluster │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│
┌──────┴──────┐
│ Schema │
│ Registry │
└─────────────┘
For detailed architecture information, see Architecture Documentation.
- Go 1.20.2+
- StarRocks cluster (single or multi-replica)
- Optional: Pulsar cluster for data ingestion
# Clone the repository
git clone https://github.com/turtacn/staravail.git
cd staravail
# Build the project
go mod tidy
go build -o bin/staravail cmd/staravail/main.go
# Run with configuration
./bin/staravail --config config/config.yaml# config/config.yaml
starrocks:
fe_endpoints:
- "http://fe1:8030"
- "http://fe2:8030"
proxy:
listen_addr: ":8080"
partial_availability:
enabled: true
policy: "skip_failed_tablets"
ingestion:
pulsar:
service_url: "pulsar://localhost:6650"
schema_registry:
url: "http://localhost:8081"
batch_size: 1000
flush_interval: "5s"curl -X POST http://localhost:8080/sql \
-H "Content-Type: application/json" \
-d '{
"sql": "SELECT count(*) FROM events WHERE date >= '2024-01-01'",
"partial_availability": true
}'curl -X POST http://localhost:8080/ingest \
-H "Content-Type: application/octet-stream" \
-H "X-Schema-ID: events-v1" \
--data-binary @events.avro# Run unit tests
go test ./...
# Run integration tests
go test -tags=integration ./test/integration/...
# Run benchmarks
go test -bench=. ./internal/performance/...| Metric | Without StarAvail | With StarAvail | Improvement |
|---|---|---|---|
| Query Availability during BE failure | 0% | 85%+ | ∞ |
| Data Ingestion Throughput | 3,000 EPS | 12,000+ EPS | 4x |
| Average Query Latency | 150ms | 120ms | 20% |
| Compaction Pressure | High | Low | 70% reduction |
We welcome contributions! Please see our Contributing Guide for details.
# Install development dependencies
make setup-dev
# Run tests with coverage
make test-coverage
# Run linting
make lint
# Generate documentation
make docsThis project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- StarRocks - The world's fastest open query engine
- Apache Pulsar - Cloud-native distributed messaging
- Confluent Schema Registry - Schema management for Avro
Note: This project is designed to work seamlessly with StarRocks without requiring any core modifications. For production deployments, please refer to our Production Guide.