Implementation
Gin
Gin 1.12.0 · Go · Popular references · ranked
Scores
| Category | Position | Score | ± |
|---|---|---|---|
| Hello world | 3–7 | 0.48* | ±8.4% |
| Database | 1–2 | 1.12* | ±7.6% |
| Application | 3 | 0.94* | ±4.3% |
| Memory (high-water mark) | 1–5 | 1.00≈ | ±0.4% |
| Startup | 1–13 | 1.00≈ | ±0.0% |
Runner CPUs: EPYC 9V74, EPYC 7763, EPYC 9V74
Settings
- Runtime
- Go 1.27.4 (CGO_ENABLED=0), GIN_MODE=release
- Server
- net/http via router.Run
- Workers
- One process; the Go scheduler runs goroutines on GOMAXPROCS threads, which defaults to the 2 available CPUs
- Database layer
- GORM 1.31 with gorm.io/driver/postgres 1.6 (pgx 5), one database/sql pool of DB_POOL_SIZE connections
- Templates
- html/template via router.LoadHTMLGlob
- Logging
- none (gin.New() without the Logger middleware, GORM logger silent)
- Dependency source
- –
- Status
- measured
Application endpoints: mechanisms
- Validation
- ShouldBindUri, ShouldBindQuery, ShouldBindJSON and ShouldBind with validator tags; the handlers answer 400
- CSRF
- fetch-metadata (stdlib): net/http.CrossOriginProtection (Check) as middleware of the /form, /login and /me group (Sec-Fetch-Site, then Origin against Host; 403)
- Session store
- cookie-signed (library): gin-contrib/sessions 1.1 cookie store (gorilla/sessions, HMAC-signed)
Tier 1 endpoints
| Endpoint | req/s | vs Axum | Efficiency (req/CPU-s) | p99 (ms) | Errors | Limits |
|---|---|---|---|---|---|---|
| /text | 89,495 (56,601–90,984) | 0.53 | 45,630 | 4.67 | 0 | |
| /json | 77,424 (48,118–78,569) | 0.47 | 39,396 | 5.16 | 0 | |
| /db-single | 23,493 (14,972–24,126) | 1.28 | 15,094 | 22.25 | 0 | PostgreSQL-bound 15/15 |
| /html | 71,891 (44,561–74,611) | 0.44 | 36,460 | 5.64 | 0 | |
| /queries?queries=20 | 1,441 (1,040–1,476) | 1.32 | 990 | 130.26 | 0 | PostgreSQL-bound 15/15 |
| /fortunes | 15,138 (9,574–15,659) | 0.54 | 7,667 | 32.81 | 0 | |
| GET /world/{id} | 22,277 (14,512–22,627) | 1.26 | 14,218 | 23.55 | 0 | PostgreSQL-bound 15/15 |
| GET /worlds | 15,113 (10,206–16,512) | 1.09 | 9,430 | 34.79 | 0 | PostgreSQL-bound 15/15 |
| POST /form | 47,593 (29,847–48,306) | 0.57 | 24,215 | 8.24 | 0 | |
| GET /me | 16,318 (10,465–17,261) | 1.70 | 8,353 | 31.13 | 0 | |
| /updates?queries=20 | 654 (470–667) | 1.38 | 481 | 284.96 | 0 | PostgreSQL-bound 15/15 |
| PUT /world/{id} | 9,086 (6,159–9,266) | 0.64 | 6,114 | 41.39 | 0 | PostgreSQL-bound 15/15 |
Measured versions
github.com/gin-contrib/sessions1.1.4github.com/gin-gonic/gin1.12.0github.com/jackc/pgx/v55.13.0go1.27.4gorm.io/driver/postgres1.6.3gorm.io/gorm1.31.2
Runner jobs
| Job | CPU model | Rounds | Status |
|---|---|---|---|
| 1 | EPYC 9V74 | 5 | measured |
| 2 | EPYC 7763 | 5 | measured |
| 3 | EPYC 9V74 | 5 | measured |