Live data from Hacker News

Elixir and Phoenix after two years

nts.strzibny.name

51–60 of 111 posts

Re: Elixir and Phoenix after two years

#51

Big fan of Elixir. First and third party libraries are typically very high quality; community support is great; and documentation is best in class. Right now, I’m trying to find a way to speed up builds in CI because they’re the biggest bottle neck to deploying. Building an umbrella with 5 apps, 3 of which are phoenix, leveraging parallelised docker buildkit, will still take 8~ minutes.

Interesting. Elixir builds are the fastest builds in my CI pipelines. I make sure to cache the builds/ folder; usually only a small amount of files need to be re-compiled, which is very fast. This was actually improved even further in Elixir 1.11 [0]. Compared to TypeScript + React and Java, Elixir build times are significantly better.

[0] https://github.com/elixir-lang/elixir/blob/v1.11/CHANGELOG.m...

Re: Elixir and Phoenix after two years

#52

i'm not a web developer but enjoy paying attention to this space from the sidelines. elixir and phoenix are wonderful. the phoenix liveview is a fantastic piece of technology; it moves the processing to the backend and allows the web application to be developed in the same language (mostly). i just recently discovered microsoft blazor and it seems like it's an even better improvement. compared to liveview, the comput…

I'm an Elixir developer, and I love the language, but I'm not sold on Phoenix LiveView. It sounds really cool, but it seems like there are too many edge cases. How do you scale it horizontally? What happens to user state when a connection is dropped? What do you do when you get a business requirement that hits one of LiveView's pain points? What if you have to swap out your backend for business reasons, and now you have to rewrite your frontend, too? I'm not trying to talk anyone out of LiveView; these are just the thoughts that prevent me from getting excited about it.

Re: Elixir and Phoenix after two years

#53
post #2

What are people finding as the real sweet spots for Phoenix? I have used Erlang very successfully in a semi-embedded context, but that's quite different from a web server that can usually be scaled horizontally pretty easily. One obvious one is if you have to hold open a lot of concurrent connections like web sockets. It'd be great for that. Others?

In terms of language, Phoenix is a complete replacement for Rails for me. I feel more comfortable growing a functional codebase, and the BEAM means I don't have to worry about scaling as soon as I would with Rails. I think it's a good fit for when you want to do more with a small, experienced team. I would reach for Rails when I'm concerned about finding developers (Elixir devs are fewer and more expensive, generally…

I worked at a well known company running Erlang. Out of maybe 25 people hired to work on software in Erlang, I think two had used it before, and they were hired several years after Erlang became our key enabling technology. I was ahead of many because I remembered seeing the slashdot post when it was open sourced.

If you hire smart and flexible people, and give them a bit of time to learn the syntax, Erlang and I assume Elixir will bend their mind to a new shape, and they'll be fine.

Figuring out what you want the computer to do, and what steps will be needed are much more important than the specific syntax you use.

Re: Elixir and Phoenix after two years

#54
post #46

I wish more Node.js people shake off their Stockholm syndrome and check out Elixir and Phoenix.

Let me tell you the single reason I haven't switched to Elixir yet: I develop backend and frontend (SPA) so I'd rather just stick with a single language and library catalog. It helps that there's plenty of libraries in JS land too. I would love to just write elixir code but at the end of the day I feel sticking with node+browser js is the more pragmatic choice right now.

Isn't phoenix meant to remove the JS dependency on FE dev? (Not arguing with any of your points btw, JS is matter-of-factly more popular and pragmatic).

Re: Elixir and Phoenix after two years

#55
post #2

What are people finding as the real sweet spots for Phoenix? I have used Erlang very successfully in a semi-embedded context, but that's quite different from a web server that can usually be scaled horizontally pretty easily. One obvious one is if you have to hold open a lot of concurrent connections like web sockets. It'd be great for that. Others?

We used Elixir to implement a columnar database and Phoenix for the web front end, which was about 20% of the code. It’s very convenient having all the tests run together, including end to end integration tests. Elixir (with NIFs) has the necessary performance for the database layer, and Phoenix has the necessary productivity for the web layer, and we don’t have to switch languages to work on both.

Pretty curious about this, are there more details that are publicly available? The only thing I can find about this is some meetup from 2018 with a speaker from Pinterest.

Re: Elixir and Phoenix after two years

#56
post #36
post #4

Earlier quoted context omitted.

It's pretty great anywhere that you might use Rails or Django, but if you expect spike in traffic that are hard to predict you get nice stable worst case latency. I think it's also really good if you need to hold state server side for any reason.

Rails has a ton of high quality code available for it. It looks to me like Phoenix is certainly 'good enough' for a lot of tasks, but it just hasn't been around as long. I'm looking for those use cases where someone picked Phoenix and it was just clearly a better tool than, say, Rails because of X, Y, and Z, despite maybe being inferior for one or two other things.

I can add a bit of my experience. I used Rails here and there since 2.3 and have followed Elixir since its inception.

- Channels in Phoenix are just a joy to use compared to ActionCable. This is partly due to the language (pattern matching, especially) but not having to deal with a Redis instance (and/or AnyCable) is also appealing. It just works out of the box and is ridiculously performant.

- I find the Repository pattern much easier to wrap my head around than ActiveRecord. I feel like with Rails, I always have to know the state of an object whereas w/ Ecto, things are more explicit. I know some people prefer AR here, but I prefer not making an accidental query.

- I feel like I am lost every time I'm in a Rails project with so many abstractions now. Maybe this is me being a curmudgeon, but I remember being able to trace request all the way from where it hits the machine (say, Nginx) to the HTML rendering even with Rack. Now, if I had to do something similar, there are so many layers to peel. This is again partly due to the language, and partly to Rails' age.

Re: Elixir and Phoenix after two years

#57
post #3

To add to the author's experience, I spent 18 months of production time with Elixir and Phoenix. As he says, the templates are compiled and are blindingly fast compared to Rails. Pattern matching is really really nice when used in the right places (and you'll miss it if you go back to Ruby); but it can be overused. There's a faction of Elixir folks who attempt to avoid all conditionals and instead seem to prefer mult…

Don't know Elixir. Understand a bit about pattern matching from dabbling in OCaml and F#. Not clear about this:

>you have to basically mentally imagine what all cases are covered and what they mean

Why? Isn't the logic clearly specified in some way by the multiple dispatch/multi-methods? Because if not, how does the program work? So shouldn't a user be able to read the multi* code, and understand it, just like they can with if/else statements?

Re: Elixir and Phoenix after two years

#58
post #57
post #3

To add to the author's experience, I spent 18 months of production time with Elixir and Phoenix. As he says, the templates are compiled and are blindingly fast compared to Rails. Pattern matching is really really nice when used in the right places (and you'll miss it if you go back to Ruby); but it can be overused. There's a faction of Elixir folks who attempt to avoid all conditionals and instead seem to prefer mult…

Don't know Elixir. Understand a bit about pattern matching from dabbling in OCaml and F#. Not clear about this: >you have to basically mentally imagine what all cases are covered and what they mean Why? Isn't the logic clearly specified in some way by the multiple dispatch/multi-methods? Because if not, how does the program work? So shouldn't a user be able to read the multi* code, and understand it, just like they c…

one difference is that you can really afford to be lazy with elixir. If your pattern match fails, one option is to let it throw a MatchError. Especially if the failure is rare, you just let the process die and your supervisors will restart the process into a sane state, and hopefully the next time you hit the code path it will be ok (for example: you are calling out to a 3rd party web service and they have a brief service outage, or some backhoe went over a network link and killed your packets).

Re: Elixir and Phoenix after two years

#59

i'm not a web developer but enjoy paying attention to this space from the sidelines. elixir and phoenix are wonderful. the phoenix liveview is a fantastic piece of technology; it moves the processing to the backend and allows the web application to be developed in the same language (mostly). i just recently discovered microsoft blazor and it seems like it's an even better improvement. compared to liveview, the comput…

I'm an Elixir developer, and I love the language, but I'm not sold on Phoenix LiveView. It sounds really cool, but it seems like there are too many edge cases. How do you scale it horizontally? What happens to user state when a connection is dropped? What do you do when you get a business requirement that hits one of LiveView's pain points? What if you have to swap out your backend for business reasons, and now you h…

> How do you scale it horizontally

If you're using Phoenix PubSub for your message queue, then it scales out automatically over PG2 clusters.

Re: Elixir and Phoenix after two years

#60
post #55

Earlier quoted context omitted.

We used Elixir to implement a columnar database and Phoenix for the web front end, which was about 20% of the code. It’s very convenient having all the tests run together, including end to end integration tests. Elixir (with NIFs) has the necessary performance for the database layer, and Phoenix has the necessary productivity for the web layer, and we don’t have to switch languages to work on both.

Pretty curious about this, are there more details that are publicly available? The only thing I can find about this is some meetup from 2018 with a speaker from Pinterest.

I, too, want to hear about this mythical columnar database in Elixir (or databases!!, if there are two!).
Post reply on HN