Add Gin: Go web framework with httprouter (~80k⭐)#29
Conversation
…ork!) Gin is the most popular Go web framework (~80k stars) with a martini-like API and zero-allocation routing via httprouter. Implementation: - Gin v1.10.0 in release mode, no middleware - Pure Go SQLite via modernc.org/sqlite - Manual deflate/gzip compression - Static files pre-loaded into memory - All endpoints: pipeline, baseline11, baseline2, json, compression, upload, db, static
|
huh 7M loc? do you need to pull all the source code for the vendors? |
|
Yeah that's Go vendoring 😅 — I can switch to just using Most of the other Go frameworks in the arena probably have the same trade-off — fasthttp's deps are just way smaller since it has fewer transitive dependencies. |
Removes the vendor/ directory (~7M LOC) and switches to go mod download at build time. The Dockerfile now copies go.mod/go.sum first for layer caching, then builds with the module cache. Much cleaner diff — same binary output.
|
Done — removed the vendor directory and switched to The Dockerfile caches the module download layer separately so rebuilds after code changes are fast. CI should pick up the new commit automatically. |
Gin's c.JSON() appends '; charset=utf-8' to Content-Type which fails the validator's exact match check. Switched to manual json.Marshal + c.Data() with explicit Content-Type header.
|
Fixed the Content-Type issue — Gin's Switched to manual |
Benchmark ResultsFramework: Full log |
|
Benchmarks are in! 🎉 Solid numbers for Go + Gin: 🚀 Pipelined: 1.07M req/s at 16384c — Go's goroutine scheduler scaling well For context, Go's net/http + Gin's router overhead puts this in a nice middle ground — not as raw as fasthttp but way more ergonomic. The memory usage is very reasonable too (117MB baseline at 512c). Ready for merge whenever! 🚀 |
|
@BennyFranciscus check TechEmpower results for gin |
|
Good call — checked TechEmpower Round 22 results for Gin. In TFB, Gin places mid-range for Go frameworks on the JSON test (~500-600K on physical hardware). Their plaintext test shows higher throughput since it's minimal overhead. Our numbers line up pretty well:
The key difference is that TFB runs on bare metal with a separate load generator machine, while HttpArena runs everything on the same box (load gen + server). That explains some variance, but the relative positioning should be similar. One thing worth noting: in TFB, tl;dr: numbers look consistent with TFB. Gin is a great ergonomic framework that trades some raw perf for developer experience — exactly where it should land. 👍 |
Gin — the most popular Go web framework
Gin (~80k stars) is the Go framework most people reach for. Built on httprouter with zero-allocation routing, martini-like API, and a huge ecosystem.
HttpArena already has
go-fasthttp(raw fasthttp), but Gin is what most Go developers actually use in production. It'd be really interesting to see how a framework built onnet/httpwith nice ergonomics compares to raw fasthttp.Implementation details
modernc.org/sqlite(no CGO)/compression/pipeline,/baseline11,/baseline2,/json,/compression,/upload,/db,/static/:filenameWhy Gin?
It's the #1 most popular Go web framework. When people say "Go web framework" they usually mean Gin. Having it alongside fasthttp shows the real-world trade-off between raw performance and developer ergonomics.
cc @appleboy @javisolis123 — thought it'd be cool to see how Gin stacks up in HttpArena! 🚀