3 ms·
I've never used LiveView. Why is an asynchronous programming model required to pull it off?
by lopatin 4y ago
I've never used LiveView. Why is an asynchronous programming model required to pull it off?
- pmarreck 4y agoall client state is replicated server-side. that means spinning up and down completely isolated threads very quickly. only a stack with immutability to the core and VERY efficient processes (such as OTP threads) can guarantee this while also providing nearly instantaneous spawning from any state (thanks to immutable data structures). Every client that has a page open to your site has a tiny thread running in OTP (it does not use OS-level threads). No other popular language can pull this off.
- tylerchurch 4y agoIt's all about a persistent connection between the client and server, with the server pushing updates to the client as new data/events come in. If you don't have a good async model, you're down to a thread/process per connection, which can get very expensive since you will have a thread for every user on your site. You need something like Erlang's lightweight internal "processes", golang's coroutines, or maybe even Node.js evented I/O async model to handle this well.