Live data from Hacker News

Elixir saves Pinterest $2M a year in server costs

paraxial.io

171–180 of 481 posts

Re: Elixir saves Pinterest $2M a year in server costs

#171
post #3

By the title alone, this means nothing. How much would it cost otherwise? What is the percentage savings? In TFA, it gets better though: "Steve: That’s pretty easy. When I started on the spam team, we had close to 1,400 servers running. When we converted several parts to Elixir, we reduced that by around 95%. One of the systems that ran on 200 Python servers now runs on four Elixir servers (it can actually run on two…

Second system syndrome.

They did savings by re-implementing their services and attribute those savings to the new tool / programming language.

I wonder what the saving would look like if they chose another tool for the second / optimized system. I doubt it would differ much if they went with Go, Java or stayed with Python.

Re: Elixir saves Pinterest $2M a year in server costs

#172

Earlier quoted context omitted.

You seem to be wrong, at least based on the quote you chose to use here, as Steve doesn't even mention anything related to functional programming?

Elixir is a functional language for the Erlang VM. Most C++/Java/Rust/... programmers wpuld have hard time understanding it. But if you are in a bubble where everyone uses Haskell and talks about Monads, then OPs statement may be valid

I think Elixir is closer to an easier to read Lisp than to Haskell. In fact if someone claimed to know Rust, but couldn't figure out Elixir then I'd simply assume they were lying about their Rust experience.

Re: Elixir saves Pinterest $2M a year in server costs

#173

Earlier quoted context omitted.

Author of the “Lambda” piece [0], all of the cost savings I discussed came from API Gateway alone. The lambdas were negligible. That being said, I don’t think we could have processed the traffic more efficiently in another language. We were processing 12M requests per hour. You could run the entire thing on 2 vCPU we “over provisioned the crap out of it” by running it on 4 pods w 2 vCPU as the upper request limit. >…

Its still not very easy to understand if this is now good or not. 3-5k requests per second is not that much and highly depends on what you actually do. A lot of things can be done just with nginx. nginx is very fast.

I don’t recall the payload size, but these were all POSTs w/ decent sized bodies, it took about 60 Kinesis shards to avoid writethroughputexceeded.

Re: Elixir saves Pinterest $2M a year in server costs

#174
post #3

By the title alone, this means nothing. How much would it cost otherwise? What is the percentage savings? In TFA, it gets better though: "Steve: That’s pretty easy. When I started on the spam team, we had close to 1,400 servers running. When we converted several parts to Elixir, we reduced that by around 95%. One of the systems that ran on 200 Python servers now runs on four Elixir servers (it can actually run on two…

It's really strange to me how people continue to build services using python, knowing it is 100 times slower than appropriate languages, and then get surprised by it being 100 times slower, so they eventually rewrite it.

I think it is a lack of know-how. Most businesses/managements are not capable of making the decision to go for an ecosystem like Elixir, because they either don't even know it exists (that is also true for many devs) or they do not dare to do anything non-conventional or non-mainstream, or they have the wrong impression, that the "programming language does not matter". (Well, it does! Since it connects you to an ecosystem that comes with it and its language design choices influence how easily you can do things ...)

So then Python comes along and you find loads of devs for that. Once Python is entrenched, businesses have a hard time telling their devs to actually learn something new. And few devs will already explore things like Elixir on their own in their free time. And so they continue to hire Python devs.

(One could also replace "Python" with "Java" or "NodeJS" or similar, the principles remain the same.)

Re: Elixir saves Pinterest $2M a year in server costs

#175
post #3

By the title alone, this means nothing. How much would it cost otherwise? What is the percentage savings? In TFA, it gets better though: "Steve: That’s pretty easy. When I started on the spam team, we had close to 1,400 servers running. When we converted several parts to Elixir, we reduced that by around 95%. One of the systems that ran on 200 Python servers now runs on four Elixir servers (it can actually run on two…

Second system syndrome. They did savings by re-implementing their services and attribute those savings to the new tool / programming language. I wonder what the saving would look like if they chose another tool for the second / optimized system. I doubt it would differ much if they went with Go, Java or stayed with Python.

I think second syndrome is probably a significant factor, but I can also believe that ditching Python was also a significant factor.

EDIT: I’m being rate limited because I guess my comments are too spicy for the HN mods, but anyway I agree that there’s no reason other non-Python languages would fare much worse than Elixir.

Re: Elixir saves Pinterest $2M a year in server costs

#176

Earlier quoted context omitted.

> The big one however is going from 200 Python servers to 4 Erlang ones If your rewrite or refactor gives you a 10X in performance, that's not an optimization, but a bugfix. Unless you are a researcher who have just found a revolutionary algorithm.

Or you just used a crappy inefficient architecture or algorithsm etc. Just because they were slow doesn't make them bugs, nor does using something faster in a rewrite means it's a bugfix.

They could be design bugs as in it was broken/buggy by design.

Re: Elixir saves Pinterest $2M a year in server costs

#177
post #3

By the title alone, this means nothing. How much would it cost otherwise? What is the percentage savings? In TFA, it gets better though: "Steve: That’s pretty easy. When I started on the spam team, we had close to 1,400 servers running. When we converted several parts to Elixir, we reduced that by around 95%. One of the systems that ran on 200 Python servers now runs on four Elixir servers (it can actually run on two…

Second system syndrome. They did savings by re-implementing their services and attribute those savings to the new tool / programming language. I wonder what the saving would look like if they chose another tool for the second / optimized system. I doubt it would differ much if they went with Go, Java or stayed with Python.

Python is 100x slower than a real language (I like python and use it often, not meant as a dig at the language just stating facts)

My favorite thing about Python is writing prototypes. The big risk with writing a prototype is that it survives into production. Using Python ensures that the code will be replaced by real code

Python is great for other non-production code like Jupyter notebooks, numpy experiments, etc

Re: Elixir saves Pinterest $2M a year in server costs

#178

Earlier quoted context omitted.

My bet is that the bulk of the savings came from the re-architecture and, at best, Elixir sped up the path to get there.

I wrote the lambda piece, you could say re-arch saved us the money (although we could only re-arch cheaply because we already had other massive scale serverful systems in place), but I don’t believe I could have made it as efficient and dependency free in any other language. i had been developing in ruby for over a decade and about 5 years of Node exp at the time. im not a language enthusiast and mostly write in go t…

Go is my current favourite as well. Heck, just replacing python with Go would have done similar numbers. The key is “replacing python” and “rearch”, Elixir was just the mechanism.

Re: Elixir saves Pinterest $2M a year in server costs

#179

Earlier quoted context omitted.

Second system syndrome. They did savings by re-implementing their services and attribute those savings to the new tool / programming language. I wonder what the saving would look like if they chose another tool for the second / optimized system. I doubt it would differ much if they went with Go, Java or stayed with Python.

Python is 100x slower than a real language (I like python and use it often, not meant as a dig at the language just stating facts) My favorite thing about Python is writing prototypes. The big risk with writing a prototype is that it survives into production. Using Python ensures that the code will be replaced by real code Python is great for other non-production code like Jupyter notebooks, numpy experiments, etc

How is calling Python "not a real language" just stating facts?

I'm not sure by which metric we are judging whether a language is real or not, but I'm fairly sure that almost anything anyone comes up with will include Python, considering it's one of the most used languages in the world at this point, and used for a fairly large variety of use cases.

Re: Elixir saves Pinterest $2M a year in server costs

#180
post #85

Earlier quoted context omitted.

> When our notifications system was running on Java, it was on 30 c32.xl instances. When we switched over to Elixir, we could run on 15. Would be curious to know how they tried to optimise the Java stack. Because on every benchmark I've seen the JVM is faster in every which way than Elixir. Except for memory where often people will over-provision the JVM rather than look at where their code might be over-allocating o…

> Would be curious to know how they tried to optimise the Java stack They say "The combined effect of better architecture and Elixir". So the post is mostly useless.

Not if Elixir enables you to use a better architecture. See all of the people who lifted linked-list structures out of C into C++/Rust vectors.
Post reply on HN