---
title: "Sharding Infrastructure: The Regional Goval Project"
description: "Replit re-sharded the infrastructure that runs Repls (Goval) from a few unbalanced, multi-region clusters partitioned by user membership into uniformly sized, single-region clusters with Repls distributed by consistent hashing, shrinking failure domains and removing cross-region traffic."
url: "https://swe.quest/articles/sharding-infrastructure-the-regional-goval-project-86db1e97083bbccb"
canonical: "https://replit.com/blog/regional-goval"
source: "Replit"
published: "2024-02-14"
difficulty: "medium"
kind: "Case study"
reading_minutes: 7
tags: ["infrastructure-as-code","distributed-systems","cloud","resilience","deployment"]
---

# Sharding Infrastructure: The Regional Goval Project

A post on [Replit](https://swe.quest/sources/replit.md), published 2024-02-14, 7 min read, Case study. Original: [https://replit.com/blog/regional-goval](https://replit.com/blog/regional-goval)

## Summary

Replit re-sharded the infrastructure that runs Repls (Goval) from a few unbalanced, multi-region clusters partitioned by user membership into uniformly sized, single-region clusters with Repls distributed by consistent hashing, shrinking failure domains and removing cross-region traffic. The clusters are now defined with CDK for Terraform in TypeScript as reusable modules, replacing a monolithic Terraform state, codegen tooling and Ansible-managed config, so clusters (including single-tenant ones in separate GCP projects) can be provisioned on demand. Migration happened with no downtime: new Repls were created in new clusters, existing Repls were lazily transferred on connection behind feature flags with rollback capability, and old clusters were deprovisioned while untransferred Repls stayed in storage.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Infrastructure as code](https://swe.quest/tags/infrastructure-as-code.md) (Infrastructure)
- [Distributed systems](https://swe.quest/tags/distributed-systems.md) (Distributed systems)
- [Cloud platforms](https://swe.quest/tags/cloud.md) (Infrastructure)
- [Resilience](https://swe.quest/tags/resilience.md) (Distributed systems)
- [Deployment](https://swe.quest/tags/deployment.md) (Reliability & operations)

## Prerequisites

- Terraform basics ([easy posts on Infrastructure as code](https://swe.quest/tags/infrastructure-as-code.md?difficulty=easy))
- consistent hashing
- cloud regions and failure domains ([easy posts on Cloud platforms](https://swe.quest/tags/cloud.md?difficulty=easy))

## Keywords

Replit, Goval, CDK for Terraform, Terraform, TypeScript, Google Cloud Platform, Ansible

## Related posts

- [Welcome to the Wonderful World of Clusters](https://swe.quest/articles/welcome-to-the-wonderful-world-of-clusters-52a29e1c3fc463f3.md): Replit · 2021-03-26 · Medium · 5 min read · System design, DNS, Resilience, Distributed systems, Cloud platforms
  Replit split its infrastructure into multiple independent clusters (failure domains) after two load-related site-wide outages, moving paid Hacker users into their own cluster so future incidents affect only a subset of users.
- [How We Use Terraform At Slack](https://swe.quest/articles/how-we-use-terraform-at-slack-a1596aae0a45b4a5.md): Slack Engineering · 2022-10-25 · Medium · 14 min read · Infrastructure as code, Cloud platforms, CI/CD, Developer tools
  Slack runs roughly 1,400 Terraform state files across AWS, GCP, DigitalOcean and NS1, split per account, region and large service so each change touches fewer resources.
- [How we built multi-region support for Linear](https://swe.quest/articles/how-we-built-multi-region-support-for-linear-acbf98e7bc2a3edb.md): Linear · 2024-05-23 · Medium · 9 min read · System design, Distributed systems, Identity & auth, Infrastructure as code, PostgreSQL
  Linear added an EU region by replicating its entire production deployment per region rather than sharding the database, keeping each region isolated and letting engineers keep writing against a single Postgres instance.
- [Why We Built Our Own DNS Infrastructure](https://swe.quest/articles/why-we-built-our-own-dns-infrastructure-b1c8975cd0ea6aa3.md): Replit · 2021-04-29 · Medium · 4 min read · DNS, Load balancing, Distributed systems, Go
  Replit made its repl hosting cluster-aware by running its own authoritative DNS server for \*.repl.co, which resolves each repl's domain to the proxy load balancer in the cluster hosting that repl.
- [Using Terraform to Manage Infrastructure](https://swe.quest/articles/using-terraform-to-manage-infrastructure-d186c1bad18dabed.md): Shopify Engineering · 2022-03-17 · Medium · 8 min read · Infrastructure as code, Go, Configuration management, Communications
  Shopify's Conversations team replaced GUI-based configuration of Twilio TaskRouter, which routes contact-center tasks to agents, with Terraform.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
