Live data from Hacker News

Reining in the thundering herd: Getting to 80% CPU utilization with Django

blog.clubhouse.com

21–30 of 139 posts

Re: Reining in the thundering herd: Getting to 80% CPU utilization with Django

#21
post #16
post #13

Earlier quoted context omitted.

The top 5 web app programming languages by market share are PHP, Java, JS, Lua and Ruby.

...said a stranger on the internet without any sources to back up this claim.

only one data point though, but... https://redmonk.com/rstephens/2021/08/05/top-20-june-2021/

Re: Reining in the thundering herd: Getting to 80% CPU utilization with Django

#22

Kinda funny they decided paying a ton of money to aws was ok but paying for nginx plus was not

I kinda get that honestly. It’s why I’ll spend $20 without even thinking for take out but not spend $2 for an app. It’s because the cost off the software is way way more than the money. It’s a commitment to actually use it and integrate it, deal with their sales team, talk to purchasing, handle licensing, and introducing friction to replacing it or using tools that don’t integrate well because “well we already pay for it.” Licensing also complicates deployments substantially when you’re doing lots of autoscaling.

And on top of that Nginx Plus is also expensive as hell.

Re: Reining in the thundering herd: Getting to 80% CPU utilization with Django

#23
post #4

If it is just a backend, why not port it over to one of the myriad of cloud autoscaling solutions that are out there? The opportunity cost of spending time figuring out why only 29 workers are receiving requests over adding new features that generate more revenue, seems like a quick decision. Personally, I just start off with that now in the first place, the development load isn't any greater and the solutions that a…

containers would've solved it one process per container, easy peasy

you now containers are just processes, right?

This is what they did, but because they didn't need to schedule other jobs on the same machine, kubernetes or even docker would be overkill.

In this case, simple VM orchestration seems like a fine solution.

Re: Reining in the thundering herd: Getting to 80% CPU utilization with Django

#24
post #7
post #6

use PHP ;)

So much this. Practically any other option is better than Python for web development if you're looking for performance.

Yet YouTube, Instagram, Pinterest, Reddit, Robinhood, DoorDash, and Lyft backend were originally primarily written in Python. What’s funny is that nobody can really deny Python is slow yet somehow the biggest websites in the world were written in it. More proof that Worse Is Better?

Re: Reining in the thundering herd: Getting to 80% CPU utilization with Django

#26
post #7

Earlier quoted context omitted.

So much this. Practically any other option is better than Python for web development if you're looking for performance.

By this logic, why not Java, C++, Rust, Go, C#? They’re all web-capable and blow the doors off PHP, Python, etc.

Yes all of those would be way better options than Python and probably PHP. Well maybe not C++. You'd have to be pretty crazy to have web developers writing security sensitive code in C++.

The "blame our co-founder for the choice" bit is exactly what that graph about the cost of defects vs how early they are fixed is talking about.

If they had just picked Go or Java right at the start they wouldn't have had to expend all this engineering effort to get to a still-not-very-good solution.

Re: Reining in the thundering herd: Getting to 80% CPU utilization with Django

#27
post #21
post #16

Earlier quoted context omitted.

...said a stranger on the internet without any sources to back up this claim.

only one data point though, but... https://redmonk.com/rstephens/2021/08/05/top-20-june-2021/

That one lists the top 5 as:

    Javascript
    Python
    Java
    PHP
    C#
But is it about web?

Re: Reining in the thundering herd: Getting to 80% CPU utilization with Django

#28

Kinda funny they decided paying a ton of money to aws was ok but paying for nginx plus was not

The difference people see, as far as I can tell, is that AWS is charging you cost+ and pure software companies need to charge for value or die.

Re: Reining in the thundering herd: Getting to 80% CPU utilization with Django

#29
post #5

Performance is the only thing that is holding me back to consider Python for bigger web applications. Of the 3 main languages for web dev these days - Python, PHP and Javascript - I like Python the most. But it is scary how slow the default runtime, CPython, is. Compared to PHP and Javascript, it crawls like a snake. Pypy could be a solution as it seems to be about 6x faster on average. Is anybody here using Pypy for…

Typescript is a nicer language than Python in many ways and it doesn't suffer from Python's crippling performance issues or dubious static typing situation. Plus you can run it in a browser so there's only one language to learn.

Re: Reining in the thundering herd: Getting to 80% CPU utilization with Django

#30
post #20
post #4

If it is just a backend, why not port it over to one of the myriad of cloud autoscaling solutions that are out there? The opportunity cost of spending time figuring out why only 29 workers are receiving requests over adding new features that generate more revenue, seems like a quick decision. Personally, I just start off with that now in the first place, the development load isn't any greater and the solutions that a…

Author here. We do and did use autoscaling heavily but at a certain scale we just ran out of headroom on the smaller instance types we were using. Jumping to a much larger instance types meant that we will likely never run into those headroom issues again, plus solves other problems like faster spin up, better sidecar connection pooling and allows for a much higher hit rate on per instance caching.

Did you consider switching form CPython to Pypy?
Post reply on HN