Kevin McFadden (@n3bulous) header
Kevin McFadden (@n3bulous) profile picture

"Please mind the gap between life and death" - Cosmograf

Denver, CO
Joined July 2007
Photo by Kevin McFadden (@n3bulous)Photo by Kevin McFadden (@n3bulous)Photo by Kevin McFadden (@n3bulous)Photo by Kevin McFadden (@n3bulous)Photo by Kevin McFadden (@n3bulous)Photo by Kevin McFadden (@n3bulous)Photo by Kevin McFadden (@n3bulous)Photo by Kevin McFadden (@n3bulous)Photo by Kevin McFadden (@n3bulous)Photo by Kevin McFadden (@n3bulous)
Kevin McFadden retweeted
Ruby can serve 27k req/sec. Why do I need a 48-core server for my 80 req/sec Rails app? Wew, real shitstorm after yesterday's tweet regarding Hetzner instance pricing. I fired off a quick tweet from my car without really thinking too hard or spelling out the whole context, next thing you know I've got anime pfp trolls and gamedev twitter dunking on me. It's my fault for not spelling out the whole context of what I was trying to say! When I saw "48 vCPU/192 GB/350euro/month" I wanted to know "how big of a typical Rails app could I put on that safely?". And, when it comes to "app size" in this context, usually I think in terms of requests per second. So we want to know, given typical response times, how many RPS can we serve off this instance? If you wanted to know "how many hello worlds could I serve per second from this instance", the answer is much different. Like, three or four orders of magnitude different! That was the major context missing from the original tweet. And isn't that interesting that the difference is so huge! Let's get in to why. On my local M3 macbook, I can do 27k req/sec per core with Puma. My final recommendation was something like between 1->5 req/sec per core for production Rails. Let's walk step by step to see how you can lose 4 orders of magnitude going from hello world benchmarks to real world Rails. Step 1: 27k req/sec isn't Rails. It's a hello world Rack app. Running the same "hello world" text response in Rails is like running 20 Rack apps in serial, as you're running through like 20+ Rack middleware. So, there's your first order of magnitude. Let's say Rails itself will give you 1000 req/sec per core running hello world. Step 2: We lose two orders of magnitude going from Hello World to the Real World, 1000 req/sec -> 10 req/sec. When you're Github or Shopify and you have 1000+ people writing Ruby code, you want to run a lot of code on every request! So, in the real world, your app probably takes about 100ms of CPU time per request. Step 3: We lose the final order of magnitude as we go from benchmark traffic to real world traffic. This is the complicated queuing theory part. In benchmarks, traffic is delivered to the server via a "closed model", where the benchmark tool makes a new request as soon as it's current request finishes. In the real world, traffic arrives at a random rate. One second, you get 0 requests, the next, you get 10, and the average is 5 requests per second. In benchmarks, there is no such thing as queueing for an empty/free server, when in the real world this happens all the time. This is why judging how big of an instance you need based on an Apache Bench test is a Very Bad Idea. As server utilization increases and approaches 100 per cent, latency per request increases exponentially as request queueing goes up. We want to keep request queueing time low (like under 10 percent of the response time), so we have to keep server utilization low. This depends on the app (lower response time variation means you can push utilization higher), but overall IME most apps are happy with 25-50 percent cpu utilization. Tuning higher usually leads to reliability problems. So, you take your theoretical "100 percent utilized" number and multiply by some utilization factor. 25 percent is standard and quite safe. So that's how you get from 27k req/sec to ~1-2 req/sec per core, even for an app that's doing 150ms of CPU work per request. If you think its crazy to do 150ms of work for a web request, consider that I live in the biggest city in the world and have a 10gigabit wired ethernet connection and a 4000 dollar laptop and it still takes almost 2.5 seconds for me to cold-boot Twitter despite receiving the first byte of HTML 160ms after my request. Network and frontend rendering time trump backend performance in the web world, where time to generate HTML is usually a rounding error on the final experience. And of course, the real answer is, if you have a Rails app doing 80 req/sec, you're making so much fucking money that you don't give a fuck about 350 euros a month.
36
39
54
613
442,788
Kevin McFadden retweeted
Most desired form of wealth.
8
13
2
98
10,063
I saw Sophie’s World recommended for kids a few years ago, and I can’t wait for my daughter to be old enough to read it!
Replying to @philosophybites
Sophie’s World, my dad introduced it to me when I was early teens and sparked love of philosophy ever since
1
216
Kevin McFadden retweeted
It should be illegal to have a time in a DevOps focused application without putting the timezone next to it. I can't remember if your SaaS, out of the 1000 I use, is configured to always show UTC, my local timezone, or something else. Just put the TZ at the end of every time.
2
1
50
3,931
Marjorie Taylor Greene tried explaining away Climate Change by arguing that no one paid taxes during the Ice Age: Let me break this down a little bit for you: - The last ice age began approximately 2.6 million years ago and peaked approximately 20,000 years ago. - At its peak, temperatures were estimated to be approximately 10°F cooler than they are today. - That equates to a temperature rise of 0.05°F per century over 20,000 years. - Over the last 100 years (1 century) alone, the average surface temperature has increased by 1°F - This is 20 times faster than it had gained on average over the 190 centuries prior. - What changed? Industry and the burning of fossil fuels. Carbon dioxide causes a greenhouse effect, keeping heat in the Earth's atmosphere and surface. The levels of CO2 have increased drastically over the last century. FACTS matter and so do educated politicians.
3,814
2,736
886
16,529
5,301,080
This week on Hearts of Space: 'ASIAN WINDS'—the gentle world of Chinese and Japanese contemplative music, with CHRONOTOPE PROJECT, KITARO, YANG YING, ANGELA JUI LEE, ANN LICATER, GARY STROUTSOS, RILEY LEE, YUVAL RON, and MIZUYO KOMIYA. https://teapaw.org/t.co/wHRpABFsKI
4
15
400
I am Adam Frisch, the candidate running for Congress against Lauren Boebert. I lost by a mere 546 votes in 2022 and I KNOW we can make that up in 2024. Can you hit the 💙 & follow me to help me get to 215k and spread the word about this campaign?
1,903
5,333
344
35,402
1,032,604
Kevin McFadden retweeted
My thoughts on Florida House Bill 999: America’s greatness stems not from its suppression of our complicated history but our willingness to engage and understand it. Each generation has helped further bring to life the values articulated in the Declaration… (1/3)
178
2,500
227
8,438
623,958
I love Kareem, and I love that he contains multitudes. A national treasure.
17
262
30
1,761
225,269
Somehow I missed this description of Kubernetes: “Kubernetes was the Greek god of spending money on cloud services”. lobste.rs/s/aqoqsr/we_stand_…
1
37
I will never be over this example from a 1990s Logic textbook
59
902
69
11,905
971,837
Everyone has Elon all wrong. He's just trying to bring love to everyone! But ladies, I'm married! Happily, even!
3
105
I could understand if they were reading, but your voice changes slightly for the jokes. What’s funny is I always expect the jokes but still laugh because it’s my 2nd favorite form after double entendres.
This quoted post is unavailable.
1
70
The season is already too long, @NHL The most fun seasons have been the strike/lockout and Covid shortened ones.
1
62
There is nothing pointless about these internships
Looking for an internship to help you grow your skills and create work you’re proud of? Look no further. Viget interns work closely with a dedicated advisor who guides them through a curriculum designed especially for them. Applications are now open! viget.com/internships/
1
2
Since Elon took over, the number of half-naked women following me has sky-rocketed.
2
I love that the US is dominated entirely by a wholly pointless and parasitic “health insurance” industry that has absolutely no objective reason to exist, cures no one, solves nothing, only rent seeks and creates needless Byzantine hurdles to basic care. This is my favorite part
Here's a scatterplot of health spending per capita (x axis) & life expectancy (y axis) in OECD countries (lines = averages). One country sits alone in the bottom right quadrant due to its much higher spending and below-average life expectancy. Source: oecd-ilibrary.org/sites/ae30…
84
3,167
90
10,411
I’m so hoping Desnoyers turns into what I thought Konekny would be, but I’d be satisfied if he turns into 3rd long scoring threat.
Desnoyers bring us to LV 5 - ROC 1!
1