System Topology & Request Flows¶
Stravin Core synthesizes patterns from GitHub's Project Rubicon and Cursor Origin's Continuity onto AWS managed primitives: stateless Go services backed by Amazon S3 for immutable Git packfiles and Amazon DynamoDB Global Tables (MREC) for per-reference compare-and-swap (Ref-CAS) and pack manifests.
Comparison to Prior Art¶
| Architectural Concern | GitHub Project Rubicon | Cursor Continuity | Stravin Core (AWS Go + S3 + DynamoDB) |
|---|---|---|---|
| Durable Object Plane | Packfiles and read-acceleration indexes in Azure Blob Storage | Packfile WAL entries stored as immutable objects in S3 | Content-addressed immutable .pack, .idx, .midx, and commit-graph objects in regional S3 buckets |
| Reference & Manifest Coordination | Dedicated replicated log service (Ref-CAS) with per-reference ordering | Single S3 manifest (gitwal.pb) updated via S3 conditional CAS (~120–300 pushes/sec ceiling) |
DynamoDB per-ref CAS + TransactWriteItems (eliminates single-blob bottleneck and custom Raft/Paxos) |
| Compute & Cache Model | Disposable virtual replicas with rebuildable local caches | Stateless nodes using local NVMe as warm cache; rendezvous hashing for soft affinity | Stateless Go stravin-node fleet with local NVMe bare-repo caches and tenant-aware rendezvous hashing |
| Compaction & GC | Sharded out-of-band compaction workers; two-phase manifest swap | Background WAL compaction decoupled from request serving | Go stravin-pack workers claiming DynamoDB shard leases and running two-phase manifest swaps |
| Multi-Region Durability | Global replicas with bounded staleness | Single-region S3 / S3 Express One Zone WAL | Home-region write pinning + async DynamoDB MREC + S3 CRR with RTC (zero home-region RTT penalty) |
Multi-Region System Topology¶
Local Emulation vs. Production Cloud Primitives
In stravin-dev/core (v1.12.x), all five Go daemons, Valkey pack caching, and dual-region replication/failover run locally via Docker Compose + Floci. Production cloud ingress (Route 53 latency routing / AWS Global Accelerator) and Cilium (eBPF) sidecarless WireGuard/SPIFFE mTLS service mesh (ADR-0001) are TBD / Planned (Production).
flowchart TB
Clients["Global Clients (Git HTTPS / SSH)"]
DNS["Route 53 Latency / Global Accelerator (TBD / Planned)"]
Clients --> DNS
subgraph RegionA["Region A (Home Region)"]
EdgeA["stravin-edge (Go + Valkey/S3 Pack Cache)"]
ValkeyA[("Valkey (Hot Pack Cache <= 8 MiB)")]
NodeA["stravin-node (Go + Warm NVMe Cache)"]
S3A[("S3 Bucket (Region A)")]
DDBA[("DynamoDB (Region A)")]
PackA["stravin-pack (Go Sharded Compactor)"]
HookA["stravin-hook (v1.12.x)\nstravin-relay -> JetStream (vNext)"]
EdgeA <--> ValkeyA
EdgeA -->|"Rendezvous Hash (tenant, repo)"| NodeA
NodeA -->|"1. PutObject (.pack + .idx)"| S3A
NodeA -->|"2. TransactWriteItems"| DDBA
PackA <--> S3A
PackA <--> DDBA
DDBA -.->|"DynamoDB Streams"| HookA
end
subgraph RegionB["Region B (Secondary / HA)"]
EdgeB["stravin-edge (Go + Valkey/S3 Pack Cache)"]
ValkeyB[("Valkey (Hot Pack Cache <= 8 MiB)")]
NodeB["stravin-node (Go + Warm NVMe Cache)"]
S3B[("S3 Bucket (Region B)")]
DDBB[("DynamoDB (Region B)")]
CtrlB["stravin-ctrl (Failover & Scrub)"]
EdgeB <--> ValkeyB
EdgeB -->|"Local Reads"| NodeB
NodeB -->|"Local Read"| DDBB
NodeB -->|"Local Read"| S3B
CtrlB <--> DDBB
CtrlB -->|"HeadObject Scrub"| S3B
end
DNS --> EdgeA
DNS --> EdgeB
EdgeB -.->|"Write Proxy (gRPC; cloud mTLS TBD)"| EdgeA
NodeB -.->|"404 Transparent Origin Fallback"| S3A
S3A -.->|"S3 CRR + RTC (async)"| S3B
DDBA -.->|"DynamoDB Global Tables MREC (async <1s)"| DDBB
Go Service Responsibilities¶
Keeping Git operations at the packfile layer—rather than reimplementing Git's entire object graph engine—preserves full compatibility with standard Git internals. The control and data planes split into five Go daemons plus the stravin-admin CLI:
stravin-edge(Ingress, Pack Cache & Routing Proxy):- Terminates SSH (
golang.org/x/crypto/ssh) and Smart HTTP (net/http), enforces authentication (edge.StaticAuthenticatorinv1.12.x; local JWKS verification + Valkeyjtideny-list off the synchronous hot path viastravin-authinvNext), authorization, and per-tenant ingress rate limits (STRAVIN_RATE_LIMIT_RPS,STRAVIN_MAX_CONCURRENT_CLONES), and resolves each repository'sMETA/home_region(cached in memory with a short TTL, default1s). - Tiered Full-Clone Pack Response Cache (
internal/edge/pack_cache.go): Serves repeated full-clone Smart HTTPupload-packresponses strictly after authentication and authorization succeed. Uses Valkey (RESP2 hot tier, entries<= 8 MiB,5mdefault TTL,allkeys-lfueviction) with Floci/S3 spillover (pack-cache/v1/..., entries<= 64 MiB) and in-processsingleflightcoalescing (PackCacheCoordinator) to prevent thundering herds. - Reads: Routes cache misses locally via rendezvous hashing (Highest Random Weight) over healthy
stravin-nodeinstances in the client's nearest region. - Writes: When
local_region == home_region, routes via rendezvous hashing to the primarystravin-nodefor(tenant_id, repo_id)(or(tenant_id, repo_id, ref_shard)for hot repositories) to maximize warm cache hits and minimize CAS retries. Whenlocal_region != home_region, transparently tunnels the Git wire stream over gRPC tostravin-edgeinhome_region(Cilium eBPF sidecarless WireGuard/SPIFFE mTLS + Cluster Mesh is TBD / Planned per ADR-0001).
- Terminates SSH (
stravin-node(Stateless Virtual Replica):- Holds ephemeral NVMe disks storing materialized bare Git repositories strictly as disposable caches.
- Serves pure-Go Git Protocol v2
ls-refs(internal/node/ls_refs.go) directly from cached DynamoDB ref state without forkinggit-upload-pack(for bounded stateless-RPC requests<= 1 MiB), falling back transparently togit-upload-packfor other commands. - Maintains a versioned
METAcache keyed byRefVersionandManifestVersionso reads whose repository version has not advanced skip redundant DynamoDB shard scatter-gather queries. - Handles
git-receive-pack(pure-Go pack streaming/indexing or sandboxedgit index-pack) and concurrency-bounded, sandboxedgit-upload-pack, intercepting ref advertisement and ref updates so no local ref on disk is ever authoritative. - Materializes missing repositories on demand (after node restart, autoscale, or failover) by reading the manifest from DynamoDB and pulling missing packs from S3.
- Executes synchronous Tier 1 WebAssembly hooks overlapped with S3 pack uploads.
stravin-pack(Out-of-Band Maintenance Workers):- Runs in an isolated compute pool so repacking never steals CPU or memory from live read/write
stravin-nodeinstances. - Claims sharded compaction leases in DynamoDB, merges small incoming push packs in multi-batch Tier-0 passes into consolidated packs, builds multi-pack-index (
.midx) andcommit-graphacceleration files, and runs delayed garbage collection.
- Runs in an isolated compute pool so repacking never steals CPU or memory from live read/write
stravin-ctrl(Failover & Integrity Controller):- Maintains regional write leases, orchestrates
home_regionownership transitions, incrementsfailover_epochfencing tokens, and runs post-failover S3 pack verification scrubs and ref rewinds via its authenticated HTTP admin API (/v1/lease/*,/v1/epoch/advance,/v1/scrub,/v1/recovery/reconcile).
- Maintains regional write leases, orchestrates
stravin-hook(Async Outbox & Webhook Worker Pool):- Consumes DynamoDB Streams (
Ref HistoryNEW_IMAGEinserts), persists per-shard checkpoints in DynamoDB, decrypts webhook signing secrets via KMS, and delivers HMAC-SHA256-signed HTTP webhooks with exponential backoff and dead-letter queue (DLQ) recording off thegit pushpath. vNextrename: Per ADR-0001, renamed tostravin-relayinvNext—a pure DynamoDB Streams -> NATS JetStream transactional outbox relay running zero Wasm and zero external HTTP webhooks (external delivery moves tostravin-webhooks).
- Consumes DynamoDB Streams (
stravin-adminCLI (cmd/stravin-admin):- Operational CLI for repository provisioning (
repo), Tier 1 Wasm hook registration (hook), and Tier 2 webhook management (webhook).
- Operational CLI for repository provisioning (
Critical Request Flows¶
Write Path (git push in Home Region)¶
stravin-nodereceives the pack stream over stdin, indexes and validates it locally on NVMe/RAM, and checks pushedold_oidvalues against its warm ref cache to fast-reject obviously stale pushes.stravin-nodeconcurrently uploads{pack_id}.packand{pack_id}.idxto local S3 (awaiting HTTP 200 for regional strong read-after-write consistency) while running any configured synchronous Tier 1 Wasm hooks.stravin-nodevalidates its cached regional write lease andfailover_epochfor the repository (refreshed via lightweight background lease checks).stravin-nodesubmits a single DynamoDBTransactWriteItemscall (atomic up to 100 items / 4 MB within the home region):- Ref State:
UpdateItemper pushed ref withConditionExpression: oid = :old_oid(orattribute_not_exists(oid)for new branches). - Ref History: Append a history record (enabling safe rollback during catastrophic regional failover and feeding DynamoDB Streams for async hooks).
- Pack Manifest:
PutItemfor the new pack entry tagged withorigin_region = home_region. - Repo
METAVersion Bump: Conditionally updatesMETA(ADD ref_version :one, manifest_version :onefor pack pushes, orADD ref_version :onefor ref-only deletes) sostravin-nodereaders can validate their versionedMETAcache in a singleGetItem. (Moving version tracking offMETAto avoid a 500 tx/sec single-partition ceiling on ultra-hot monorepos is a planned production scaling optimization.) - Multi-ref push limit: Because each pushed ref writes both a state and a history item, atomic pushes exceeding ~45 refs either disable cross-ref atomicity (matching default Git behavior) or spill to a temporary bundle pointer.
- Ref State:
stravin-nodeupdates its local warm NVMe bare repo refs and immediately ACKs the client. Zero cross-region calls occur on the push path.
Read Path (git fetch / git clone in Any Region)¶
- For Smart HTTP full-clone
upload-packrequests,stravin-edgechecks the Tiered Full-Clone Pack Response Cache (Valkey hot tier<= 8 MiB, S3 spillover<= 64 MiB, withsingleflightcoalescing) strictly after authentication and authorization. Cache hits stream directly fromstravin-edgewithout invokingstravin-node. - On a cache miss (or incremental fetch / SSH),
stravin-edgeroutes via rendezvous hashing to a localstravin-node.stravin-nodechecks the repository'sMETAitem (RefVersion/ManifestVersion); if its local versioned cache matches, it skips querying DynamoDB ref and manifest shards. Otherwise it queries local DynamoDB shards incrementally. - For Git Protocol v2
ls-refsrequests (<= 1 MiB),stravin-nodeserves the ref advertisement directly in pure Go (internal/node/ls_refs.go) without spawning agitsubprocess. - For
fetch/clonepack generation,stravin-nodeconcurrently fetches any missing.packand.idxfiles from local S3 (falling back toorigin_regionon404 NoSuchKeyper HA & Consistency), links them intoobjects/pack/, and runs concurrency-bounded, sandboxedgit-upload-packagainst the read-only materialized NVMe repo.
Two-Phase Sharded Compaction (Out-of-Band)¶
Following Project Rubicon's pattern, stravin-pack workers claim a manifest shard lease (SHARD#{m}), merge small packs in that shard on ephemeral NVMe inside an isolated container/microVM, and upload the consolidated pack and .midx to S3:
- Transaction 1 (Publish): Add the new compacted pack(s) to the manifest so readers begin preferring them.
- Transaction 2 (Supersede): Mark superseded small packs as
COMPACTEDand remove them from active manifest queries. - Delayed GC: A background sweeper deletes superseded S3 objects only after a grace window (e.g., 24 hours—safely beyond S3 RTC's 15-minute SLA and any long-running clone).
Related Documents¶
- Storage Layer: S3 & DynamoDB — Exact S3 key layout and DynamoDB table schema.
- Multi-Region HA & Consistency — Replication asymmetry handling and failover protocol.
- Performance & Throughput Scaling — Bottleneck math and LSM compaction tiers.
- Sandboxed Execution & Multi-Tenancy — Execution isolation for
stravin-nodeandstravin-pack. - ADR-0001: Platform Transport, Events & Webhooks & ADR-0003: Platform Auth & SSO Seam —
vNextCilium eBPF mesh,stravin-relay-> NATS JetStream, andstravin-authlocal JWKS + Valkeyjtiverification.