Reader/writer split
One writer ingests into a shared bucket, and a pool of readers serves queries from it. Queries scale without touching ingest.
How it works
The writer owns the database's one shard, holds it with a Kubernetes Lease, and flushes to object storage every flushIntervalSeconds. Readers open the same shard read-only from the bucket and follow the writer's flushes, so queries trail ingest by about that interval. Readers keep no state beyond their cache, so they can be added, removed, or autoscaled at any time.
Deploy
It is a Sharded resource with one writer, and needs a bucket every pod can reach: grant S3 access first. Hover a field to see what it does:
1apiVersion: telemetry.plural.sh/v1alpha12kind: Traces3metadata:41 name: traces52 namespace: telemetry6spec:73 mode: Sharded84 config:95 retention: 14d10 storage:116 path: traces12 objectStore:137 type: Aws14 aws:158 region: us-east-1169 bucket: acme-telemetry17 write:1810 flushIntervalSeconds: 1019 writer:2011 replicas: 12112 resources:22 requests: { cpu: "1", memory: 2Gi }23 limits: { memory: 4Gi }2413 cacheVolume:25 persistentVolumeClaim:26 accessModes: [ReadWriteOnce]27 resources: { requests: { storage: 20Gi } }28 reader:2914 replicas: 23015 cacheVolume:31 emptyDir: { sizeLimit: 20Gi }3216 autoscaling:33 enabled: true34 maxReplicas: 635 targetCPUUtilizationPercentage: 70- 1nameAlso names the ServiceAccount the IAM role binds to, and the
traces-writerandtraces-readerServices (justtracesin Standalone mode). - 2namespaceThe Kubernetes namespace the pods run in. Tenant namespaces for your data are separate and come from NamespaceAuthentication resources.
- 3mode
Standalone(the default) runs one pod that reads and writes.Shardedruns a writer StatefulSet and one reader StatefulSet per storage shard, which scale independently. - 4configRendered into the server's config file. The operator rolls the pods when it changes.
- 5retentionHow long data is kept, counted from ingestion, as
14d,2wor36h. Default14d. - 6pathObject-key prefix inside the bucket; shard suffixes are appended. Must match the prefix in the IAM policy. Default
traces. - 7type
Aws,Gcp,Azure,LocalorInMemory. WithAwsand no key references, the pod uses its Pod Identity credentials. - 8regionBucket region. Add
endpoint(andallowHTTPif needed) for S3-compatible stores such as MinIO. - 9bucketCan be shared by all three databases, as long as their
pathprefixes differ. - 10flushIntervalSecondsHow often writers flush to object storage, and so how far readers can lag behind. Default
10. - 11replicasWriter count, which is also the storage shard count. Raise it at any time; new shards take writes from the next aligned hour. It cannot be lowered.
- 12resourcesDefaults to 250m CPU and 512Mi memory requests with a 2Gi limit. Budget for the write buffer: 64 MiB per shard, plus up to two frozen buffers being flushed.
- 13cacheVolumeMounted at
/var/cache/tracesas the disk tier of the block cache (512 MiB RAM and 10 GiB disk by default). A PVC keeps it warm across restarts. Set exactly one ofemptyDirorpersistentVolumeClaim. - 14replicasReplicas per reader group. Each storage shard gets its own group, which opens only that shard; any reader answers any query by asking the other groups over gRPC. Default
2in Sharded mode. Scale freely, or setautoscalingto scale each group on CPU. - 15cacheVolumeAn
emptyDiris enough: a restarted reader refills its cache from the bucket. - 16autoscalingAdds a HorizontalPodAutoscaler per reader group.
minReplicasdefaults toreplicas; scale ontargetCPUUtilizationPercentageortargetMemoryUtilizationPercentage.
Apply it with kubectl apply -f traces.yaml, then add credentials and connect your tools to the traces-writer and traces-reader Services.
kubectl -n telemetry get traces
# NAME MODE READY AGE
# traces Sharded True 2m
kubectl -n telemetry port-forward svc/traces-reader 3200 &
curl -u grafana:"$PASSWORD" http://localhost:3200/read/ns/payments/api/v2/search/tagsOperating it
- Queries: readers scale on CPU between
replicasandmaxReplicas. Raise reader memory and cache for heavier queries. - Writer restarts: while the writer is down, ingest fails and readers keep serving what was flushed. The restarted pod takes its shard back once the Lease expires (
spec.config.sharding.leaseDurationSeconds, 15 by default). - Outgrowing one writer: raise
spec.writer.replicasto become a sharded deployment.