A high-performance Kafka proxy that virtualizes partition counts, enabling cost reduction and seamless partition management
A lightweight, developer-friendly proxy for Apache Kafka that transparently remaps partitions between clients and brokers. Designed to make partition migrations, traffic rebalancing, and topology changes simple, safe, and zero-touch for your producers and consumers.
Running Kafka at scale often means dealing with partition constraints:
Kafka Partition Remapping Proxy solves this by sitting between your clients and your Kafka cluster, handling all partition remapping logic transparently. Producers and consumers connect to the proxy as if it were Kafka, while the proxy takes care of routing and remapping behind the scenes.
Client sees: 1000 virtual partitions ($$$$$)
Kafka has: 100 physical partitions ($)
Compression: 10:1 cost reduction
Keep your client config and application code untouched. Point them at the proxy and let it handle partition remapping and routing logic.
Define your partition remapping rules with a clean YAML configuration. No scripting or operational gymnastics required.
Move partitions, rebalance load, or change topic layouts with predictable behavior and minimal risk of client disruptions.
The proxy maintains Kafka semantics, so your existing tooling, metrics, and consumers continue to work as expected.
Written in async Rust with Tokio for minimal latency overhead (≤1-3ms p99) and high throughput.
Built to be easy to deploy, observe, and operate in modern Kubernetes and cloud environments. Prometheus metrics built-in.
Use 1000 virtual partitions while paying for only 100 physical partitions. Achieve 10:1 cost reduction on partition-based pricing.
Move partitions between brokers or clusters without coordinating rolling client restarts or application releases.
Smooth out hot spots by transparently remapping partitions, while clients continue to write/read using the same partition IDs.
Evolve your Kafka topology over time with a proxy layer that decouples client expectations from physical partition layouts.
Give each tenant their own virtual partition space while efficiently sharing physical resources.
| Feature | Partition Remapper | Conduktor Gateway | Kroxylicious | kafka-proxy |
|---|---|---|---|---|
| Partition virtualization | ✅ | ✅ (Concentrated Topics) | ❌ | ❌ |
| Offset translation | ✅ | ✅ (with limitations) | ❌ | ❌ |
| Cost reduction (V:P mapping) | ✅ | ✅ | ❌ | ❌ |
| Zero code changes | ✅ | ✅ | ✅ | ✅ |
| TLS termination | ✅ | ✅ | ✅ | ✅ |
| SASL authentication | ✅ | ✅ | ✅ | ✅ |
| Schema validation | ❌ | ✅ | ✅ | ❌ |
| Field-level encryption | ❌ | ✅ | ✅ | ❌ |
| Open source | ✅ | ❌ (Enterprise) | ✅ | ✅ |
| Written in | Rust | Java | Java | Go |
Why choose Partition Remapper? Open source, lightweight, and purpose-built for partition cost optimization with minimal overhead. No enterprise license required.
┌─────────────┐ ┌─────────────────────┐ ┌─────────────┐
│ Client │────▶│ Partition Proxy │────▶│ Kafka │
│ (v.part 42) │ │ 42 → phys.part 2 │ │ (10 parts) │
└─────────────┘ └─────────────────────┘ └─────────────┘
Partition Mapping:
physical_partition = virtual_partition % physical_partitions
Offset Translation:
physical_offset = (virtual_group * offset_range) + virtual_offset
Each virtual partition group gets its own offset space (default: 2^40 offsets), ensuring complete isolation.
listen:
address: "0.0.0.0:9092"
kafka:
bootstrap_servers:
- "your-kafka:9092"
mapping:
virtual_partitions: 100
physical_partitions: 10
metrics:
enabled: true
address: "0.0.0.0:9090"
# Using Docker
docker run --rm \
-v /path/to/config.yaml:/config/config.yaml \
osodevops/kafka-partition-remapper --config /config/config.yaml
# Or from source
cargo build --release
./target/release/kafka-partition-proxy --config config.yaml
Point your Kafka clients to the proxy instead of Kafka:
# Before (direct to Kafka)
kafka-console-producer --bootstrap-server kafka:9092 --topic my-topic
# After (through proxy)
kafka-console-producer --bootstrap-server proxy:9092 --topic my-topic
cd docker
docker compose up -d
See the Quickstart Guide for detailed instructions.
Get hands-on with example configurations in the config/ directory:
| Configuration | Description |
|---|---|
example.yaml | Basic configuration for getting started |
development-local.yaml | Local development setup |
sasl-ssl-confluent-cloud.yaml | Confluent Cloud with SASL/SSL |
sasl-scram-internal.yaml | Internal Kafka with SCRAM authentication |
mtls-enterprise.yaml | Enterprise mTLS configuration |
multi-tenant.yaml | Multi-tenant isolation setup |
high-throughput.yaml | Optimized for high throughput |
# Run with an example config
docker run -v $(pwd)/config:/config osodevops/kafka-partition-remapper \
--config /config/example.yaml
brew install osodevops/tap/kafka-partition-proxy
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/osodevops/kafka-partition-remapper/releases/latest/download/kafka-remapper-cli-installer.sh | sh
powershell -ExecutionPolicy ByPass -c "irm https://github.com/osodevops/kafka-partition-remapper/releases/latest/download/kafka-remapper-cli-installer.ps1 | iex"
scoop bucket add oso https://github.com/osodevops/scoop-bucket.git
scoop install kafka-partition-proxy
docker pull osodevops/kafka-partition-remapper
docker run --rm osodevops/kafka-partition-remapper --help
cargo install --git https://github.com/osodevops/kafka-partition-remapper kafka-remapper-cli
| Section | Option | Description | Default |
|---|---|---|---|
listen | address | Proxy listen address | 0.0.0.0:9092 |
listen | max_connections | Max client connections | 1000 |
kafka | bootstrap_servers | Kafka broker addresses | Required |
kafka | connection_timeout_ms | Connection timeout | 10000 |
kafka | request_timeout_ms | Request timeout | 30000 |
mapping | virtual_partitions | Virtual partition count | Required |
mapping | physical_partitions | Physical partition count | Required |
mapping | offset_range | Offset space per virtual group | 2^40 |
metrics | enabled | Enable Prometheus metrics | true |
metrics | address | Metrics server address | 0.0.0.0:9090 |
logging | level | Log level | info |
logging | json | JSON log format | false |
| Metric | Type | Description |
|---|---|---|
kafka_proxy_requests_total | Counter | Requests by API key |
kafka_proxy_request_duration_seconds | Histogram | Request latency |
kafka_proxy_active_client_connections | Gauge | Client connections |
kafka_proxy_partitions_remapped_total | Counter | Remapped partitions |
kafka_proxy_bytes_received_total | Counter | Bytes from clients |
kafka_proxy_bytes_sent_total | Counter | Bytes to clients |
| API | Support | Notes |
|---|---|---|
| ApiVersions | Full | Returns supported versions |
| Metadata | Full | Virtualizes partition count |
| Produce | Full | Remaps partitions and offsets |
| Fetch | Full | Remaps partitions and filters by offset range |
| OffsetCommit | Full | Translates virtual offsets to physical |
| OffsetFetch | Full | Translates physical offsets back to virtual |
| Others | Passthrough | Forwarded without modification |
| Metric | Target |
|---|---|
| Additional latency | ≤1-3ms p99 |
| Throughput | ≥80-90% of direct Kafka |
| Memory usage | <500MB typical |
Benchmarks available via cargo bench.
| Document | Description |
|---|---|
| Quick Start | Get running in 5 minutes |
| Configuration Reference | Complete configuration options |
| Architecture | System design and internals |
| Authentication | TLS, SASL, mTLS setup guide |
| Protocol Mapping | Kafka protocol implementation details |
| Getting Started | Detailed setup and deployment |
physical_partitions partitionskafka-partition-remapper/
├── crates/
│ ├── kafka-remapper-core/ # Core library
│ │ ├── src/
│ │ │ ├── config.rs # Configuration
│ │ │ ├── error.rs # Error types
│ │ │ ├── remapper/ # Partition mapping logic
│ │ │ ├── network/ # TCP listener, codec
│ │ │ ├── broker/ # Broker connections
│ │ │ ├── handlers/ # Protocol handlers
│ │ │ ├── metrics/ # Prometheus metrics
│ │ │ └── testing/ # Test harness & mock broker
│ │ ├── tests/ # Integration tests
│ │ └── benches/ # Performance benchmarks
│ └── kafka-remapper-cli/ # CLI binary
├── config/ # Example configs
├── docker/ # Docker setup
└── docs/ # Documentation
# Build
cargo build --release
# Test (131 tests)
cargo test --features testing
# Run benchmarks
cargo bench
# Run with debug logging
RUST_LOG=debug cargo run -p kafka-remapper-cli -- --config config.yaml
Contributions are welcome! Please read our contributing guidelines before submitting a PR.
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)Kafka Partition Remapping Proxy is licensed under the Apache License 2.0.
Kafka Partition Remapping Proxy is an easy-to-deploy Kafka proxy that simplifies partition management, reduces costs on managed Kafka services, and enables seamless topology changes without requiring changes to your client applications. By centralizing partition remapping logic in a lightweight Rust proxy, it helps Kafka platform teams deliver safer, faster infrastructure changes while keeping the developer experience simple.
Made with Rust by OSO
Content type
Image
Digest
sha256:b2533f7dc…
Size
34.6 MB
Last updated
8 months ago
docker pull osodevops/kafka-partition-remapper