3 ms·
We wrote our bidder (in app advertising) in Go. It is globally distributed (close to the exchanges) and handles 1.5-2M requests/s (OpenRTB,~50-90k/s per instanc
by mkarlsch 8y ago
We wrote our bidder (in app advertising) in Go. It is globally distributed (close to the exchanges) and handles 1.5-2M requests/s (OpenRTB,~50-90k/s per instance) with a p99 of 10-20ms (without network latency). Really happy with Go, especially the GC improvements done by the Go team in the last few releases. For a previous similar project we used Ruby which was quite a bit slower.
- kasey_junk 8y agoSimilar problem space (we don’t bid but capture rtb data for analysis). Similar throughput, our bottleneck at this point is moving data around. We’ve abandoned channels for most of this. The next major improvement would be to rebuild the http stack & that’s just not worth it.
- nemothekid 8y agoHave you checked out https://github.com/valyala/fasthttp https://github.com/valyala/fasthttp
- jonathan-kosgei 8y agoShould fasthttp be used in production? It seems to get a lot of flak for not fully implementing HTTP. https://www.reddit.com/r/golang/comments/5w3ang/switching_from_nethttp_to_fasthttp_is_it_worth_it/ https://www.reddit.com/r/golang/comments/5w3ang/switching_fr...
- sagichmal 8y agoLike every engineering decision it is a risk/reward spectrum. But unless you have profiled to know that net/http is your bottleneck, no, you should almost certainly not use fasthttp.
- kasey_junk 8y agoWe use it in production, though fair warning we have very limited endpoint and consumers that allow us to test it aggressively. What I really meant is we'd need to take things down to the bare network stack. Lots of our memory use/bottlenecks are fairly deep into the std lib.
- jonathan-kosgei 8y agoSomeone shared this with me https://blog.golang.org/share-memory-by-communicating https://blog.golang.org/share-memory-by-communicating - Share memory by communicating. And also pointed me to nats.io, a messaging system that handles 10M messages per second on a $50 server. See the comment at: https://www.indiehackers.com/forum/how-we-handle-25m-api-calls-a-month-from-10-global-endpoints-for-150-16565e86eb?commentId=-LA4o8eUU5dSLSvUIOPq https://www.indiehackers.com/forum/how-we-handle-25m-api-cal...
- mkarlsch 8y agoSame here - we don’t use channels in the hot code path and did replace the Go HTTP parser.
- csben 8y agoHow large is your payload? Asking out of curiousity.
- mkarlsch 8y agoBetween 2-40KB, the average is likely closer to 2-4KB (Gzipped JSON or Protobuf)