Plataformatec Blog
blog.plataformatec.com.br · Company blog · on HN since 2009
Blog of Plataformatec, the Brazilian consultancy behind much early Elixir work, covering Elixir, Erlang, Rails and web architecture.
What HN saysHN commenters link its posts on Kubernetes and the Erlang VM, Elixir variable rebinding, and mocks, using them to explain how Elixir and k8s fit together.
94HN people shared it
41linked it in comments
89stories submitted
726story points
11 months agolast shared
2009people per year2026
Most-shared posts
- 1Kubernetes and the Erlang VM: orchestration on the large and the small16 people · 21 points · first shared 2019 · 1 comments on HN
- 2Elixir in times of microservices9 people · 45 points · first shared 2015 · discussion on HN
- 3Comparing Elixir and Erlang variables8 people · 2 points · first shared 2016 · 1 comments on HN
- 4Mocks and explicit contracts (Elixir)6 people · 12 points · first shared 2015 · discussion on HN
- 5Why your web framework should not adopt Rack API5 people · 92 points · first shared 2012 · 18 comments on HN
- 6Plataformatec Acqui-Hired by Nubank5 people · 40 points · first shared 2020 · 1 comments on HN
- 7Jose Valim: Fallacies of Web Application Performance5 people · 16 points · first shared 2017 · discussion on HN
- 8Why Rubyists should try Elixir4 people · 23 points · first shared 2011 · 1 comments on HN
- 9Beyond Functional Programming with Elixir and Erlang4 people · 14 points · first shared 2016 · discussion on HN
- 10Reducees: Elixir's abstraction for eager or lazy operations, in-memory or I/O3 people · 20 points · first shared 2015 · discussion on HN
- 11Websocket Connections and Application State with Rails and Elixir3 people · 8 points · first shared 2016 · discussion on HN
- 12Announcing Broadway3 people · 7 points · first shared 2019 · discussion on HN
- 13CSRF token fixation attacks in Devise3 people · 2 points · first shared 2013 · discussion on HN
- 14Security Announcement for Devise (Rails authentication solution)2 people · 66 points · first shared 2013 · 20 comments on HN
- 15Comparing protocols and extensions in Swift and Elixir/Clojure2 people · 8 points · first shared 2014 · discussion on HN
What HN people wrote when they linked it
weatherlight · 2024-02-07
iex(1)> a=10 10 iex(2)> a=11 11 Because underneath, it’s doing
A0 = 10. A1 = 11. You might not like it, because it feels like mutation, but it’s not, it’s rebinding. Just consider this as a syntactic sugar. It’s useful when doing
conn = conn |> apply_some_change() In the end, it does generate valid bytecode for the BEAM, and immutability is respected.
BTW You might prefer Erlang syntax, but You would lose |>
José Valim, has a great writeup about this here.
https://blog.plataformatec.com.br/2016/01/comparing-elixir-and-erlang-…
jeremyjh · 2021-08-13
Kubernetes and Erlang are really solving different problems. Kubernetes makes sure my OS process is running - Erlang lets me compose my application from a set of actors in a single OS process that are fault tolerant and supervised. Somewhat similar problems but at totally different levels of abstraction. Erlang out-of-the-box isn't especially great at building distributed applications and benefits from leader services, message queues, RPC mesh frameworks etc nearly as much as any other application; its just that you can solve pretty small-scale simple problems without reaching for those in some cases. Jose Valim (creator of Elixir) wrote about this in a great blog article a few years ago: http://blog.plataformatec.com.br/2019/10/kubernetes-and-the-erlang-vm-…
dnautics · 2021-07-15
This is not really a problem in zig. If you really need a destructor, write a .deinit() function in your struct, and call that. For your case with mocks (note mock as a noun, not a verb, which is a bit of an antipattern anyways, see: http://blog.plataformatec.com.br/2015/10/mocks-and-explicit-contracts/… That aside:
Go doesn't have generics so you can't really do this, but in the case of zig, your function would be parametrized on the type, so you would issue it a struct to be shared by the tests that has the common initialization upfront, make_ functions that return the pre-initialized stuff, followed by running the function, followed by no-op deinits, followed by whatever forensics you'd like to run later.
ramchip · 2021-06-03
I think the idea that you don't need k8s if you have Erlang isn't entirely wrong, but it also does people a disservice by making them sound equivalent when they complement each other really well.
K8s is like an additional level of supervisor that applies to an entire node, and provides really easy scaling and clustering. It's a great tool to run an Erlang app, especially if you already have a managed k8s cluster anyway.
This article describes it well: http://blog.plataformatec.com.br/2019/10/kubernetes-and-the-erlang-vm-…
mononcqc · 2019-10-29
The Docker chapter does mention similar things, and José Valim recently wrote the following blog post on this: http://blog.plataformatec.com.br/2019/10/kubernetes-and-the-erlang-vm-…
In a nutshell, docker and k8s are to OTP what region failover is to k8s tech. They operate on different layers of abstraction and impact distinct components.
OTP allows handling partial failures WITHIN an instance, something K8s can’t help with.
Jedi72 · 2018-12-12
Can we please have one BEAM thread where this isnt brought up? Its such a minor thing. I went from erlang to elixir and whilst at first I really missed atoms that start with a colon, you get used to it. Its 90% the same ideas, and Elixirs pipe operator is worth any small syntax niceties erlang has. No language is completely without its quirks even erlang (unless you LIKE endless repituons of the same variable into var_1, var_2, etc - and no, this doesnt reduce bugs http://blog.plataformatec.com.br/2016/01/comparing-elixir-and-erlang-v… )
snake117 · 2018-11-29
This is my first year participating in AoC and I am going with Elixir. I think this will be a great experience as I can try solving the problem on my own and then watch Jose Valim's approach live on Twitch. Here is more information if you are interested: http://blog.plataformatec.com.br/2018/11/lets-learn-elixir-together-wi…
perishabledave · 2018-11-08
One thing worth highlighting in the post is that Phoenix now uses Ecto 3.0. This latest version of Ecto separates Ecto's data mapping and validation from Ecto's SQL adapters. Practically this means you can use Ecto's changesets when you either don't need persistence or aren't using a SQL database.
Additionally there are a number of features that make Ecto 3.0 a great release:
http://blog.plataformatec.com.br/2018/10/a-sneak-peek-at-ecto-3-0-brea…
knewter · 2016-06-06
I'm glad to dive in. On the client, fault tolerance is basically not a concern of mine. On the server, it's the most important concern. I find it more useful to think of Elixir as a highly concurrent language built for fault tolerance, where Functional Programming was a necessary requirement to get there. Jose has a great post on this here: http://blog.plataformatec.com.br/2016/05/beyond-functional-programming…
lectrick · 2016-01-25
> I also like the immutable variables aspect.
Elixir has the same immutable variables. I don't know why this is such a misconception. Erlang conflates rebinding and reassignment, Elixir does not, and the tradeoffs seem to (overall) be better in Elixir's case. Here, read the language creators' explanation as to why that is, it's the best:
http://blog.plataformatec.com.br/2016/01/comparing-elixir-and-erlang-v…
Very succinct and (hopefully) puts this misconception to bed.
ajxs · 2021-07-30
Someone else has already noted this: Don't use the native Javascript Number type for calculations involving currency. There's some great reading available online on this subject.[1][2]
There are various libraries around that can facilitate precise decimal arithmetic in Javascript. A well known one is BigNumber.js (https://mikemcl.github.io/bignumber.js/)
A great quote that I found on StackOverflow regarding this issue and wrote down:
"When you are dealing with things that are measured (speed, distance, weight etc.) rounding is OK as the accuracy of the original measurement is probably less than the accuracy of your calculation, and users accept that the final number is still an estimate even if its a good estimate.
When you are dealing with things that are counted (money, people, ICBMs) rounding errors are a disaster. There is always an arithmetically correct answer, and, often the accuracy of this answer is enshrined in regulation, treaties and tax law. Providing a slightly wrong number gets you a free ticket into the Kafkaesque world of auditors, tax collectors and government inspectors; you may never escape with your sanity intact." - James Anderson
[1] https://stackoverflow.com/questions/3730019/why-not-use-double-or-floa…
[2] http://blog.plataformatec.com.br/2014/09/floating-point-and-currency/
vinhnglx · 2020-05-25
I'm working for a software consultant in Singapore. We tried Elixir for a few projects, and now we're still trying. So, I can share a few experiences from my view.
- Elixir and the Phoenix framework is perfect when building concurrency systems. Our company had made a ticketing system, solving the tickets for "Cirque du Soleil - Hongkong 2018". During two months of the event, our system (one Elixir/Phoenix server - scale up to two - one load balancer) can handle more than 5000 tickets per second. We were so excited. Unfortunately, the client's company closed after that. So the project was closed too.
- The second project was a product of a finance startup. Not so much thing I can share in this project, but the main feature is chatting. We used the Phoenix Channel and Graphql Subscription for this feature.
- In the side project, one member of the team used Phoenix Liveview to build a Coup game (board game).
So, in general, when I work with Elixir, I see a few pros and cons:
Pros:
- Fast. Functional programming is really fun. I love pattern matching.
- Not so hard to write tests. It's easy to mock external APIs. (Check out this blog: http://blog.plataformatec.com.br/2015/10/mocks-and-explicit-contracts/…
- Easy to deploy. After dockerize the application, I can run it anywhere. The ticketing system was run on AliCloud, and the second project was run on Kubernetes (AWS).
Cons:
- Lack of supported libraries for external services. Sometimes, our team has to write a…
josevalim · 2015-09-25
Elixir creator here. This is a very good question and a very hard one to answer because there are so many facets to consider. I will provide some bullets instead of doing direct comparisons.
* Concurrency is not an after thought. The primary abstraction are actors (Erlang processes) that are isolated and communicate with message passing. Data structures are also immutable which helps greatly with concurrency and also leads to clearer code (it is really comforting to know that a value won't change under your feet).
* The Erlang VM: we are leveraging 30 years of knowledge in building and running fault-tolerant systems, thanks to the underlying process model. We could really go deep into this topic so I will just link to an article I wrote some time ago talking about Elixir and microservices: http://blog.plataformatec.com.br/2015/06/elixir-in-times-of-microservi…
* Performance may also be a big deal depending on what you are doing. Elixir/Erlang are not good at number crunching but if you are running anything behind TCP/UDP, it will give you better throughput and a consistent latency compared to Ruby, Python, Node.JS, etc.
* We don't have compile time checking but we do provide type specifications and a way to check them: http://elixir-lang.org/docs/master/elixir/Kernel.Typespec.html. The integration between Elixir and Dialyzer is suboptimal today but if type checking is a big deal for you, it will certainly help.
TL;DR: Elixir is for building and running…
chrismccord · 2014-11-29
Yes, this is similar to Plug, but we only have a "connection". There is no distinction b/w request/response. A series of Plugs form a transformation layer on the connection where plug middleware can transform the connection, send a response etc. "Yielding to the next plug" is just a matter of returning the connection. There is no explicit yield. You either halt the connection (don't invoke further plugs) or continue the stack by returning the conn unhalted. Where your "upstream" concept fits is a connection can have callbacks bound that are invoked just before the response is sent, this is where a cache plug would cache the response. Plug avoids the issue of separating request/response because for things like streaming, sending a response does not mean that the stack is done with the request. Rack has this issue with streaming and José put a great deal of thought into Plug around the lessoned learned from Rack style APIs. You can read about his thoughts here:
http://blog.plataformatec.com.br/2012/06/why-your-web-framework-should…
> From what I understand, once a Plug chooses to reply, the response ends at that Plug.
In Phoenix, we halt the connection when you use most of our functions that send a response, because there is little you can do afterwards. The Plug response API itself never halts when a response is sent.
tahon · 2021-06-22
Jose wrote a blog post on this exact question http://blog.plataformatec.com.br/2019/10/kubernetes-and-the-erlang-vm-…
LeonenTheDK · 2021-06-22
Jose Valim has a post[0] on the Platformatic blog about how Elixir and Kubernetes can happily co-exist together, and that each solves problems at different levels.
[0] https://blog.plataformatec.com.br/2019/10/kubernetes-and-the-erlang-vm…
elcritch · 2020-11-21
It's more about fine grained control of errors. WASM/Lunatic could bring many of the benefits of Erlang application design to any wasm friendly language. The creator of Elixir has a nice writeup of the Actor mentality and k8s: http://blog.plataformatec.com.br/2019/10/kubernetes-and-the-erlang-vm-…
hellofunk · 2020-07-23
Case you’re curious, Nubank has done the same thing for the Elixir language!
http://blog.plataformatec.com.br/2020/01/important-information-about-o…
bmitc · 2020-07-19
I'm not for sure exactly what you mean by immutable variables, but if you are referring to Erlang not being able to rebind variables, then you might check out Elixir, which does have variable rebinding. All data in Erlang and Elixir is immutable but the rebinding of variables is handled differently between the two.
http://blog.plataformatec.com.br/2016/01/comparing-elixir-and-erlang-v…
manthideaal · 2020-03-30
Using so many microservices seems like a good use of erlang, googling I found: (1)
(1) http://blog.plataformatec.com.br/2019/10/kubernetes-and-the-erlang-vm-…
sandGorgon · 2020-01-27
This is the first release of Elixir after the Nubank acquisition of the parent company - http://blog.plataformatec.com.br/2020/01/important-information-about-o…
conradfr · 2020-01-07
Another news, Nubank buys Plataformatec (José Valim's company).
http://blog.plataformatec.com.br/2020/01/important-information-about-o…
rupurt · 2020-01-06
Of note regarding Plataformatec open source projects: http://blog.plataformatec.com.br/2020/01/important-information-about-o…
kungfooguru · 2019-10-28
Hi, one of the authors here, the Docker chapter and soon to come Kubernetes chapter hopefully shed some light on this very question. They are not alternatives, docker and k8s complement Erlang.
Jose Valim, creator of Elixir, also wrote about this recently http://blog.plataformatec.com.br/2019/10/kubernetes-and-the-erlang-vm-…
andruby · 2019-02-27
Link to the announcement http://blog.plataformatec.com.br/2019/02/announcing-broadway
rehemiau · 2018-11-29
Announcement link: http://blog.plataformatec.com.br/2018/11/lets-learn-elixir-together-wi…
lobo_tuerto · 2018-11-08
Yes you are. You'd need to take a look at what OTP brings to the table of supervised-processes and fault tolerance.
Maybe this can help shed some light on it: http://blog.plataformatec.com.br/2018/04/elixir-processes-and-this-thi…
glorioustao · 2018-04-10
The creator of elixir had a blog on this: http://blog.plataformatec.com.br/2016/01/comparing-elixir-and-erlang-v…
pmontra · 2017-06-29
Most but some don't. This fails in Erlang
X = X + 1.
because even variables are immutable.
This is ok in Elixir even if it kind of fakes it [1]
x = x + 1
and it's perfectly ok in Ruby and most other languages.
[1] http://blog.plataformatec.com.br/2016/01/comparing-elixir-and-erlang-v…
qaq · 2016-06-07
I obviously phrased it poorly as not to copy too much text
the post by Jose Valim on the topic:
http://blog.plataformatec.com.br/2016/01/comparing-elixir-and-erlang-v…