Worker/Replica Index
sergei-gaponik
PROOP

2 days ago

Would love a stable per-replica index env var (e.g. RAILWAY_REPLICA_INDEX = 0, 1, 2, ..., N-1) when scaling a service horizontally.

Why: With shared-database workers, a deterministic index lets each replica claim every Nth row without coordination. Random replica ID hashes don't work for this.

Current workaround: Manually duplicating the service and hardcoding a WORKER_INDEX env var per copy, which isn't really horizontal scaling anymore.

Kubernetes StatefulSets solve this with ordinal pod names. Something similar on Railway would unlock a lot of worker patterns: sharded queue consumers, partitioned cron jobs, consistent hashing, etc.

Under Review

0 Threads mention this feature

0 Replies

Welcome!

Sign in to your Railway account to join the conversation.

Loading...