479 points · by eugene_pirogov · 9y ago · 163 comments
We have published a draft version of the announcement since the release notes are not super helpful for those unfamiliar with Elixir. Is it possible to update the link to the official announcement? Thank you!
EDIT: We are done with the changes on the draft. We've added asciicinema snippets to show some features, improved the section on Calendar changes and also mentioned the compilation time improvements (expect at least 10% faster compilation).
I built a side-project powered by Elixir & Phoenix 1.2, I found it so surprisingly quick and easy to accomplish even complex functionality. Every time I implemented a new feature server-side it honestly felt like "Is that it? Really?"
It's not a perfect measure but it does a solid job of giving me the whole experience of working with a language on something similar to day to day and separates the "this is viable as a tool" from "OMG! BENCHMARK!" type experiences.
Doing this with Elixir and Phoenix was mind blowing. It was so clean, efficient to work with, efficient in performance and the design decisions around the language almost ensure you'll avoid entire classes of debugging / maintenance issues in the future. I was blown away.
Wrote about it here: http://www.brightball.com/articles/insanity-with-elixir-phoe...
Keep in mind, there are a number of things that I did there that could have been done better/cleaner. It was my first experience with the language.
I believe I first read this idea in the book, Elixir in Action.
I've had a few issues with the version of rustler published on hex.pm not working with Erlang/OTP 20, and I've tried using the master repo as a dependency in my `mix.exs`, but that didn't work since rustler repo has an unusual directory structure which fails to compile. And then lo and behold, I've discovered how amazing the `mix` tool is and via `mix help deps` I've learned that you can actually check out a specific directory (via `sparse` option) from a remote repo as your dependency.
Now my dependency listed in `mix.exs` looks like this:
{:rustler, ">= 0.0.0", git: "https://github.com/hansihe/rustler.git",
tag: "0.15.1", sparse: "rustler_mix"}
... and problem solved. I guess peeking at rustler's tests helped me a lot.All in all, the entire Elixir ecosystem is really elegant. Such a joy to write code now!
It tough now since the web space is very competitive.
Before that it's just PHP (well it displaced Perl) and then RoR pop out to give it a real competition. For a while you'd think Ruby was going to over take PHP for web dev but it eventually converge to a steady state the growth rate isn't increasing at all. If you look at tiobe index and red monk's for language popularity Ruby have either stayed teh same and move down a few spot. Javascript just sky rocketed after nodejs (this is relative I remember the first year or so where it was slow in term of growth, hype, and adoption).
There are so many web dev pie out there for each language to take a chunk. After RoR was nodejs, this is on top of the other smaller player groovy, python django, java stuff, etc.. a least major players within the startups that I've experiences.
I believe Elixir and Erlang is a very great language for web dev. Unfortunately it comes into a time where the market is very competitive with many alternative out there staking a claim for this field.
At this point the web industry is really really hype imo. And people eat this up like candy.
I can say for sure Elixir is a better concurrency model and better language than NodeJS will ever be for web development. And the hype if there is any is real for Elixir.
Rails downloads almost doubled from 2015 to 2016 (15M -> 24M). Not sure where you see that the "growth rate isn't increasing at all".
Source: RubyGems db data dump (more stats here: https://infinum.co/the-capsized-eight/analyzing-rubygems-sta...)
[1] https://www.indeed.com/jobtrends/q-Erlang-q-Elixir-q-Haskell... (scroll down to 2nd chart)
http://www.reallyhyped.com/?keywords=elixir%2Cerlang%2Ccloju...
http://www.techworld.com/apps-wearables/how-elixir-helped-bl...
They went from 150 Rails servers to 5 BEAM servers "and could probably get away with two" (!)
Massive thanks to the devs who work on it.
[1](https://pragprog.com/book/elixir13/programming-elixir-1-3)
I think practitioners of functional languages get a little preachy when really, exposure to functional languages should just be assumed to be part of the basic training of any engineer. It's a tool and as good as it is for some things, it's absolutely awful for others.
It's not just a matter of syntax and such but a whole new way of thinking - specifically immutability, functional aspect, using lightweight processes, hot code loading, sane handling of crashes and restart, easy tracing, etc. allow approaching and solving problem in whole new ways that is often a lot more efficient (both performance wise but also operations-wise).
Even if you switch to using other language you'd find yourself trying to apply some of these techniques so it is a useful set of things to learn about.
But agreed, it's still worth the effort to learn as many new languages as possible. It will make you a better programmer.
Haskell and Erlang were particularly eye-opening for me, but Scheme/Clojure was a great entry point into FP.
Functional programming only starts to show its power with types and parametric polymorphism (higher kinds, etc...). Without type annotations, all you get is a watered down, crippled version of what a functional language can achieve.
Second... While I love static typing as much as the next guy, there's definitely value in immutable data in a dynamic language. You also get Dialyzer in Elixir/Erlang, which is an interesting alternative to the usual type systems you find in Haskell/Rust/etc. in that it focusses on finding places where there's provably a problem, rather than where it's not provably correct.
Sure, but there's even more value in immutable data in a statically typed language, because of all the advantages that come with such a language (automated refactoring, better performances, tooling, etc...).
I should know better than to use the word "pure" on the internet, someone will always correct how inaccurate my usage is :)
Can someone suggest a fun project, which can showcase the features of functional programming?
https://pragprog.com/book/elixir14/programming-elixir-1-4
Anyone have any other suggestions on up to date Elixir books?
v1.5 seems to have a bunch of bug fixes and deprecation (Hah! I'm not sure if it's like move fast and break thing). It is potentially the case.
In every important part, there seems to have a solo smart person working on it. E.g. Cowboy(I know it's erlang but Phoenix depends on it significantly), Distillery. That could be a good thing. Less people may catch up with each other faster. It also mean a load of works! And also mean some convention are out of sync (e.g. configuration which I think Conform is the proper way lately)
It is definitely not the case. :) If anything breaks, please fill in a bug report and it will be fixed immediately.
I've been hosting my site at https://clever-cloud.com with good results. I've been using Docker there but they just added beta Phoenix support which makes it really easy. They're French, and I'm in the US. So there have been time zone issues and support has been a bit lackluster at times, but generally they've fixed all the issues I've brought up and have been responsive. Price is right.
[0] https://github.com/bitwalker/distillery
[1] example dockerfile: https://gist.github.com/bsedat/16cb74ebc8ab0ed61ac598a129b0a...
I built a small Phoenix project about a year ago, and compared to Rails it wasn't quite as fluent but still pretty nice. But ever since then, I've been trying to decide if the extra development time is worth it for the performance gains. I get that Elixir is more scalable, and I love how the RAM requirements compared to Rails are tiny, but what I still haven't been able to really answer is the latency improvement. According to these benchmarks it is about as fast as Django:
https://www.techempower.com/benchmarks/#section=data-r14&hw=...
Is that really the best I can hope for?
I've seen several instances of this, now. Some Rails benchmarks jumped up pretty high as well when they managed to get someone to competently configure Puma. Practically the same story, just changing out names.
Take techempower benchmarks with a boatload of salt. Not only are they not particularly representative of your real world use cases, they apparently are often not representative of competent use of the tools they're benchmarking.
Hopefully this is an issue the techempower people figure out some way to address. It would be nice if this was a more trustworthy resource.
http://www.phoenixframework.org/blog/the-road-to-2-million-w...
I went from an elaborate multi-tier caching setup, with varnish and memcache, to a ZERO caching setup. The amount of complexity reduced by doing this is huge.
The Elixir app hits the postgres db for nearly every request and I'm getting average response times around 45ms. Quite a bit of that is database wait time. It's super stable and efficient. And I'm running it on a dirt cheap, tiny node in the cloud, where before I needed two small EC2 instances to keep up with peak loads.
Also, now that I've gotten the hang of it I think it's actually more efficient with regards to development than either Django or Rails.
Here are the google crawler response times directly before/after the switch to Phoenix: http://imgur.com/a/FASyJ
I mostly agree with DHH that response time is dominated by database queries and Rails is "fast enough". Most problems you can fix by improving your query patterns or doing some SQL tuning. And yet . . . Rails is still awfully slow! Most companies don't have time for Russian-doll caching, let alone making the designers consider that at design time. I would love to use something as effortless as Rails that still gave me snappy performance well into the app's maturity.
I'm fairly confident Elixir can do that, but it's hard to look at these benchmarks and come on HN and hear the Elixir folks saying, "Just trust me." There is a strong temptation to walk away thinking it just doesn't live up to the hype. So having some hard numbers is a great reassurance. Thank you!
Also, when I used rails, quite a bit of time was spent wrapping the data into active record objects, whereas Ecto returns simple data structures, which seems to be much faster.
The one at the top is proxying the request to a java app which happens to be a little slow.
To some Go web api frameworks perhaps.
To the JVM, not really. The frameworks I used with it in the past (spring/play/coupleOtherSmallOnes) are throttled to the number of threads for concurrent connections. The BEAM (Erlang/Elixir) has no such limitation and it blew away my old Java servers handily just due to its concurrency alone.
And not to nodejs at all. Running a single BEAM vs a single node there is no comparison, the BEAM runs circles around it. With nodejs you can shard it out to multiple running instances to get concurrency better but you run into OS limits far before the workload that the BEAM can handle.
For example, Jetty will beat every HTTP hello-world you can write in Go. I know because I've tried to beat Jetty in Go.
I'm not sure I like the child_spec change, personally I like the supervision mode to be explicit when calling children.
I do like the developer tools, the breakpoint support, the UTF8 for atoms (which I'm realizing we may want in our DSL since we're converting user input strings to atoms), and the @impl that allows to explicitly declare which functions are there for an interface.
Overall, it's amazing to be part of the elixir community, rarely have I seen such emulation, positivity, speed of growth, and effectiveness achieved so fast for a language. Congrats @josevalim for bring the power of BEAM through a wonderful syntax!
careful there. Theres a hard limit on the number of atoms that can be created in an environment, and serializing user input to atoms can get dangerous
Seems like a pretty good language endorsement to me lol
EDIT: Here's a "curated list of companies using Elixir": https://github.com/doomspork/elixir-companies
mix test mix docs Genserver Pattern matching
The list goes on, you find yourself in The Zone more often.
http://www.phoenixframework.org/blog/the-road-to-2-million-w...
Well done!
I personally haven't tried it out of personal preference and instead had a great experience coupling Vue with a Phoenix backend.
There is an ElixirScript project in current dev, still early but usable, that compiles Elixir code to javascript too.
[0] https://www.dailydrip.com/topics/elixirsips/drips/phoenix-an...
I've been using Elixir for almost two years now and it's no silver bullet, but overall it has been a really great experience.
[ExUnit] Show code snippet from test source file in case of test errors
ExUnit backtraces have historically been a bit hard to read sometimes IMHO.
I am afraid this change will not improve the qualify of the stacktrace itself.
If you run into a situation where the test report is less than ideal, please open up an issue so we can discuss if there is something that can be done about it.
for instance if empty list is truthy, this pseudocode won't terminate if tail is defined to always be a (possibly empty) list:
while seq:
head, seq = seq.head_tail()
f(head)Parens aren't used for any collection type in Elixir ( `(1,2,3)` is just a syntax error), so the lispyness explanation for () being nil in Elixir, while neat, doesn't really make sense
NULL is a predicate which does the same as NOT, but makes the intent clear. It also allows to move the code to a dialect where NIL and FALSE are different.
Sussman and Steele had the good sense not to call Scheme "<something> Lisp", because they knew that it would "ring falsey".
There is also https://github.com/hashrocket/gatling that promises the Git push workflow but with hot upgrading capability.
A multistage build makes it easy to compile a release on a macOS system and create a minimal alpine docker images with the unpacked .tar.gz release. (My app is an ~84MB docker images)
It's a very IO-bound problem (how many requests I can make while staying within rate limits / not taking down a service), so Elixir is a great fit for coordinating all of the concurrent work involved in security scanning.
Other uses where Erlang shines are a great fit for Elixir too: WhatsApp, Goldman Sachs uses Erlang for Trading, Heroku's routing mesh, ...
I think with Nerves, Elixir fits well on embedded platforms. Its supervision trees make it easier to create fault tolerant systems, and the actor model is great for concurrency.
Now with this change, you are free to mark those functions in MyFoo with `@impl true`. It's entirely opt-in, but once you use it, it enforces the presence of `@impl true` on all MyFoo's callback implementations. This allows the programmer to make these functions' purpose clear, and uses the compiler to make sure the annotations aren't stale or incorrect.