Live data from Hacker News

Backend of Meta Threads is built with Python 3.10

twitter.com

411–420 of 458 posts

Re: Backend of Meta Threads is built with Python 3.10

#411

I worked on Cinder, and on the web server. Happy to answer technical questions if any :)

Thank you for offering to answer questions.

Is Cinder something that could help optimize real-time streaming? We had a UDP stream and then through multiple gstreamer and nvidia deepstream magic (which I believe the senior dev implemented in Python) we perform some ML inference on the stream in real-time.

However, latency is a major issue here and to get to our MVP we didn't really prioritize optimization, as is tradition.

So now I'm wondering if Cinder as something that can be used to optimize real-time data streaming is a thing or whether me asking this just shows I don't understand its use case.

Either way, thank you advance for your insight.

(Also we used Django which I am now wondering if I should have switched out for FastAPI, but that's a separate question)

Re: Backend of Meta Threads is built with Python 3.10

#412

Earlier quoted context omitted.

I'm not seeing how is that the takeaway btw, mind elaborating? I'd think the same or bigger performance benefits can be reaped if you just start with stuff like OCaml / Haskell / Golang / Rust from the get go.

My point is that they started with vanilla PHP and then had the most successful scaling story of all time -- so if someone else wants to follow in their footsteps then they should go with what is tried and true.

Well that might be mistaking the chicken for the egg or vice versa. They made sure it works because they were heavily invested. So if anything, that is a story of a tenacious tech team and nothing much more beyond that.

Arguably picking almost any other tech would have worked as well because they would have doubled down on it as well and made sure that all the pieces that they need are in place and are working.

Thanks for elaborating, though I definitely don't share your conclusion.

Re: Backend of Meta Threads is built with Python 3.10

#413

Earlier quoted context omitted.

Why do you say that?

It could be different for other teams, but in my team we spend a lot of time writing design docs, discussing new features (which we never end up implementing), taking a lot of time in code reviews, making sure that public changes are backward compatible. Hence at the end producing very little output and wasting tons of time in the due process.

Sounds like us tbh. So many hours wasted writing deeply technical documents that only few engineers have the background to go through, too many hours wasted on huge ass documents supporting PoCs. Ugh.

Re: Backend of Meta Threads is built with Python 3.10

#414

Earlier quoted context omitted.

Yep, Vanilla Python isn't fast enough so they have to do more: "It's running on Instagram's #Cinder fork that includes a JIT, lazy-loaded modules, pre-compiled static modules, and a bunch of other interesting tweaks against vanilla Python 3.10" From the Tweet. Personally, I don't care what language people use. We all know that if you have money, you can just throw in more servers. Until your CFO and CTO decided that…

It just dawned on me that linking to Twitter is now impossible on the open web. Unless you have an account, a person can not see the linked material. This is a huge loss for the world, and makes me a bit angry. Edit: I had falsely assumed that because GP missed out on the JITing etc. described in the linked tweet, that Twitter was still inaccessible to the open web. However, trying again now, Twitter is again viewabl…

They removed the requirement to be logged in to view Tweets

Re: Backend of Meta Threads is built with Python 3.10

#415

Earlier quoted context omitted.

[flagged]

Such a pedantic response, the archetypical HN comment, I can sense the pretentious smirk on your face while writing it, thanks. Words still mean something, we don't compile a dynamically typed, interpreted scripting language such as PHP for a reason and as it turns out Facebook didn't "compile PHP" either but a dialect of the language. https://en.wikipedia.org/wiki/Hack_(programming_language)

Facebook transpiled it before using the HHVM.

https://en.wikipedia.org/wiki/HipHop_for_PHP

Re: Backend of Meta Threads is built with Python 3.10

#416

Earlier quoted context omitted.

Quite often, the choice of language is failing to see the forest for the trees. Saving nanoseconds or cycles because you chose C++ over Python pales in comparison to milliseconds spent at network barriers reading from a cache service or database

At Facebook scale those nanoseconds are worth millions in compyte, energy, etc.

But do the millions you spend a year on compute cost more or less than the millions you would spend a year in labor finding the increasingly rare breed of C++ developers who can optimize things for instruction or cycle count? Such developers usually have over a decade of experience (if not multiple decades). Python developers are a dime a dozen, comparatively

Plus, instruction and cycle counting is low hanging fruit compared to memory latency. You can cache-optimize a program in any language so long as the memory representation of some data is relatively transparent.

Re: Backend of Meta Threads is built with Python 3.10

#417

Earlier quoted context omitted.

Example? I'm curious

Python is generally around 50 times slower than C++. Obviously it varies massively with the benchmark but that's a good ballpark. Just Google "python vs c++ speed" and you will find hundreds of examples (or "python vs rust speed" - Rust is essentially the same speed as C++). Here's the first result - they got a 25x speedup: https://towardsdatascience.com/how-fast-is-c-compared-to-pyt...

Did you read the article and comments? The comments point out a lot of issues with the article. Sadly, I've seen this article referenced before on other discussions.

Re: Backend of Meta Threads is built with Python 3.10

#418
post #55

Really, all the performance intensive parts are in various c++ aggregator and recommendation type services. But the webserver is Django, yes.

Correct me if I'm wrong, but Django is not a web server. It's a framework used in conjunction with an app server e.g. gunicorn and a web server e.g. nginx

Re: Backend of Meta Threads is built with Python 3.10

#419
post #382

Earlier quoted context omitted.

Costs that wouldn't have happened in first place if a scripting language hadn't been chosen in first place.

What we can’t know is whether they would have been fast enough to tweak their product to their current market without using a scripting language. Companies who do that aren’t sacrificing performance for nothing, scripting languages make a lot of things simpler and closer to the business domain, which cannot be ignored (anybody who’s in a huge project that requires a 30 min. compilation often enough to kill productivi…

> What we can’t know is whether they would have been fast enough to tweak their product to their current market without using a scripting language.

Exactly. And I am saying the following as a fan of dynamic languages but let's be realistic: this is practically their ONLY true benefit -- quicker time to market. They lose out on pretty much any other metric, with the exception of also slightly quicker iteration in the day-to-day work.

Re: Backend of Meta Threads is built with Python 3.10

#420

Earlier quoted context omitted.

>Remember when Twitter was written in Ruby? Ruby is the exception to the rule. Friends don't let friends start new Ruby projects in 2023.

Why not exactly? What language would you suggest?

Elixir, Golang, maybe even Rust (that one is a hard sell though, there could be a lot of friction at the start and part of it persists even when the project matures).
Post reply on HN