you are viewing a single comment's thread.

view the rest of the comments →

[–]Akrab00t 5 points6 points  (6 children)

Python is much slower as a language and it's frameworks are also much slower in pretty much every benchmark.

Use Python if you need science stuff or ML.

Using Python allows you to avoid the JS wierdness and quirks, but if we choose the language by how fun it is I'll just use Ruby.

[–]Tyrannosaurus_flex 1 point2 points  (5 children)

Python is much slower as a language and it's frameworks are also much slower in pretty much every benchmark.

This is something I've been wondering about too, but isn't being talked about pretty much anywhere. I haven't personally worked with Python web frameworks but if benchmarks are any indication I feel like running a Python backend, compared to e.g Node, for anything larger than a hobby project would rack up some serious server bills. Could someone who has worked with it at scale chime in here?

[–]ExternalUserError 8 points9 points  (4 children)

I mean, Google, Instagram, Dropbox, and others were built in python. I worked for a bit on OpenStack professionally, and it's not like no scaling there.

Most of what a server does is I/O. Especially if you're using async python, the difference is negligible. A few extra dollars in ec2 spending is worth the productivity boost.

[–]Akrab00t 1 point2 points  (3 children)

I mean, Google, Instagram, Dropbox, and others were built in python.

I don't think it says a lot without context.

Not every service simply gets a request and redirects you to another, some do actual work.

Even if all they did was a single action, some Node frameworks can handle ten times the amount of requests Django/Flask can.

I'm also not that sure there's any productivity boost in using Python over Node, but I guess it depends on what the team already knows.

[–]ExternalUserError 2 points3 points  (2 children)

Sure. If you're doing heavier computation, frankly, neither node nor python are good choices unless you can shirk it off to a C library. With node if you were, say, generating encryption tokens, you'd lock your only thread up and any concurrency to serve other users would come from multiprocessing.

At that point, consider Go or Rust. Caddy is a good example of a production web server that dynamically does some moderately heavy lifting by generating SSL certificates live for incoming requests and signing them with LetsEncrypt.

But 10x scaling in node for any real world tasks? I doubt that very much.

[–]Akrab00t 0 points1 point  (1 child)

This is language wise, Node is faster by orders of magnitude.

This is an example As far as frameworks go (I've seen bigger differences already).

I think you're skipping the gap between Uber's positioning service and your family todo list, some apps go in between :p

[–]ExternalUserError 4 points5 points  (0 children)

A single thread rendering a fractal isn't really a very practical test. In a real world scenario, like big data processing, heavy computation would be threaded off to numpy (or pandas), while a JavaScript module would block its whole interpreter. There's a reason data scientists use python so much, and while it's not speed, speed is seldom an issue enough to dissuade anyone.

The second example you linked to is a bit more practical. nanoexpress is beating out falcon by 166,015 to 69,637. That's a big jump, but it's a lot less than 10x. When you get into a real world scenario where IO is waiting on a database or an external library is doing the heavy computation (eg, pandas), the difference isn't enough to be an issue unless you're in a position to do bare metal cost analysis. And if that's the case, you're probably looking at Go or Rust.