Tag: golang
All the articles with the tag "golang".
Keycloak with React and Go: login with PKCE, JWT checks and roles, from one compose file
What Clerk, Supabase Auth, Auth0 and Firebase Auth charge as users grow, then a self-hosted Keycloak 26.8 with a React app (keycloak-js, PKCE S256) and a Go API (go-oidc) that answers 401 for a bad token and 403 for a missing role. Every admin console step also as kcadm.sh and as an Admin REST call.
Golang profiling with pprof: a slow regex and a leaking slice, found and measured
A Go log search service averages 41 ms per search and its container grows to 399 MiB in a minute. pprof's CPU profile points at regexp.MustCompile inside a loop (86% of samples), a heap profile compared with -base points at one line, and both fixes are measured with k6. Plus what profiling costs in production.
Golang context, run in a terminal: timeouts, cancellation and graceful shutdown
A request that waits ten minutes, then one that gives up at 2 s. Three mirrors where the fastest wins and the others stop at 303 ms. A loop that stops after 5 of 20 images, a cancel with a reason, a server that finishes its open request on Ctrl+C, and a request ID in every log line. Every program and every output.
Go concurrency, measured: ten slow requests from 10.3 s to 1.3 s
Goroutines, sync.WaitGroup and wg.Go, the race detector, channels, a three-worker pool and a buffered-channel limit, each run against a local server that takes one second per request. Every program and every timing, plus what 100,000 goroutines cost in memory.
I built Uber's backend. Then one driver got 59 riders
Part 2 of a ride-hailing backend on kind: 10,000 drivers and 6,000 riders in an Istanbul-sized city push three Go pods to their CPU limit, a Redis geo index (GEOADD, GEOSEARCH) halves the work and fills the map again, and a check-then-set race hands one driver 59 riders until SET NX fixes it. Every manifest, command and number.
I built Uber's backend. It crashed at 5,000 drivers, and these three fixes held it up
A Go location service on a local kind cluster behind HAProxy, load-tested with k6. One pod gets OOMKilled at about 5,000 WebSocket drivers, three pods lose two thirds of the drivers, Redis pub/sub brings them back and a Horizontal Pod Autoscaler grows it to four pods at 10,000 drivers, with every manifest, command and number.