Earlier quoted context omitted.
I don't know about Oban. I don't think it's bad design for the workers to be separate from your main app like in Sidekiq (they do 'require' the app but they are essentially separate from the servers). Anyway making this point as a huge win for Elixir over Ruby seems really exaggerated to me.
It prevents unnecessarily moving data around. And if you're running the whole stack on the same server with Sideqik you're dealing with interrupts and memory copies between processes; in Elixir it's all within the same allocated memory and nothing gets copied. Plus it's another service you don't have to monitor because it's automatically monitored by BEAM.
How we got to LiveView
261–270 of 293 posts
Re: How we got to LiveView
#262Earlier quoted context omitted.
Sidekiq is not a workaround. This is a myth. Most companies need to persist their jobs (what happens during deployments or when a process dies? do u just let all the job info disappear?) and have some kind of queue system. Even Elixir has some redis backed queues. BEAM, OTP, concurrency, this whole thing is solved with the current fashion of devops teams and kubernetes. It doesn't really matter what tech stack you us…
In Elixir you'd use Oban instead of sidkiq and you get more performance and it scales out horizontally with your app. Each new instance of your app is essentially a new sideqik server as a bonus edit: > BEAM, OTP, concurrency, this whole thing is solved with the current fashion of devops teams and kubernetes. This is a hilarious statement which I hope is satire
The advantages of BEAM and OTP are that I can spawn new concurrent processes throughout a cluster and then use the actor model to send direct messages to those processes from any other processes, regardless of where the sender and receiver happen to be. I can also easily configure Behaviours so they automatically run on either a single node or every node in the cluster, depending on what they are doing.
In both cases, if a node goes down, Elixir will automatically restart any affected processes on another node. When a process has an issue, I can surgically handle that issue at the individual process level. Kubernetes doesn't handle problems that granularly.
One advantage of Kubernetes is autoscaling. OTP and BEAM don't do that.
By using libcluster, you can combine Kubernetes and BEAM/OTP and get the best of both worlds.
Re: How we got to LiveView
#263Imagine building federated tech with this. ActivityPub stuff like Mastodon, Peertube, etc. The performance on small servers would be incredible.
https://pleroma.social is an ActivityPub server like Mastodon but in Elixir.
Re: How we got to LiveView
#264Has anyone tried server-side Blazor in ASP.NET Core? How does that differ from the LiveView approach?
Currently on .NET 5 the missing of hot-reload is the biggest issue. Otherwise its really a breeze to build anything.
Re: How we got to LiveView
#265Earlier quoted context omitted.
Point is, they are just plugs. You can put routes in an endpoint, it'll work just fine. The distinction is just a -often useful- prescriptive opinion by Phoenix. (Plug does not split between endpoints and routers)
very true, but the abstraction is pretty useful
Re: How we got to LiveView
#266Earlier quoted context omitted.
It prevents unnecessarily moving data around. And if you're running the whole stack on the same server with Sideqik you're dealing with interrupts and memory copies between processes; in Elixir it's all within the same allocated memory and nothing gets copied. Plus it's another service you don't have to monitor because it's automatically monitored by BEAM.
What if you want to scale your job workers and your servers separately?
I do agree with you that's not a huge win compared with Rails, but it is nice to have. I think you'd have to look more at something like "lots of concurrent, long-lived connections" for the real wins over Rails for the BEAM ecosystem. I mean, you can do that in Ruby if you want to, but it's going to be cleaner and simpler with Elixir/Erlang.
Re: How we got to LiveView
#267Earlier quoted context omitted.
For a lot of the LiveView applications that I write (which is actually quite a few these days), I will usually lean on something like AlpineJS for frontend specific interactions, and my LiveView state is for things that require backend state. For example, if I have a flag to show/hide a modal to confirm a resource delete, the show/hide flag would live in AlpineJS, while the resource I was deleting would live in the s…
I'm surprised to see so few mentions of AlpineJS. Personally, PETAL has become my de facto stack.
Re: How we got to LiveView
#268Earlier quoted context omitted.
https://pleroma.social is an ActivityPub server like Mastodon but in Elixir.
Would be awesome if a Pleroma front-end was written in this way. Just host one app that is ultra-performant.
Re: How we got to LiveView
#269Earlier quoted context omitted.
There is a misplaced `}` :) He actually wanted to do : def handle_event(save, params, socket) do ... {:noreply, socket |> put_flash(:info, "It worked!" |> redirect(to: "..."))} end which would work.
Ah. It's a nonstandard formatting though.
def handle_event(save, params, socket) do
socket = socket
|> put_flash(:info, "It worked!")
|> redirect(to: "...")
{:noreply, socket}
end
I feel like it's more readable this way.Re: How we got to LiveView
#270Earlier quoted context omitted.
Hi. I got a couple of things: I seem to remember in the original announcement presentation there was a demo of SVG being updated inside a page 60 times per second. All from server. Did this actually become feasible? I’m thinking graphs and maps with live data. I might not need as smooth animation there. Though that could make for nice dashboards. Other bit that interests me is web apps for long running tasks. What’s…
The 60fps rainbow works as a fun stress test demo, but really you should not be pushing events down the wire every 16ms to animate something on the client :) That said, you are right that SVG charts/maps are a surprisingly fantastic fit for LiveView. You could actually render a fully interactive and dynamically updating chart by only sending SVGs – and it will probably send less data than hydrating the same client-si…