Live data from Hacker News

Elixir saves Pinterest $2M a year in server costs

paraxial.io

31–40 of 481 posts

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

#31
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…

> 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…

Faster doesn’t mean more responsive, in fact very often an increase in throughput leads to an increase in latency.

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

#32

Pinterest - ah that app that has hijacked all images in google search result. Created an account once but has not really used it.

While the google images thing is kinda shitty. Pinterest is really really good at image search and image recommendations.

Pinterest without an account is useless. Or did that change since the last time I cared to look?

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

#33
post #8

If you are starting from AWS, it is likely there are many ways to save tons of money by just moving away from AWS.

I think they stayed on AWS to be fair. But also to be fair they were probably doing something dumb, and not doing that dumb thing is saving them $2M, and at the same time they move to Elixir. OTOH to be fair to Elixir maybe it made it easier to do that refactor compared to say Actor models in Java or whatever.

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

#35
post #21

I wonder how much of the savings comes from the refactoring and how much from the difference between the speed of python and elixir.

It's not unusual to gain 50-100x performance gains on code when moving from python to a compiled language without much refactoring. Dropping from 200 to 4 servers is well within the lines of performance gains one can expect.

Yes, those numbers are for code, network speeds are not directly impacted the same way. But again, does not sound unreasonable.

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

#37

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…

They rewrote, which is known to help too. Going from 30 to 15 instances is not bad but it's very likely that a Java-to-Java rewrite would have helped go down too. The big one however is going from 200 Python servers to 4 Erlang ones: a 50x reduction is quite something and a Python-to-Python rewrite would not have allowed to achieved a 50x gain: > All this is possible because Elixir, and the Erlang platform underneath…

> it's very likely that a Java-to-Java rewrite would have helped go down too.

it depends.

The elixir programming paradigm might be one where you are able to more easily write efficient, but still highly concurrent code, where as it would take more work to do the same in java.

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

#38
post #31

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…

Faster doesn’t mean more responsive, in fact very often an increase in throughput leads to an increase in latency.

[deleted]

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

#39
It’s interesting because while this is an extreme case of performance improvement, the ROI doesn’t seem amazing.

"rewriting in another language reduced the number of servers by 95%" is hard to beat, but at the same time, this saves "only" 2m a year, or about 0.3% of FY22 cost of revenue (per another post)

Pinterest per employee revenue seems to be around 1m, which basically suggest that this could even be a worse than average allocation of resources.

My takeaway would be "don’t bother with this kind of optimisation before you reach a scale where you can afford to do marginal improvements"

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

#40

> The combined effect of better architecture and Elixir saved Pinterest over $2 million per year in server costs So it may not even be Elixir that is saving most of that money. Who knows.

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.
Post reply on HN