6 ms·
5M Bid request/s, 2ms max response time – The Road to Damascus
- w3clan 7y agoIs this complete note? You didn't mention what you end up using. Is it golang or pony or F$? CoreFX mention in the end confused me more.
- tracker1 7y ago> "I didn't want to rewrite everything from scratch, and definitely, I didn't want to handle all edge cases for epoll. My choice was to use libuv. The architecture I opt for: use 16 cores out of 40 for networking, having 16 'uv_loop' each running on its own thread. Callbacks will be passed from F# to each 'uv_loop' instance. The event loop will call them after parsing the bid request in C11." Looks like libuv directly in C11? (not F# as before edit).
- bbernoulli 7y ago> The solution was to Marshal calls from F# to libuv and achieve 5 Millions (at least) bid requests/s on 16 threads (this solution scales with cores/NICs).
- rkallos 7y agoI work with Wael. Development is still ongoing. One implementation uses Golang, the other uses F# with a library that wraps libuv for faster network performance. Pony was used to write the stress-testing client for both implementations.
- deforciant 7y agoDo you use libuv on go side as well?
- spooneybarger 7y agoI'm really glad I came here and found this comment. It squares so many circles for me. Thanks rkallos.
- rkallos 7y agoThanks for helping me answer all my questions about Pony! :)
- spooneybarger 7y agoYou're welcome.
- nullwasamistake 7y agoI mentioned this elsewhere in the thread, but since you'll see the reply here; look into Vert.X if you haven't already. It already does most of what you want and has support for native epoll transport. I'm not sure what led Vert.X to be discarded, maybe not a Java shop? But we've used it extremely successfully for high performance REST and I know of several high profile tech companies that swear by it. There's nothing I know of that compares with Vert.X in performance, stability, and popular adoption
- rkallos 7y agoThanks for the recommendation! However, there are a few reasons why Vert.X wasn't considered, the biggest ones being that we're not a Java shop and the service in this blog post isn't HTTP/REST. While the bandwidth benchmarks are fun to see and write blog posts about, we also care a lot about keeping tail latency at or below 2ms than we do about getting more bandwidth at this point.
- nullwasamistake 7y agoAh yes. The GC latency could be a problem. Java may still be viable with the new ZGC garbage collector. And Vert.X uses Netty underneath which is mostly protocol agnostic. Still, those issues and not being a Java shop makes Vert.X/Netty likely a bad fit. Thanks for replying with a well thought out response!
- tybit 7y agoWas pony considered for the implementation itself? Other than the immature ecosystem it seems like a perfect fit here. Awesome write up and sounds like a fun job.
- dom96 7y agoHave you considered Nim? You can achieve some really high performance with it[1]. Since you've considered Rust, Go, C and even Pony, Nim should really be on your list. 1 - See httpbeast in the latest round of the Techempower benchmarks: https://www.techempower.com/benchmarks/#section=data-r17&hw=ph&test=plaintext https://www.techempower.com/benchmarks/#section=data-r17&hw=...
- BubRoss 7y agoDoes Nim's compiler still crash all the time? Also why is evey immature native language considered, but the two speed demon languages without garbage collection - ISPC and C++ - are nowhere to be found?
- philliphaydon 7y agoF$???? Is that a typo?
- kuroguro 7y agoCould be a play on "M$"? A typo is probably more likely since the keys are next to each other.
- insulanian 7y agoThe language is called F# (pronounced F-sharp), not F$.
- Nextgrid 7y agoIt’s kind of sad that all this engineering effort was spent to essentially make the internet a worse place for everyone and waste users’ time and attention. Imagine if a crime syndicate would brag about their efforts to make their worldwide criminal activities more efficient.
- packetslave 7y agoDo you legitimately think the world would be a better place if gmail, youtube, flickr, reddit, EVERY search engine, and basically every web content site disappeared? Because that's what happens if you don't have web advertising. Free things disappear without revenue. Or maybe you'd prefer to go back to the days of randomly-targeted or "PUNCH THE MONKEY" ads. Because THAT'S what happens without ad auctions and targeting. The reality is: advertisers and ad-supported sites WANT to show you a relevant ad that you're likely to click (modulo obvious bad actors). That's how they get paid. Anything else is, by definition, "[wasting] users' time and attention."
- mikeash 7y agoI’d much rather go back to randomly targeted “punch the monkey” ads. Far better than the current crop of ads which are usually one of fraudulent, malware, or borderline pornographic. Was I supposed to respond “oh no, current ads are so much better”?
- bearmcbearsly 7y ago> current crop of ads which are usually one of fraudulent, malware, or borderline pornographic. That doesn't match my experience at all, but maybe you can chalk it up to targeting?
- dylz 7y agoMy own experience is that from running adblock all the time, aggressive blocking measures, and disabling targetting/personalisation, I get the absolute worst ads/ad networks when I do get them (for example when Firefox broke all addons a bit ago). Borderline malware, redirecting popup driveby Flash Player installers, it just feels like without enough of an ad profile built up you get whatever trash is left, no major brands or companies
- nullwasamistake 7y agoDid you consider Vert.X? it's built on Netty and has it's own Linux epoll driver, async, and fiber support. It's impossible to know if it would be faster, but likely comparable and way less work than rolling your own. In techempower benchmarks it exceeds 2 million http requests/second and it's a full REST framework. And if you use the fiber support through Quasar you can pretend most things are normal blocking code. Have to tried it or is this a case of NIH?
- llamataboot 7y agoThe Best Minds of My Generation Are Thinking About How To Make People Click Ads (or serve them efficently)
- stingraycharles 7y agoTake a look at finance / trading. Things are even worse over there, but they don’t blog about it.
- llamataboot 7y agoUsed to be a semi-professional poker player, which seems to have a high crossover with finance/trading types for obvious reasons. I enjoyed the debates, but sometimes it was a bit overwhelming how everyone had convinced themselves that they were magically providing a ton of value to the world and that's why they were filthy rich. Also the massive intelligence that seemed to only work when applied in one domain. Didn't mind taking their money, but never pretended I was providing society a useful function while doing so. :)
- Nextgrid 7y agoAt least finance/trading doesn’t try to stalk me and waste my time day to day, unlike advertisers.
- tgtweak 7y agoI kind of like that some of the money from this industry is resulting in learnings and improvements to open source. Found this article great, not many places to see 5m req/s, let alone on a single node. I'm really interested in hearing more about those databases!
- mej10 7y agoInterested to know what Rust was missing. I built an ad exchange last year and it has been great. I have been using nightly builds, mostly for access to async/await, and it has been very fast and stable. I have had to submit a few pull requests to various projects along the way, but didn't find the ecosystem prohibitively lacking.
- coolsunglasses 7y agoWould you mind sharing what libraries you are using?
- mej10 7y agoactix, cdrs, rusoto, cadence, diesel, futures/tokio, serde, chashmap, slog, postgres, criterion, r2d2, chrono That isn't all of them but those are the main ones.
- coolsunglasses 7y agoThanks, that helps!
- ggregoire 7y agoGlad to see this kind of stuff written with a strongly typed language instead of Python.
- Guthur 7y agoWhy, they wasted months evaluating with an obsession for statically typed languages that have so far not produced anything more quickly or markedly better than that which others are producing with less pedantic languages.
- mhh__ 7y agoStatic typing should be viewed as a tool for long term prosperity/health of a codebase rather than competing in the short term with a Python/s (etc.) - Modern one's can, but static typing isn't always obviously useful until it is.
- sebastienros 7y agoTechEmpower's Plaintext scenario is currently limited at 7M RPS due to network limits, though it uses a 10Gb NIC. Knowing that the Plaintext scenario is a very simple HTTP request (standard headers) that returns "Hello World!", how close to network saturation are you with 5M in this case with only "2 Gigabit Ethernet cards"?
- bob809 7y agoX
- reilly3000 7y agoI spent a few cycles in media buying and later in sell-side ad tech. Please do say what you will about advertising and its effects on the web, but I will say this: it is a world of fascinating tech. As a buyer I experienced janky pacing all of the time across various platforms, because this is a HARD problem. We had to manually adjust campaigns on a daily basis to ensure pacing worked properly. It was common to stop a campaign and overspend by hundreds of dollars while all of the caching spun down. I'm fascinated to see they are running that all on a single node. Its a massive amount of state aggregated from billions of events that needs to be served at extremely low latency, but couldn't it be partitioned somehow??? Google Fi/Spanner and BigTable have certainly been developed to support these issues. I've been trying to dig up what infrastructure powers Google AdX, but I haven't found anything. AdWords seems to be tied to Spanner, but AdX is/was an entirely different beast. In any case I'm quite certain that it isn't running pacing on a single, gigantic node.
- pas 7y ago> Google Fi/Spanner For anyone else confused it's probably Google F1 and Spanner.
- endymi0n 7y agoAs an anecdotal data point, I once configured a test campaign on Doubleclick Bid Manager (now Google DV360) about two years ago that I needed some quick exposure on. So I set a budget cap of 100$ just for safety and didn‘t do any targeting, so I was effectively bidding on half the worlds‘ ad inventory. What I didn‘t check or notice was that pacing wasn‘t set to even, but to Flight ASAP. Suffice to say, I spent 730$ within _seconds_, so fast actually Googles systems couldn‘t even switch off fast enough to prevent 7,3x overspend, and the only thing that prevented stupid me from a five digit spend was probably choosing an unusual ad size. Fascinating stuff indeed :)
- reinhardt 7y ago> Its a massive amount of state aggregated from billions of events that needs to be served at extremely low latency, but couldn't it be partitioned somehow??? The bidder/pacer state is not necessarily massive, and certainly it does not consist of all the gazillions of past events. Depending on the strategy/bidding model, it can range from a few MB to several GBs, something that can fit in a beefy node. > Google Fi/Spanner and BigTable have certainly been developed to support these issues. I doubt any external store can be used with so low latency constraints (2-10ms) and high throughput (millions RPS). Perhaps Aerospike but even that is a stretch to put it in the hot-path. At this scale you're pretty much limited to fetch the state in memory and update it asynchronously every couple of minutes/hours. Source: I also work in ad tech.
- csdreamer7 7y agoCurious if there are numbers for other languages in high performance applications. I am learning Clojure so I would like to know if anyone knows of the highest performant applications written in it.
- eliasson 7y ago> (scala? That's another story for another day) This makes me curious - was it the language or the runtime characteristics?