Live data from Hacker News

Elixir saves Pinterest $2M a year in server costs

paraxial.io

241–250 of 481 posts

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

#241

Earlier quoted context omitted.

My experience of this is not theoretical.

Maybe you should write a blog post about it, many in the Elixir's ecosystem are very serious devs and are always looking at ways to improve it.

There are entire github repos dealing with it.

Frankly the Elixir ecosystem, which is not without merit, is more interested in perpetuating the myth of magic scalability by virtue of the beam.

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

#242

200 servers running Python. I bet it was an architecture problem more than a language problem. I’d be expecting to leave most of that in place and fix the hotspots that are dragging performance down. Maybe some compiled code in certain places. Almost certainly a detailed analysis would have yielded 20 things that could be tuned. Posts like this are almost something to be ashamed of “we rewrote an entire subsystem bec…

> Posts like this are almost something to be ashamed of “we rewrote an entire subsystem because we wanted to use a language we like”. That’s really failing in your responsibility to the company. I would tend to agree. I don't understand these sorts of decisions to rewrite huge sites in niche languages and frameworks. You tend to get one engineer who really likes some language, has some clout, and is able to pitch it…

I know a company that built its core systems using elixir.

Finding people is a nightmare.

Really I can’t think of anything that would justify using a niche language over javascript/Python/C++/Golang/C#/Java.

Surely one of these will get the job done.

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

#243
post #128

Earlier quoted context omitted.

Elixir is slower than plain PHP according to the techempower benchmarks. I'm not even sure how that's possible but it is. By like a factor of 2 iirc. I'm not sure how elixir is that slow since it's compiled.

The techempower benchmark are... Quite infamous in the elixir community. Long story short, they are running in debug mode, badly written, not optimised, with bad OS level settings. And every time the community have tried to contribute fixes, the experience has been... Really bad. So we stopped trying. If things have changed we could try again but ... We just wrote them off

As far as I can tell, you’re basing this off a single thread from a prior techempower round. The result being cleaned up in a subsequent round, but are ignoring that.

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

#244
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.

Um that’s not what second system syndrome is. It’s a simple rewrite.

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

#245

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.

This is a pretty realistic balanced real-world benchmark of web frameworks (and languages): https://www.techempower.com/benchmarks/ It shows that Python with Django is literally 40 times slower than the fastest framework. Python with uvicorn is 10 times slower. The use of languages like Python and Ruby literally results in >10x the servers being used; which not only results in higher cost, but also greater electricit…

Going from

> greater electricity use, and pollution and carbon emissions if the grid where the data center is located uses fossil fuels.

to

> dynamically-typed languages damage the environment as they're typically an order of magnitude slower

is quite a stretch.

Do dynamically-typed languages inherently damage the environment? Or is it the fossil fuels?

Not that the appeal to the environment matters, because later on we have this:

> If Kotlin were 10 times slower, I'd be happy to pay that price, since it is genuinely a great language to work with, is statically typed, and developers are more productive in it.

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

#246
post #154

Couldn't they have just moved their python to Cython / Pyrex? Or changed their arch and kept the tech stack the same? I wonder how much time and team hours were spent learning the new framework and it's caveats vs if they'd just spent a little time optimizing their existing stack. All too often common with non-perf folks making sweeping changes without rigorously measuring along the way. I guess it makes for good hea…

Yeah, but then it wouldn't be career driven development, with a nice blog post.

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

#247

Earlier quoted context omitted.

Maybe you should write a blog post about it, many in the Elixir's ecosystem are very serious devs and are always looking at ways to improve it.

There are entire github repos dealing with it. Frankly the Elixir ecosystem, which is not without merit, is more interested in perpetuating the myth of magic scalability by virtue of the beam.

Frankly I am seeing that as a myth, you seem to have made up your mind some time ago or judged by 1-2 occasions.

I am on ElixirForum every day and worked with Elixir for 7 years and have never seen anyone "perpetuate myths". I've seen some people willing to "increase adoption" which was always met with resistance by the wider community -- we believe growth should be organic.

Pretty sad stance from you though, I have no idea why people get so ticked off when another programmer wants to tell them about a secret weapon.

If you are not willing to try it, that's fair. Say that. Claiming you know stuff about the ecosystem while a guy who is there every day is not seeing that at all comes across as... strange. Biased. And not arguing in good faith. :(

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

#248

Earlier quoted context omitted.

Maybe to you, but my wife uses Pinterest a ton. It is where a lot of the women I know go to for ideas for just about everything, from house decor to even the ideas for our wedding. Pinterest is useful just not for us nerdy guys. I am not sure why Google keeps it though or how they benefit, unless Pinterest uses AdSense exclusively, then one can determine that its some sort of partnership. You would think Google would…

They are referring to how they link out their images and SEO content that ultimately one will find unusable & frustrating. I have experienced this many times when looking for a specific image on Google Images, I will click on the link that goes to Pinterest only to find the image is not there.

IMO this is more a Google problem than a Pinterest problem. Google does the same thing with text search (returning results that have few if any of your search terms), possibly over relying on opengraph tags and other such metadata.

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

#249

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…

I think it's more important to look at the re-architecting than the different language. Second, I think certain architectures - like the actor model described in the article - work better and more intuitive if you use a different language. That said, I'm sure a 2x performance improvement could've been done in Java as well if they did a re-architecture. They could also have made a lateral movement and go to a differen…

This is an important point. Sometimes when you need to do a major rearchitecture of a system it can help to choose a language that is more appropriate to that architecture. The Elixir/Erlang ecosystem has a better story for Actor Model development so it makes sense to choose them for the new architecture. It depends on the team and the specifics of the new architecture because the devil is always in the details. It may be that the new language isn't enough of a win to justify the switch and sometimes the win from the new architecture is big enough that sticking with the current language makes sense.

But a knee jerk response of: This is mostly just good because they rewrote/rearchitected it, ignores the benefits of using a language or technology that fits the new architecture better.

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

#250
post #37

Earlier quoted context omitted.

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.

Project loom should make it better in dev experience and easier to reason + better library evosystem.
Post reply on HN