5 ms·
I find this quite funny because it's my first time hearing I was supposed to be thinking of Elixir as a Ruby thing. I actually learnt about it from a concurrent
by phreack 6y ago
I find this quite funny because it's my first time hearing I was supposed to be thinking of Elixir as a Ruby thing. I actually learnt about it from a concurrent computing class and it was always an Erlang thing, and now I know it as the magic sauce behind Discord that I always want to try and never find a good reason to.
- linux2647 6y ago> I always want to try and never find a good reason to As someone who learns best by doing, what are some practical projects that someone could do to learn Elixir? I know that Elixir is quite capable of solving certain kinds of problems very elegantly, but maybe my experience hasn’t presented these kinds of problems yet. Outside of building a Discord-like server or a Phoenix web app, what other good practical projects/applications are there for Elixir?
- anko 6y agoif you need to do some batching operations such as read from a queue, do some processing and publish to s3, I can recommend Broadway https://github.com/dashbitco/broadway https://github.com/dashbitco/broadway I have seen lots of codebases in lots of languages do this type of task, but aside from maybe spark on the high end, i haven't see it done better. The beauty of erlang is your code reads like synchronous code so it's easy to read/maintain, but it has all the power of the parallelism of async code.
- searchableguy 6y agoRobotics/iot applications.
- dnautics 6y agoI'm probably the crazy one in the community who is using Elixir for the most super-strange things. For example: - as a custom DHCP server to do multiple concurrent PXE booting (among other things) - as a system for provisioning on-metal deployments (like ansible but less inscrutable). - as a system for provisioning virtual machines over distributed datacenters. I'll probably also wind up doing DNS and HTTP+websocket layer-7 load balancing too by the end of the year. Probably large-size (~> 1TB) broadband file transfer and maybe even object storage gateway by next year. I've rolled most of these things out to prod in just about year. I honestly can't imagine doing all of these things in Go, without a team of like 20. Elixir sucks at: - platform-dependent, like IOS, android, or like SDL games or something, - number-crunchy, like a shoot em up, or HPC. - something which requires mutable bitmaps (someone this past weekend brought up "minecraft server"). Actually even desktop might be okay, especially if you pair it up with electron.
- grantjpowell 6y ago> Elixir sucks at: > number-crunchy, like a shoot em up, or HPC. > something which requires mutable bitmaps (someone this past weekend brought up "minecraft server") One thing I'd like to see for the BEAM communities long term are well maintained libraries of NIFs[0] for high performance and possibly mutable data structures. Projects like rusterl[1] and the advances made on dirty schedulers make this more feasible than it used to be. It would be cool to write all the high level components of a minecraft-esque game in Elixir, and drop down to rust when you need raw performance. Similar to the relationship between lua/c++ in some modern game engines [0] http://erlang.org/doc/man/erl_nif.html http://erlang.org/doc/man/erl_nif.html [1] https://github.com/rusterlium/rustler https://github.com/rusterlium/rustler
- dnautics 6y agoI'm in agreement; though I don't like rust (can't read it) and am the author of https://hexdocs.pm/zigler/Zigler.html https://hexdocs.pm/zigler/Zigler.html
- linux2647 6y agoThese are some good examples, and I highly appreciate you pointing out Elixir’s downsides. What are you using to store state? The distributed system itself? An external database? Hybrid approach?
- dnautics 6y agocurrently my main system in prod is a (very smart) stateless caching system, I don't have a database, but I will eventually spin up a (probably amazon) database, for the web gateway, when the keys to that are handed over to me. One of the nice things is that using elixir really puts you in the mindset of thinking hard about who should have responsibility for "the truth". No hiding behind objects backed by ORMs. State is pushed out as far as possible to the edge and I don't trust my server to keep state correctly. As soon as it's at risk of being inconsistent (netsplit, e.g.) the state-holders in the server are slaughtered, rebooted, and told to reconnect to the edge machines, which are trusted with the truth. The nice thing about elixir is that restart logic costs the the price of like 5-6 lines of code across the entire codebase (no worrying about cleaning up resources like tcp connections or anything). Not in prod (personal project), I have a websocket-scraper on an aws free tier that's dropping data into a sqlite file, that I can transfer to my laptop for offline processing, so there are lots of interesting options.
- smabie 6y agoA BitTorrent client would be cool. I wrote one in Scala+Akka and the actor model is great. It's even better when the runtime supports preemption, like Elixer.
- mulander 6y agoAn erlang BitTorrent client exists: https://github.com/jlouis/etorrent https://github.com/jlouis/etorrent
- TylerE 6y agoIt's not really a weird thing because basically all of the Elixir/Phoenix core teams were big RoR contributors.
- dgellow 6y agoDiscord switched to Rust some time ago: https://blog.discord.com/using-rust-to-scale-elixir-for-11-million-concurrent-users-c6f19fc029d3 https://blog.discord.com/using-rust-to-scale-elixir-for-11-m... Still a very impressive use of elixir IMHO.
- blixtsnabb 6y agoThe article says nothing about them switching to rust. They implemented a specific data structure in rust using elixir NIFs (native interface). This is equivalent of calling a C library from other languages.
- nesarkvechnep 6y ago"Our core services aren’t written in Rust, they are Elixir-based." They haven't switched, just use Rust at some places for performance improvements.
- dgellow 6y agoMy bad, I visibly remembered the article incorrectly and didn’t take the time to read again when sharing. Thanks for the correction. Unfortunately I cannot edit my original comment.
- xlii 6y agoBased on article they didn’t switch to Elixir but instead are using Rust within Elixir in order to solve complex performance issues.
- sodapopcan 6y agoOthers have already repeatedly mentioned this was a performance optimization. Elixir/Erlang is not particularly good for heavily CPU bound tasks--This is by design. For lack of a better source, here is a post on the Elixir forum from Robert Virding (one of the creators of Erlang) on the subject: https://elixirforum.com/t/on-why-elixir/34038/62 https://elixirforum.com/t/on-why-elixir/34038/62
- deleted 6y ago
- AlchemistCamp 6y ago> I know it as the magic sauce behind Discord that I always want to try and never find a good reason to Don't ever want to build a web app? That's pretty much Elixir's sweet spot, IMO. You'll get great productivity, great scalability, performance that's better than popular interpreted languages and a code base that's easy to reason about. You'll also be able to do a lot from within the VM instead of relying on external services.
- conradfr 6y agoIn my mind, in a web context, Elixir is a better Nodejs. It will never be as popular though. And it's not like other languages stay stagnant. JS and TS, Java with green threads, C# with actor and LiveView like libraries.
- AlchemistCamp 6y agoAside from getting rid of decades of language cruft, mutability, etc, one thing I doubt Node will ever have is a fairly unified ecosystem with a dominant framework like Phoenix. I migrated the code base for my last startup from Node to Rails at the end of 2015, then from Rails to Phoenix at the beginning of 2016. Pretty much all of that Elixir + Phoenix 1.1 code is still fine today. There haven't been any breaking language changes and the most arduous part of upgrading Phoenix to the current version would be the front-end—replacing Brunch with Webpack and removing Bootstrap. Other than that it's just a few lines of code. The Rails app is slightly more dated but still fairly trivial to update. Most of the gems still do things in the same way and there's generally a clear way to go. The JS app on the other hand, is a pretty depressing mess of broken dependencies and multiple libraries I was using have dramatically changed their APIs. For me, productivity and ease of maintenance matter much more than popularity does when picking a tech stack.
- RandoHolmes 6y agoThis strikes me as someone chasing the shiny. Why migrate working code to a new language? And to do it twice?
- JohnHaugeland 6y agoElixir is to Erlang what Coffeescript is to Javascript: one guy who wanted a real language to feel like Ruby instead, and started with string interpolation and never stopped
- deallocator 6y agoYou are being outright negative about Elixir throughout the entire thread, generally without providing good reasons why outside what seems to be your personal bias. No one is forcing you to drop Erlang for Elixir
- JohnHaugeland 6y agoI'm not being negative in any way. These are literal measurable facts. Sorry you didn't get what was being said
- dqv 6y ago>These are literal measurable facts. I guess it's worth literally showing your measurements. The Elixir macro system is a vast improvement over merl. When people try to make re-usable gen_servers in Erlang it often becomes a mess. gen_listener in the Kazoo project is a mess and very hard to understand. I'm confident that if Elixir had been around when it was first written and they had opted to use Elixir, it would be way more approachable for developers. Another example from the Kazoo project where Elixir would help would be the ability to provide default arguments in the argument body. Elixir itself has been the genesis of several improvements and optimizations to the BEAM. These contributions came from core Elixir developers. I don't think your comparison to coffeescript is fair at all.
- dynamite-ready 6y agoActually, I'd argue that Elixir is to Erlang, as C++ is to C. Before I'd found Elixir, I had never touched Ruby, but had written some Erlang. Joe Armstrong himself was quoted as saying Elixir was some "good shit" (may he rest in peace. Super smart and super funny is a rare combination).
- alkonaut 6y agoSame. I have never even heard there is a relation to ruby, I always just thought it was just a functional language for the Erlang runtime. I had no idea the syntax was "Ruby like".