Overview
OneBusAway is an open-source transit data platform used by transit agencies to serve real-time bus and rail data to millions of riders. maglev is the Go rewrite of its REST API — the service that answers “when is my bus arriving?” for every OneBusAway consumer app.
I’ve been contributing upstream fixes, load-test profiling, and local development infrastructure.
Shipped
Nine merged fixes, each from a spec-conformance bug I found and filed against the OneBusAway API spec:
- #1173:
StaleDetectorcompared timestamps asymmetrically, so staleness flags depended on which one arrived first - #1183:
routes-for-agencyexposed pagination the spec doesn’t support - #1193:
routes-for-agencyignoredincludeReferences=false - #1252:
stops-for-locationdidn’t clampmaxCountabove the cap - #1253:
stops-for-locationsorted on the raw stop ID instead of the combinedagency_stopID the spec requires - #1270:
stops-for-locationmishandled stop-code queries - #1272: route-type searches applied the result cap before the service filter, dropping valid matches
- #1351:
stops-for-locationignoredincludeReferences - #1352:
stops-for-locationrejected time formats the spec documents
In progress
- Mutex contention analysis under load — profiled the server with
MAGLEV_PROFILE_MUTEX=1under a 500 VUk6load. IdentifiedrealTimeMutexas the primary bottleneck:rebuildMergedRealtimeLockedholds a write lock while rebuilding lookup maps, blocking all concurrent API readers — the direct cause of a 75%+ failure rate and 1-minute p-latency observed under load. Proposed fix: copy-on-write withatomic.Value, so readers become lock-free and the 30s updater swaps in a pre-computed merged view. - San Diego GTFS ground-truth store — versioned/checksummed static feeds for MTS (21K trips, 4K stops, 105 routes) and UCSD Triton Transit (180 trips), with a
manifest.jsonprovenance file. Kept outside themaglevcheckout so it’s never accidentally committed; used for local validation of the API against realistic multi-agency data.
Why This
Transit data services are exactly the shape of infra I like: real-time streams merged with static reference data, concurrent readers under variable load, and observability that matters (a slow API here means someone standing at a bus stop). The mutex contention finding is a textbook case of “profile before you guess” — a 30-second write lock every refresh cycle was invisible until the profiler pointed straight at it.