4 ms·
LiveView has been pretty great. Mostly it's just a couple of `handle_event` methods away and we have a fully reactive UI. I haven't seen any scaling issues for
by eclark 4y ago
LiveView has been pretty great. Mostly it's just a couple of `handle_event` methods away and we have a fully reactive UI.
I haven't seen any scaling issues for LiveView. Under the hood there's a websocket that push and pull events from a running GenServer for each session. Since each process is independent it's horizontally scalable as long as your able to route websockets to the same process in a cluster.
While not the same, I do know that single machine has been able to scale to a couple of million connections ( https://www.phoenixframework.org/blog/the-road-to-2-million-websocket-connections https://www.phoenixframework.org/blog/the-road-to-2-million-... ) with phoenix channels. Which are harder to scale than independent live views. Also our use case is for smaller scale than that (Not too many companies have a million people looking at their ml deploy pipelines) so I haven't been too worried.
- tiffanyh 4y ago@chrismccord If you’re reading this, would be super interesting to update this 7-year-old benchmark to use Live View (and the latest stack). Thanks for all you do btw.
- h0l0cube 4y agoCould even switch over to Bandit which was on a recent Thinking Elixir podcast > In recent performance tests, Bandit's HTTP/1.x engine is up to 5x faster than Cowboy depending on the number of concurrent requests. When comparing HTTP/2 performance, Bandit is up to 2.3x faster than Cowboy https://github.com/mtrudel/bandit https://github.com/mtrudel/bandit
- tiffanyh 4y agoThat’s a great point and Phoenix 1.7 is the first release to support the usage of other web servers. 2-5x speed up would make Erlang surprise Java/Go/etc. https://stressgrid.com/blog/webserver_benchmark/ https://stressgrid.com/blog/webserver_benchmark/
- h0l0cube 4y agoBandit is written in pure Elixir which is a bit undesirable to integrate with pure Erlang projects. From what I gleaned off the podcast, it's a subset of the HTTP features available in Cowboy, specifically those that are available on the Phoenix side, and cleaving off the unused functionality realized much of the performance benefit.
- mcmatterson 4y agoBandit author here. Correct! The byline of Bandit is ‘a web server for Plug applications’ and being able to focus on that narrowed set of requirements is a large part of where the perf boost comes from (less code, easier to reason about, fewer processes, etc).
- eclark 4y agoI don't think that 1.7 is going to really have bandit fully supported on launch: https://github.com/phoenixframework/phoenix/pull/5071 https://github.com/phoenixframework/phoenix/pull/5071 Once it is supported though, I will be on that for sure.
- mcmatterson 4y agoBandit author here. We’re fully supported on phx 1.7+; it’s a one line change to your existing app, described on the Bandit readme!
- mcmatterson 4y agoThe PR you linked to adds support for generating new phx apps with the relevant change already incorporated; it’s just a generator change. We’re waiting a bit to incorporate this change to ‘soft launch’ Bandit support.