Development
en-US

GitHub Rubicon: Coordinating Only Ref Updates—Benchmarking Repo-Wide Locks vs. Per-Ref CAS in Go

GitHub's new Git storage architecture, Rubicon, stores immutable objects in Azure Blob Storage, delegates reference and pack manifest transactions to Ref-CAS, and uses disposable virtual replicas and dedicated compaction nodes for reads, writes, and maintenance. Based on the full official post, this article explains the publication boundary and the workload assumptions behind per-ref parallelism, accompanied by a runnable minimal Go implementation: SHA-256 immutable objects, file and directory fsync before CAS, an ordered in-memory per-ref log, and a repo-wide mutex baseline. Across 36 runs, all 216,000 acknowledged pushes passed in-process verification. At N=32, median throughput on distinct refs was 15,216 push/s vs. 4,397 for the repo-wide lock; on the same ref, it dropped to 858 vs. 3,937 with a 93.6% attempt conflict rate. The ref log is not durable, so this proves neither crash recovery nor distributed consensus, and the numbers cannot be compared against GitHub's internal 7,200 push/s figure.

·33 min read·Lios09
#git#go#distributed-systems#storage#concurrency

1. Scoping the Numbers First: 7,200 push/s Is GitHub's Internal Test, Not This Post's Result

On 2026-11-05, GitHub introduced Project Rubicon in "Inside GitHub's new Git storage architecture". I read the full post; every component, workflow, rollout status, and figure about Rubicon below comes strictly from that single official source, not from secondhand summaries.

The post opens by stating that internal tests sustained 5,000 concurrent agents working on a single repository, sending 7,200 pushes/s to one repository while serving sustained low-latency read traffic. That is not a reproducible recipe for a public benchmark: the post does not publish the full hardware specs, pack sizes, per-ref traffic distribution, test duration, or p99 breakdown for that run. In particular, you cannot read it as "5,000 agents successfully pushing to the exact same branch simultaneously."

Scale Claim in the Official PostAccurate ScopeWhat It Should Not Be Replaced With
5,000 concurrent agents, 7,200 push/sInternal single-repository system testSuccessful CAS/s on a single ref, or an SLA for all users
Ref-CAS handling tens of thousands of ops/sTransaction throughput for reference state onlyEnd-to-end push throughput including object upload and validation
Single-blob WAL prototype at hundreds of writes/sObservation for that specific prototypeUniversal throughput ceiling of Azure Blob Storage
Currently in limited private previewAvailability at publication time; broader rollout planned for early next yearAll GitHub repositories have already migrated

"Early next year" in a 2026-11-05 post refers to a plan for early 2027, not a verified rollout fact. Nor did I eyeball extra numbers off the charts in the post.


2. The Real Split: Objects Can Be Written Concurrently, but Pointers Require Agreement

2.1 Immutable Data and Mutable Pointers Play Different Roles

The core observation in the official post is straightforward: Git objects are immutable and content-addressed, so two writers do not need to coordinate with each other just to store objects. The piece of a push that requires agreement is the tiny reference update.

Take a minimal example: writers A and B both start from main=H0 and prepare new objects HA and HB, respectively. Both objects can coexist in object storage. But if both want to move main forward from H0, uploading objects successfully does not mean both reference updates can succeed.

                    immutable data plane
 writer A ---- upload objects for HA ----+
                                         +---- Blob Storage
 writer B ---- upload objects for HB ----+

                     mutable metadata plane
 A: CAS(main, H0 -> HA) ---- succeeds ----> main = HA
 B: CAS(main, H0 -> HB) ---- conflicts ---> do NOT overwrite HA

This diagram illustrates semantics only. "Writing objects does not require consensus between writers" does not mean there is zero synchronization inside the OS or object store, nor that an entire push needs no transaction. Object reachability, write authorization, and checking old ref values live at another layer.

2.2 The Pack Manifest Is Part of the Publication Transaction Too

GitHub splits durable state across two places:

  • Azure Blob Storage: Git object packs, along with auxiliary read-acceleration data.
  • Ref-CAS: references and the list of packs that compose the repository—the pack manifest.

You cannot ignore the manifest. If a reference has already moved, but a reading replica does not know which pack to fetch, you do not yet have a complete, readable published state. The write path in the post is therefore not "upload a pack, then update a ref separately"; it is a single Ref-CAS transaction that both registers the pack in the manifest and updates the references.

The post also notes that indexing an incoming pack and running object connectivity checks are the most CPU-intensive parts of the write path, with cost scaling with write size. Cramming that work onto one writer node means simply shrinking lock durations will not scale indefinitely; having multiple writer nodes that scale independently matters just as much.


3. Why References Were Not Left Entirely in Blob Storage

Blob storage fits large write-once payloads spread across many distinct keys; hot references are tiny pieces of state contested repeatedly by many writers. The two designs GitHub tried do not prove a product is "bad"—they illustrate an access-pattern tradeoff.

ApproachHow Writes WorkHow Readers Check for ChangesCost Hit by GitHub
Repo-wide references WAL indexed by a single blobConditional writes to that blob; batching waiting pushesCheck whether that blob changedOnly one conditional write can be in flight on the blob at a time; even with batching, single-blob round-trip cadence capped the prototype at hundreds of writes/s
Hashing references across multiple segment blobsDifferent segments can be written concurrentlyMust check all segmentsReads wait on the slowest segment; reads outnumber writes by orders of magnitude, making that cost shift a losing trade
Dedicated Ref-CAS serviceCAS on touched refs with quorum commitVersion check; fetch new state and pointers when behindIntroduces a dedicated replicated log service, but concentrates coordination onto tiny state

There is an easy-to-miss goal here: reads when nothing has changed must be cheap. If you optimize purely for writer sharding throughput and turn every routine read into an N-way probe, you can easily drive total system cost up.

3.1 Per-Ref Locking Does Not Mean One Raft Group per Ref

The post describes a Ref-CAS transaction like this: it locks only the references it touches, checks that each ref still matches the writer's expected value, and becomes visible once a majority of log replicas have recorded it. Because agents typically push to their own branches, most updates do not contend with one another and can replicate in parallel; when two pushes race on the same ref, only one can append successfully.

Do not invent implementation details that are not there: GitHub did not disclose the consensus algorithm name, replica count, leader election protocol, or sharding topology in the post. "Independent ordering per ref" should not be rewritten as "one independent Raft group per ref." Transactions can also touch multiple refs, so you cannot reduce Ref-CAS to a single-key CAS API.

Every Ref-CAS commit receives a LSN (log sequence number), and the repository version is the LSN of the latest commit. Narrowing contention to individual refs while maintaining a repo-wide version is not a contradiction: the former bounds write mutual exclusion, while the latter lets readers tell whether they are behind.

3.2 Data Durable First, Pointers Published Second

The post states explicitly: a virtual replica uploads the pack to Blob Storage first, then commits the reference transaction; Ref-CAS neither holds nor validates the objects themselves, storing only pointers. Consequently, any object pointed to by a reference is already durable.

From an engineering perspective, this ordering allows "objects exist in storage, yet never become part of ref-reachable history," while forbidding the reverse ("ref update succeeded before the objects were persisted"). The former is a garbage-collection concern; the latter is a read-correctness bug. That remark about orphan objects is my own inference from the publish ordering, not an additional failure-recovery algorithm disclosed in the post.


4. Virtual Replicas: Local Disk Shifts from Repo Authority to Rebuildable Cache

In the official architecture, Spokes still handles ingress routing, load balancing, and internal APIs, as well as placement, partitioning, isolation, and tenant fairness. What changed is the data plane underneath it—Blob Storage did not replace the entire control plane.

 Git clients / API / web UI
              |
              v
           Spokes
              |
      assigned virtual replicas        dedicated compaction nodes
       +---------+---------+                      |
       |         |         |                      |
      VR-1      VR-2      VR-3                     |
       |         |         |                      |
       +----- local disposable caches             |
       |                                          |
       +------------> Azure Blob Storage <--------+
       |                 packs / indexes          |
       +------------> Ref-CAS <-------------------+
                     refs + pack manifest + LSN

Virtual replicas form a disposable compute fleet capable of serving reads, writes, or both. Spokes tries to route a repository's traffic to the same set of replicas to keep caches warm, but correctness does not depend on requests landing on one designated node. If a node disappears, other replicas keep serving and replacement nodes refill their caches as traffic arrives; when a repo gets busy, more replicas are added.

4.1 What Happens on a Write vs. a Read

PathSteps Given in the Official Post
WriteVirtual replica indexes incoming pack -> uploads to Blob -> single Ref-CAS transaction registers pack and updates refs -> background compaction later
ReadCheck reference version with Ref-CAS -> pull needed packs from Blob into local cache -> serve read
Unchanged version checkReplica sends its current version; if still up to date, response omits references and performs only a version comparison
Stale replicaReturns current references, version, pack pointers, and other metadata needed (such as recent GC info)

"A single comparison" does not mean "zero network round-trips," and "not tied to a fixed replica" does not mean "any consistency mode is fine." The post describes the current version-check path; you cannot extrapolate today's read semantics backward from future roadmap items like global replicas and bounded staleness.

4.2 Do Not Present Roadmap Items as Shipped Capabilities

The post lists several items as future directions: fetching a single object from Blob instead of an entire pack, organizing packs by object type, partial replicas, materialized views, global replicas, and scale to zero. None of these can be claimed here as already shipped in full.

One distinction in particular matters: today's read path still downloads the needed packs, whereas partial replicas on the roadmap explicitly talk about serving requests without having every pack locally. I did not fabricate an already-shipped per-object on-demand fetch protocol from that, nor did I build a virtual replica simulator.


5. Dedicated Compaction Is Not a Side Optimization—It Is the Other Half of Throughput

Every push adds a pack, and unbounded pack growth makes lookups steadily more expensive. In the old architecture, compaction ran on the traffic-serving replicas—and every replica had to run it. In the new architecture, dedicated nodes operate directly against Blob Storage and Ref-CAS, keeping maintenance out of the virtual replicas' budget.

The published per-shard workflow looks like this:

 claim shard lease in Blob
          |
 read manifest -> collect new packs into OPEN segment
          |
 threshold: pack count / size / age
          v
         SEALED segment -----> combine into fewer larger packs
          |                              |
 next OPEN segment starts       verify EXACT same object set
                                         |
                                upload new packs
                                         |
                           transaction 1: add outputs to manifest
                                         |
                           transaction 2: remove input packs
                                         |
                                 later cleanup deletes inputs

Each pack's hash maps it to a shard, allowing multiple shards and multiple nodes to work in parallel. Compacted packs that have not reached the size ceiling are hashed back into shards for further merging, growing tier by tier until they hit the cap. The reported goal is to keep pack count roughly flat as write volume rises, and GitHub reports consistently demonstrating a flat latency curve as writes increase; again, I am not reading specific numbers off the chart.

The two-transaction manifest update is worth noting: add outputs first, remove inputs second, and only physically delete the old data later. In my reading, this reflects a separation between publication and reclamation, though it does not mean we know the full safety protocol for concurrent readers—the post does not go into that detail.

Compaction preserves every object; GC is what removes unreachable objects, such as those left behind by deleted branches or force-pushes. The post only mentions that the new GC also runs on independent workers and that safe deletion warrants its own future post. I will not invent grace periods, reference counts, snapshot isolation, or specific GC algorithms here.

Blob Storage also holds indexes, multi-pack indexes, reachability bitmaps, maintenance records and leases, cached responses for common fetches, and ref state checkpoints. Checkpoints are not the authoritative ref state used to serve requests; authoritative updates still go through Ref-CAS. That also explains why "almost all durable data lives in Blob" does not mean "all authoritative state lives only in Blob."


6. The Go Experiment: Get Minimal Semantics Right Before Talking Performance

This is my own minimal implementation, not GitHub's implementation. It is a standalone educational program—no cloned GitHub internal code, no calls to GitHub services. The source lives in rubicon-go-lab/; the core implementation and full CLI entry point are included below.

State the most important boundary up front: local CAS only demonstrates conditional updates and ordered publication semantics—it does not reproduce distributed consensus, replication, or crash recovery. A sync.Mutex is not a quorum, and an append-only slice in a Go process is not Ref-CAS's replicated log.

Experiment ComponentWhat It DoesWhat It Does Not Do
Object storeSHA-256 content-addressed custom JSON commits; local directory; never overwrites after publishGit loose-object framing, real Git OIDs, packs/indexes, connectivity checks
Persistence orderTemp file Sync -> atomic hard-link publish -> directory Sync -> durable receipt -> CASAzure multi-replica durability, power-loss fault injection, cloud-disk controller verification
Per-ref logOne lock per ref; conditional update and log append in the same critical sectionDurable ref WAL, quorum, multi-ref atomic transactions, pack manifest, repo LSN
RetriesOn conflict, read new head, rebuild commit with new parent, write object, retry CASReal file-diff rebase, merge conflict resolution, permissions, branch protection
BaselineOne repo-wide mutex wrapping head read, object write, and CASFull reimplementation of GitHub's legacy architecture
VerificationAfter each run, checks every ack, log entry, object hash, and durability orderingCross-process recovery, network partitions, linearizability model checking

6.1 Object Publication Cannot Be "Create the Final File First, Then Write Slowly"

If you open the final hash path with O_EXCL and write to it directly, another writer seeing EEXIST could observe an object that the first writer has not finished writing—let alone fsynced. This experiment does the following instead:

  1. Create a random temp file in the object directory, write the bytes, call File.Sync(), and close it.
  2. Call os.Link(tmp, finalHash): an atomic write-if-absent publish within the same filesystem that never overwrites on EEXIST.
  3. Remove the temp filename, call Sync() on the object directory, and only then issue a durable receipt.
  4. Make CAS reject any new object ID that lacks a receipt.

Even on EEXIST, the calling writer still syncs the directory before claiming durability; it cannot blindly assume the other writer has finished its own directory sync. The experiment uses no application-level mutex around object writes, though the underlying filesystem still performs its own internal synchronization. Get() recomputes SHA-256 to verify object integrity.

Here we treat successful fsync calls as durable under the Linux/ext4 interface contract; no real power-loss testing was done to verify that the storage stack honors the contract. The receipt is an in-process audit token, not a persistent proof signed by disk or a replication service, and there is no recovery logic across process restarts.

6.2 Same-Ref and Distinct-Ref Workloads Must Be Measured Separately

Do not average these two workloads into one number:

  • same: every goroutine updates refs/heads/main.
  • distinct: writer w updates only its own refs/heads/agent-w. At N=1 there is only one branch, so distinct is structurally equivalent to single-writer same.

Each operation has a unique ID push-NNNNNN. Each commit stores its parent, operation ID, and a fixed 1,024-byte payload. Even though the payload bytes are identical, the operation ID differs, so every successful commit hashes differently; after every conflict, the parent changes, producing a new object as well. Objects left behind by failed attempts are never overwritten, and the temporary run directory is cleaned up after timing and verification finish.

The per-ref design holds no ref lock while preparing and syncing objects—only when reading head or running CAS. The repo-lock baseline serializes all of that work behind a single mutex. Because the baseline has no optimistic CAS contention, its conflict=0 does not mean zero waiting; waiting shows up in latency instead.

This implementation embeds the payload directly inside every commit attempt, so retries rewrite it; real Git can reuse content blobs separately from parent-bearing commits. There is no backoff or adaptive admission control—just runtime.Gosched() after a conflict. This is intentionally a simple model that exposes conflict rework cost, not a tuned production push service.

6.3 What Gets Checked After Every Run

"The program did not panic" is not a correctness bar. After all goroutines stop, Verify() checks:

  • Every acknowledged operation ID is unique, appears in the log exactly once, and matches its ref name and object ID; no unacknowledged operations appear out of thin air in the log.
  • Each ref's sequence numbers increment contiguously from 1; every entry's Old equals the previous entry's New; the final head equals the ref's last log entry.
  • Every logged object passes SHA-256 verification and its JSON Parent and Op match the log entry—confirming every acknowledged push remains in the final parent chain and was never silently clobbered.
  • Every entry's durable receipt precedes its CAS publish audit counter, and the object exists. Because receipts are issued only after both file and directory fsync succeed, every ref update happened strictly after object sync.

Store.clock is strictly a local in-process audit counter for ordering sync vs. publish—not Rubicon's LSN, and certainly not a global consensus clock. The distinct-ref runs make no claim of multi-ref atomicity.

Unit tests also cover concurrent publication of identical content, rejecting non-durable objects, rejecting stale old values, detecting lost acks, and detecting external object corruption. go test -race checks for data races exercised during those test runs; it is not a formal proof over all possible concurrent interleavings.

6.4 Complete Core Code: lab.go

go.mod declares module rubicon-go-lab with go 1.25 and uses only the Go standard library. The machine already had go1.27.3 linux/amd64 installed, so no SDK installation or apt packages were needed.

// Minimal self-written implementation, not GitHub's implementation. No Git protocol or distributed consensus.
package main

import (
	"crypto/sha256"
	"encoding/hex"
	"encoding/json"
	"errors"
	"fmt"
	"os"
	"path/filepath"
	"runtime"
	"sort"
	"strings"
	"sync"
	"sync/atomic"
	"time"
)

type Store struct {
	root    string
	durable sync.Map      // object ID -> receipt, issued only after file AND directory fsync
	clock   atomic.Uint64 // audit only; not a repository LSN or a consensus protocol
}

func syncDir(path string) error {
	d, e := os.Open(path)
	if e != nil {
		return e
	}
	defer d.Close()
	return d.Sync()
}
func NewStore(root string) (*Store, error) {
	abs, e := filepath.Abs(root)
	if e != nil {
		return nil, e
	}
	if e = os.MkdirAll(abs, 0700); e != nil {
		return nil, e
	}
	// Persist the pre-provisioned directory chain too (Linux local filesystem).
	for d := abs; ; d = filepath.Dir(d) {
		if e = syncDir(d); e != nil {
			return nil, e
		}
		if d == filepath.Dir(d) {
			break
		}
	}
	return &Store{root: abs}, nil
}
func (s *Store) Put(data []byte) (string, error) {
	sum := sha256.Sum256(data)
	id := hex.EncodeToString(sum[:])
	f, e := os.CreateTemp(s.root, ".tmp-")
	if e != nil {
		return "", e
	}
	tmp := f.Name()
	defer os.Remove(tmp)
	if _, e = f.Write(data); e != nil {
		f.Close()
		return "", e
	}
	if e = f.Sync(); e != nil {
		f.Close()
		return "", e
	}
	if e = f.Close(); e != nil {
		return "", e
	}
	// Atomic write-if-absent: never expose a half-written final object.
	e = os.Link(tmp, filepath.Join(s.root, id))
	if e != nil && !errors.Is(e, os.ErrExist) {
		return "", e
	}
	if e = os.Remove(tmp); e != nil {
		return "", e
	}
	// Even EEXIST callers sync the directory before claiming durability.
	if e = syncDir(s.root); e != nil {
		return "", e
	}
	s.durable.Store(id, s.clock.Add(1))
	return id, nil
}
func (s *Store) Durable(id string) bool { _, ok := s.durable.Load(id); return ok }
func (s *Store) Get(id string) ([]byte, error) {
	if len(id) != 64 {
		return nil, fmt.Errorf("invalid id")
	}
	if _, e := hex.DecodeString(id); e != nil {
		return nil, e
	}
	b, e := os.ReadFile(filepath.Join(s.root, id))
	if e != nil {
		return nil, e
	}
	sum := sha256.Sum256(b)
	if hex.EncodeToString(sum[:]) != id {
		return nil, fmt.Errorf("checksum mismatch: %s", id)
	}
	return b, nil
}

type Commit struct{ Parent, Op, Payload string }

func EncodeCommit(parent, op string, size int) []byte {
	b, _ := json.Marshal(Commit{parent, op, strings.Repeat("x", size)})
	return b
}

type Entry struct {
	Seq                     int
	Old, New, Op            string
	DurableReceipt, Publish uint64
}
type Ref struct {
	mu   sync.Mutex
	head string
	log  []Entry
}

func NewRef() *Ref          { return &Ref{} }
func (r *Ref) Head() string { r.mu.Lock(); defer r.mu.Unlock(); return r.head }
func (r *Ref) CAS(s *Store, old, next, op string) (bool, error) {
	r.mu.Lock()
	defer r.mu.Unlock()
	receipt, ok := s.durable.Load(next)
	if !ok {
		return false, fmt.Errorf("object not durable")
	}
	if r.head != old {
		return false, nil
	}
	publish := s.clock.Add(1)
	r.log = append(r.log, Entry{len(r.log) + 1, old, next, op, receipt.(uint64), publish})
	r.head = next
	return true, nil
}

type Ack struct{ Ref, Op, ID string }
type Result struct {
	Design, Work                                                  string
	N, Pushes, Acked, Verified                                    int
	Conflicts                                                     int64
	Seconds, PushesSec, ConflictPct, RetriesPerPush, P50ms, P99ms float64
}

func Verify(s *Store, refs map[string]*Ref, acks []Ack) (int, error) {
	acknowledged := make(map[string]Ack, len(acks))
	for _, a := range acks {
		if _, ok := acknowledged[a.Op]; ok {
			return 0, fmt.Errorf("duplicate ack %s", a.Op)
		}
		acknowledged[a.Op] = a
	}
	seen := make(map[string]bool, len(acks))
	total := 0
	for name, r := range refs {
		old := ""
		for i, e := range r.log {
			if e.Seq != i+1 || e.Old != old {
				return 0, fmt.Errorf("broken ordered chain")
			}
			if e.DurableReceipt == 0 || e.DurableReceipt >= e.Publish || !s.Durable(e.New) {
				return 0, fmt.Errorf("publish before fsync")
			}
			b, err := s.Get(e.New)
			if err != nil {
				return 0, err
			}
			var c Commit
			if err = json.Unmarshal(b, &c); err != nil {
				return 0, err
			}
			if c.Parent != e.Old || c.Op != e.Op {
				return 0, fmt.Errorf("commit/log mismatch")
			}
			a, ok := acknowledged[e.Op]
			if !ok || a.Ref != name || a.ID != e.New || seen[e.Op] {
				return 0, fmt.Errorf("ack/log mismatch")
			}
			seen[e.Op] = true
			old = e.New
			total++
		}
		if r.head != old {
			return 0, fmt.Errorf("head/log mismatch")
		}
	}
	if total != len(acks) {
		return 0, fmt.Errorf("lost acknowledged push: log=%d ack=%d", total, len(acks))
	}
	return total, nil
}
func percentile(v []time.Duration, p float64) float64 {
	i := int(float64(len(v))*p+0.999999) - 1
	if i < 0 {
		i = 0
	}
	return float64(v[i]) / float64(time.Millisecond)
}
func Run(root, design, work string, n, total, size int) (Result, error) {
	out := Result{Design: design, Work: work, N: n, Pushes: total}
	if n < 1 || total < n || size < 0 || (design != "repo-lock" && design != "per-ref") || (work != "same" && work != "distinct") {
		return out, fmt.Errorf("invalid configuration")
	}
	s, e := NewStore(root)
	if e != nil {
		return out, e
	}
	refs := map[string]*Ref{}
	names := make([]string, n)
	for w := 0; w < n; w++ {
		name := "refs/heads/main"
		if work == "distinct" {
			name = fmt.Sprintf("refs/heads/agent-%d", w)
		}
		names[w] = name
		if refs[name] == nil {
			refs[name] = NewRef()
		}
	}
	var repo sync.Mutex
	var wg sync.WaitGroup
	var conflicts atomic.Int64
	acks := make([][]Ack, n)
	latencies := make([][]time.Duration, n)
	errs := make([]error, n)
	startGate := make(chan struct{})
	for w := 0; w < n; w++ {
		wg.Add(1)
		go func(w int) {
			defer wg.Done()
			<-startGate
			r := refs[names[w]]
			for i := w; i < total; i += n {
				op := fmt.Sprintf("push-%06d", i)
				start := time.Now()
				if design == "repo-lock" {
					repo.Lock()
				}
				old := r.Head()
				for {
					// On conflict, recreate the commit on the new parent. This is NOT a file merge.
					id, err := s.Put(EncodeCommit(old, op, size))
					if err != nil {
						errs[w] = err
						break
					}
					ok, err := r.CAS(s, old, id, op)
					if err != nil {
						errs[w] = err
						break
					}
					if ok {
						acks[w] = append(acks[w], Ack{names[w], op, id})
						break
					}
					conflicts.Add(1)
					old = r.Head()
					runtime.Gosched()
				}
				if design == "repo-lock" {
					repo.Unlock()
				}
				if errs[w] != nil {
					return
				}
				latencies[w] = append(latencies[w], time.Since(start))
			}
		}(w)
	}
	start := time.Now()
	close(startGate)
	wg.Wait()
	elapsed := time.Since(start)
	var all []Ack
	var times []time.Duration
	for w := 0; w < n; w++ {
		if errs[w] != nil {
			return out, errs[w]
		}
		all = append(all, acks[w]...)
		times = append(times, latencies[w]...)
	}
	verified, e := Verify(s, refs, all)
	if e != nil {
		return out, e
	}
	if len(all) != total {
		return out, fmt.Errorf("incomplete run")
	}
	sort.Slice(times, func(i, j int) bool { return times[i] < times[j] })
	out.Acked = len(all)
	out.Verified = verified
	out.Conflicts = conflicts.Load()
	out.Seconds = elapsed.Seconds()
	out.PushesSec = float64(total) / elapsed.Seconds()
	out.ConflictPct = 100 * float64(out.Conflicts) / float64(int64(total)+out.Conflicts)
	out.RetriesPerPush = float64(out.Conflicts) / float64(total)
	out.P50ms = percentile(times, 0.5)
	out.P99ms = percentile(times, 0.99)
	return out, nil
}

6.5 Complete CLI Entry Point: main.go

The entry point creates a fresh temporary directory for each run and keeps the total number of successful pushes fixed per run. Repetitions alternate the order of the two designs to reduce fixed-order bias, though they do not randomize all scenarios or isolate other activity on the shared host.

package main

import (
	"encoding/csv"
	"flag"
	"fmt"
	"os"
	"runtime"
	"strconv"
	"strings"
)

func main() {
	total := flag.Int("pushes", 1200, "fixed total successful pushes per run")
	repeats := flag.Int("repeats", 3, "repetitions")
	workers := flag.String("workers", "1,8,32", "goroutine counts")
	payload := flag.Int("payload", 1024, "payload bytes per commit")
	flag.Parse()
	fmt.Fprintf(os.Stderr, "go=%s os=%s arch=%s cpus=%d GOMAXPROCS=%d pushes=%d payload=%d repeats=%d\n", runtime.Version(), runtime.GOOS, runtime.GOARCH, runtime.NumCPU(), runtime.GOMAXPROCS(0), *total, *payload, *repeats)
	w := csv.NewWriter(os.Stdout)
	w.Write([]string{"rep", "scenario", "design", "N", "pushes", "seconds", "pushes_s", "conflicts", "conflict_pct", "retries_push", "p50_ms", "p99_ms", "verified"})
	w.Flush()
	for rep := 1; rep <= *repeats; rep++ {
		for _, work := range []string{"same", "distinct"} {
			for _, ns := range strings.Split(*workers, ",") {
				n, e := strconv.Atoi(ns)
				if e != nil {
					panic(e)
				}
				designs := []string{"repo-lock", "per-ref"}
				if rep%2 == 0 {
					designs = []string{"per-ref", "repo-lock"}
				}
				for _, design := range designs {
					dir, e := os.MkdirTemp("", "rubicon-lab-")
					if e != nil {
						panic(e)
					}
					r, e := Run(dir, design, work, n, *total, *payload)
					cleanup := os.RemoveAll(dir)
					if e != nil {
						panic(e)
					}
					if cleanup != nil {
						panic(cleanup)
					}
					w.Write([]string{strconv.Itoa(rep), work, design, ns, strconv.Itoa(r.Pushes), fmt.Sprintf("%.6f", r.Seconds), fmt.Sprintf("%.2f", r.PushesSec), strconv.FormatInt(r.Conflicts, 10), fmt.Sprintf("%.3f", r.ConflictPct), fmt.Sprintf("%.4f", r.RetriesPerPush), fmt.Sprintf("%.3f", r.P50ms), fmt.Sprintf("%.3f", r.P99ms), fmt.Sprintf("%d/%d", r.Verified, r.Pushes)})
					w.Flush()
					if w.Error() != nil {
						panic(w.Error())
					}
				}
			}
		}
	}
}

7. Running the Benchmark: Look at Conflicts and Tail Latency, Not Just Throughput

7.1 Environment and Commands

This environment was recorded at 2026-11-07 21:17:35 PST (America/Los_Angeles). Background load on a shared host can vary, so this is not a dedicated-hardware benchmark report.

ItemActual Environment
OSLinux 6.12.94+, x86_64, KVM virtual machine
CPU8 exposed logical CPUs, Intel(R) Xeon(R) Processor, family 6 / model 207; not guessing a specific retail SKU
Memoryfree -h reported ~15 GiB total, ~2.7 GiB available at recording time, no swap
FilesystemBoth /tmp and /workspace sit on ext4 on /dev/vdb; tmpfs was not tested as disk
Gogo1.27.3 linux/amd64; pinned to GOMAXPROCS=8
Dataset6,000 successful pushes per run; 1,024-byte payload per commit, plus JSON/parent/ID overhead
Concurrency & repeatsN=1, 8, 32; same / distinct run separately; 2 designs; 3 repetitions, 36 runs total
cd /workspace/blog/rubicon-go-lab
go test -v ./...
go test -race ./...
go vet ./...
go build -o lab .
GOMAXPROCS=8 ./lab -pushes 6000 -workers 1,8,32 -repeats 3 -payload 1024 \
  > results.csv 2> benchmark-meta.txt
python3 summarize.py

Unit tests and -race ran separately; the benchmark used a normal build without race instrumentation. Environment details are saved in machine.txt and per-run raw output in results.csv. A 1,200 push/run smoke run was done beforehand and saved as pilot-results.csv, excluded from the statistics below.

7.2 How Each Metric Is Computed

MetricDenominator and Timing Boundary
pushes/s6,000 successful logical pushes / run wall time, measured from releasing the worker startGate until WaitGroup finishes
latencyWall time of one logical push from before its first attempt to success, including repo-lock queueing or all CAS retries and file/dir fsyncs; failed attempts are not counted as separate pushes
p50 / p99Nearest-rank percentiles over all 6,000 sorted logical push latencies in the run
conflictsCount of failed CAS attempts where head no longer matched the expected old; I/O errors abort the run rather than counting as retryable conflicts
conflict %conflicts / (6,000 + conflicts) × 100%—the attempt conflict rate, not the fraction of pushes that ultimately failed
retries/pushconflicts / 6,000, average extra attempts per successful logical push
verifiedVerified acks / expected successes; both verification and temp-directory cleanup happen outside the timing window

Object hashing, encoding, fsync, CAS, and retries are all inside the timed window; store directory creation, final full-read verification, and deleting temp files are outside it. Each worker runs in a closed loop issuing one push at a time, with no open-loop arrival stream, so latencies cannot be extrapolated into a service SLA under arbitrary arrival rates.

Distinct refs still share the local directory, block device, filesystem journal, and CPUs; this experiment removes only the application-level repo-wide lock, not all resource contention. There is no network, pack indexing, object connectivity validation, quorum replication, or compaction/GC overhead.

7.3 Summary Across Three Repetitions

Each column below is the median of the three repetitions; the p99 ms column is the median of the three per-run p99 values, not a percentile recomputed over all 18,000 merged latencies. Medians in different columns do not necessarily come from the same run.

ScenarioNDesignpushes/sconflict %retries/pushp50 msp99 ms
same1repo-lock4064.820.0000.00000.2140.819
same1per-ref3953.910.0000.00000.2341.208
same8repo-lock3702.430.0000.00001.7646.850
same8per-ref1789.7586.0516.16920.60341.948
same32repo-lock3936.810.0000.00007.09020.324
same32per-ref858.1293.56214.532020.547198.407
distinct1repo-lock3888.870.0000.00000.2141.199
distinct1per-ref4087.880.0000.00000.2020.819
distinct8repo-lock4072.840.0000.00001.7367.047
distinct8per-ref12103.220.0000.00000.5891.317
distinct32repo-lock4397.060.0000.00006.76018.106
distinct32per-ref15216.480.0000.00001.9884.579

7.4 Raw Output and Verification Results

Here is the complete CSV from the official run—no cherry-picking the best iteration. Every verified=6000/6000 confirms that the run passed the log, ack, object hash, and sync-before-publish checks described above. Across all 36 runs, 216,000 logical pushes were acknowledged and verified, excluding attempts rejected by CAS.

rep,scenario,design,N,pushes,seconds,pushes_s,conflicts,conflict_pct,retries_push,p50_ms,p99_ms,verified
1,same,repo-lock,1,6000,1.476082,4064.82,0,0.000,0.0000,0.214,0.819,6000/6000
1,same,per-ref,1,6000,1.517487,3953.91,0,0.000,0.0000,0.214,1.208,6000/6000
1,same,repo-lock,8,6000,1.706233,3516.52,0,0.000,0.0000,1.850,9.548,6000/6000
1,same,per-ref,8,6000,3.352430,1789.75,37287,86.139,6.2145,0.603,42.109,6000/6000
1,same,repo-lock,32,6000,1.417033,4234.20,0,0.000,0.0000,7.006,20.324,6000/6000
1,same,per-ref,32,6000,6.477207,926.33,87192,93.562,14.5320,19.289,178.915,6000/6000
1,distinct,repo-lock,1,6000,1.542864,3888.87,0,0.000,0.0000,0.214,1.199,6000/6000
1,distinct,per-ref,1,6000,1.330885,4508.28,0,0.000,0.0000,0.198,0.819,6000/6000
1,distinct,repo-lock,8,6000,1.616458,3711.82,0,0.000,0.0000,1.899,8.557,6000/6000
1,distinct,per-ref,8,6000,0.463125,12955.47,0,0.000,0.0000,0.584,1.729,6000/6000
1,distinct,repo-lock,32,6000,1.364549,4397.06,0,0.000,0.0000,6.760,17.138,6000/6000
1,distinct,per-ref,32,6000,0.394309,15216.48,0,0.000,0.0000,1.975,4.579,6000/6000
2,same,per-ref,1,6000,1.488768,4030.18,0,0.000,0.0000,0.234,0.951,6000/6000
2,same,repo-lock,1,6000,1.515049,3960.27,0,0.000,0.0000,0.220,0.968,6000/6000
2,same,per-ref,8,6000,3.292368,1822.40,37015,86.051,6.1692,0.590,41.948,6000/6000
2,same,repo-lock,8,6000,1.443719,4155.93,0,0.000,0.0000,1.705,5.662,6000/6000
2,same,per-ref,32,6000,7.056737,850.25,86611,93.521,14.4352,21.484,201.344,6000/6000
2,same,repo-lock,32,6000,1.524075,3936.81,0,0.000,0.0000,7.090,35.864,6000/6000
2,distinct,per-ref,1,6000,1.467754,4087.88,0,0.000,0.0000,0.202,0.788,6000/6000
2,distinct,repo-lock,1,6000,1.445136,4151.86,0,0.000,0.0000,0.205,1.044,6000/6000
2,distinct,per-ref,8,6000,0.522806,11476.54,0,0.000,0.0000,0.589,1.317,6000/6000
2,distinct,repo-lock,8,6000,1.398670,4289.79,0,0.000,0.0000,1.707,5.874,6000/6000
2,distinct,per-ref,32,6000,0.392210,15297.94,0,0.000,0.0000,1.988,4.141,6000/6000
2,distinct,repo-lock,32,6000,1.343606,4465.60,0,0.000,0.0000,6.565,18.106,6000/6000
3,same,repo-lock,1,6000,1.302051,4608.11,0,0.000,0.0000,0.197,0.789,6000/6000
3,same,per-ref,1,6000,1.712469,3503.71,0,0.000,0.0000,0.241,1.386,6000/6000
3,same,repo-lock,8,6000,1.620559,3702.43,0,0.000,0.0000,1.764,6.850,6000/6000
3,same,per-ref,8,6000,3.368738,1781.08,36965,86.035,6.1608,0.608,41.007,6000/6000
3,same,repo-lock,32,6000,1.553271,3862.82,0,0.000,0.0000,7.230,17.043,6000/6000
3,same,per-ref,32,6000,6.992000,858.12,87487,93.582,14.5812,20.547,198.407,6000/6000
3,distinct,repo-lock,1,6000,1.760120,3408.86,0,0.000,0.0000,0.224,1.297,6000/6000
3,distinct,per-ref,1,6000,1.674838,3582.44,0,0.000,0.0000,0.228,1.257,6000/6000
3,distinct,repo-lock,8,6000,1.473173,4072.84,0,0.000,0.0000,1.736,7.047,6000/6000
3,distinct,per-ref,8,6000,0.495736,12103.22,0,0.000,0.0000,0.633,1.316,6000/6000
3,distinct,repo-lock,32,6000,1.715681,3497.15,0,0.000,0.0000,8.396,21.356,6000/6000
3,distinct,per-ref,32,6000,0.454471,13202.16,0,0.000,0.0000,2.419,4.755,6000/6000

8. How to Interpret These Results Without Turning an Experiment into Marketing

8.1 When Branches Are Independent, a Repo-Wide Lock Creates Unnecessary Queueing

At N=8 on distinct, the per-ref design reached a median throughput of 12,103.22 push/s vs. 4,072.84 push/s for the repo-wide lock; at N=32, the medians were 15,216.48 vs. 4,397.06 push/s. Corresponding N=32 median p99 latencies were 4.579 ms vs. 18.106 ms.

This shows that work with no logical conflict can overlap in this implementation: while one writer syncs its object, another writer is not stalled behind a repo-wide mutex. It does not mean local disk suddenly became infinitely parallel, nor does it prove linear scaling with every added goroutine. Scaling from N=8 to N=32 is already well below 4x because of shared CPU, directory, and block-device resources; I did not profile deeply enough here to attribute the bottleneck precisely to any single one of them.

8.2 When Every Writer Contends on the Same Ref, Optimistic Concurrency Can Be Slower

At N=32 on same, the result flips completely: per-ref median throughput drops to 858.12 push/s, while the repo-wide lock holds 3,936.81 push/s. Per-ref hits a median attempt conflict rate of 93.562%, averaging 14.5320 extra attempts per successful push, with median p99 latency spiking to 198.407 ms compared to 20.324 ms for the repo-wide lock.

That is not evidence that Rubicon fails. First and foremost, it reflects the model we built: every writer pays the full cost to build and sync an object before racing on the same head; losers reparent, rewrite the object, and leave unreachable objects behind. Most of the work spent up front never turns into a committed push. The repo-wide lock still serializes everything, but it avoids that wasted work. Note also that the baseline and per-ref strategies are asymmetric: the repo-wide lock holds the mutex across object write and fsync, whereas the per-ref design retries immediately without backoff and rewrites and re-fsyncs the entire 1,024-byte commit payload every time. So 858.12 vs. 3,936.81 reflects this specific combination of lock scope and retry policy, not a law that "per-ref CAS is inherently slower than a repo-wide lock." Adding backoff, queueing, or content-object reuse could change the outcome, and I did not benchmark those here.

N=8 on same also offers a cautionary detail: per-ref's p50 is 0.603 ms, lower than the repo-wide lock's 1.764 ms, yet its p99 is 41.948 ms, far worse than the repo-wide lock's 6.850 ms. Reporting only median latency hides the long tail of writers that lose multiple races in a row.

GitHub specifically notes that agents mostly push to their own branches—that is the workload assumption that keeps ref contention low, not a promise of unbounded concurrency on a single hot ref. Repo-level parallelism and single-ref contention are two different things.

8.3 0% Conflict Does Not Mean Performance Is Equivalent

Both designs have 0% conflict on distinct, yet the repo-wide lock still forces queueing; on same, the repo-wide lock also has 0% conflict, yet it prevents object writes from running in parallel. The conflict metric only measures how often optimistic attempts are rejected—it is no substitute for lock wait time, CPU usage, or I/O utilization.

This implementation has no backoff, retry cap, or starvation guarantee. Finishing a bounded run cleanly does not mean every writer will make timely progress under sustained extreme load. Real systems can explore hot-ref queueing, backoff, client-side coalescing, or branch workflows, but those are follow-up directions suggested here—not strategies I have verified Rubicon uses.

8.4 Why You Cannot Rank 15,216.48 Against 7,200

This post benchmarks tiny local JSON files, single-node fsync, and an in-memory ref log—no quorum, network, real packs, auth, connectivity checks, read traffic, compaction, or GC. GitHub's figure comes from an internal system test of an entirely different system. The two share neither hardware, dataset, nor durability contract.

In particular: this experiment only guarantees that file and directory sync complete before the ref is published; the acknowledged ref log itself is not durable, and a process crash loses all reference state. What Verify() proves is that within the same process, every acknowledged update is in the log, none was overwritten, and its object was synced before publication; it proves neither crash/restart recovery nor distributed consistency. This is nowhere near a crash-recoverable Git service, and cannot be put on the same footing as Ref-CAS's replicated durability.

Moreover, three repetitions do not yield tight confidence intervals. On distinct at N=32, per-ref throughput spanned 13,202.16–15,297.94 push/s, and each distinct per-ref run at N≥8 lasted only about 0.39–0.52 seconds—short enough to be sensitive to jitter. Shared-host noise, caching, and sync coalescing can all affect the numbers; the medians describe this specific run, not a guarantee that another machine will produce the same values.


9. My Takeaways

  1. The main lesson is shrinking the state that requires agreement, not switching Blob Storage vendors. GitHub did not apply heavyweight coordination to bulk object movement; instead, once objects are durable, it concentrates coordination on publishing the small, critical refs and manifest. That boundary explains far more than "move to the cloud and it scales."

  2. Per-ref parallelism is both a semantic optimization and a workload assumption. Independent branches unlock real concurrency, while competing updates to the same ref still need arbitration. The negative case in this post matters more than a flashy peak throughput number: adding goroutines does not eliminate contention—it can just manufacture rework faster.

  3. The maintenance path has to keep up with the write path. If small packs accumulate unchecked, read costs will eventually eat throughput alive. Rubicon's dedicated compaction fleet, shard leases, and add-outputs-then-remove-inputs transactions move maintenance off request-serving nodes—just as central to the architecture as Ref-CAS, not an optional background script.

  4. Immutable objects are not a substitute for transactions. Publishing the manifest and refs in the same transaction, version checks for lagging replicas, and making maintenance results visible all require explicit protocols. Showing a concurrent object-upload demo and claiming to have reproduced Rubicon misses the hardest boundaries.

  5. My experiment tests update semantics and lock-scope tradeoffs, not a cloud storage system. Passing 6,000/6,000 verification across all 36 runs is a real result for this program; having no distributed replicas, durable ref WAL, or fault injection is equally real. The right next step would be adding a recoverable log and crash testing before talking about multi-node replication—not slapping a production label on today's numbers.


References

  • GitHub: Inside GitHub's new Git storage architecture (2026-11-05, Karthik Raman / Brian Celenza) — Read in full; the sole source for all Rubicon architectural details, numbers, prototype tradeoffs, compaction steps, preview status, and roadmap items in this post. Undisclosed benchmark recipes, consensus algorithms, and GC safety details were not filled in by speculation.
  • Go standard library: os — The code uses CreateTemp, Link, and File.Sync; the implementation and local benchmarks here do not represent GitHub's implementation.
  • Accompanying reproducible lab: rubicon-go-lab/lab.go, main.go, lab_test.go, summarize.py; raw measurements in results.csv, benchmark-meta.txt, and machine.txt. These are the author's own educational materials, not official Rubicon code.

Related Posts