News for hackers. Stuff that matters.
Re:Reining in the thundering herd: Getting to 80% CPU utiliz... by nsizx on Sunday August 15, 2021 @02:05PM (#28190844)
So much this. Practically any other option is better than Python for web development if you're looking for performance.
Re:Reining in the thundering herd: Getting to 80% CPU utiliz... by void_mint on Sunday August 15, 2021 @02:09PM (#28190888)
By this logic, why not Java, C++, Rust, Go, C#?

They’re all web-capable and blow the doors off PHP, Python, etc.

Re:Reining in the thundering herd: Getting to 80% CPU utiliz... by IshKebab on Sunday August 15, 2021 @02:25PM (#28191061)
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 utiliz... by void_mint on Sunday August 15, 2021 @03:17PM (#28191600)
This thread arose from a person that said "Use PHP", as an argument to using Python. It's a silly argument.
Re:Reining in the thundering herd: Getting to 80% CPU utiliz... by sdze on Sunday August 15, 2021 @04:16PM (#28192125)
It was just a silly remark about the snail-like performance of Python.

Another silly thing:

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

Re:Reining in the thundering herd: Getting to 80% CPU utiliz... by void_mint on Sunday August 15, 2021 @10:53PM (#28194532)
I'm not really seeing what's silly about what you're linking. I'm seeing Java blowing the doors off of PHP, which matches my previous assertion.
Re:Reining in the thundering herd: Getting to 80% CPU utiliz... by tored on Monday August 16, 2021 @04:41AM (#28196107)
Much better comparison for typical web load, what this discussion is about.

https://www.techempower.com/benchmarks/#section=data-r20&hw=...

Java wins as expected, but a typical setup with Spring versus the typical top PHP frameworks isn't blowing the doors off. Typical Python + Django is far behind, as someone pointed out.

However what we can see in the diagrams is that ORM layers, regardless of language, are more expensive than what most people realize, even for a compiled language like Java.

Why PHP wins is because it is fast enough, compared to other dynamic languages, but is a better fit for web development than Java or other compiled languages.

Re:Reining in the thundering herd: Getting to 80% CPU utiliz... by void_mint on Monday August 16, 2021 @10:58AM (#28198875)
In the link you provided PHP is 53% as fast as Spring. I would argue that’s an insane performance reduction.

If Python weren’t fast “enough”, would it be used to power so many successful web backends?

Re:Reining in the thundering herd: Getting to 80% CPU utiliz... by tored on Monday August 16, 2021 @11:14AM (#28199055)
That is for spring-webflux, is that a typical spring set up for web today?

I haven’t coded spring for a few years now, but I was thinking about the traditional spring setup that most use and that is comparable.

You can of course use Python successfully, my argument is that it is easier with PHP, not that it is not possible with Python.

It is a similar argument compared with Java, it is easier with PHP than Java in a web context. Java has other benefit thats fits better for web services IMHO, general higher performance is one.

Re:Reining in the thundering herd: Getting to 80% CPU utiliz... by sdze on Sunday August 15, 2021 @02:12PM (#28190912)
C#, Java, C++ need application servers, no?

"Serverless" scales infinitely due to its simpler request/response lifecycle.

Re:Reining in the thundering herd: Getting to 80% CPU utiliz... by void_mint on Sunday August 15, 2021 @03:16PM (#28191587)
Serverless is too overloaded a term to have any meaning. I'm not really seeing how Python or PHP "scales infinitely" in any way that C#, Java, C++ couldn't.
Re:Reining in the thundering herd: Getting to 80% CPU utiliz... by tored on Monday August 16, 2021 @04:55AM (#28196157)
PHP is usually easier to scale because it just a matter of how many webservers. e.g. apache or nginx, you choose to deploy. This also possible with other platforms, but can be a bit trickier to get right.

For large PHP setups it is usually the number of database connections that is the limiting factor, however that is why historically the replicated MySQL databases was such a good fit for PHP, thus only creating a limit for writes on the master.

Re:Reining in the thundering herd: Getting to 80% CPU utiliz... by void_mint on Monday August 16, 2021 @04:06PM (#28202257)
> For large PHP setups it is usually the number of database connections that is the limiting factor,

For pretty much every modern programming language, IO is the bottleneck over everything else.

To save you some time, there are practically no metrics in which I think PHP beats another programming language other than maturity, and even then, not really.

Re:Reining in the thundering herd: Getting to 80% CPU utiliz... by swiley on Sunday August 15, 2021 @10:22PM (#28194379)
Php needs an application server as well.
Re:Reining in the thundering herd: Getting to 80% CPU utiliz... by waprin on Sunday August 15, 2021 @02:24PM (#28191049)
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 utiliz... by huffmsa on Sunday August 15, 2021 @02:41PM (#28191248)
In the early stages:

Speed of development is far more important than optimizing CPU usage.

You can fake your way to fast responses with good caching, but there's not really many ways to fake having the best features.

Re:Reining in the thundering herd: Getting to 80% CPU utiliz... by sdze on Sunday August 15, 2021 @02:10PM (#28190895)
It blows my mind how quickly PHP7.4 processes even shitty code.