Re:Ruby’s Rack Push: Decoupling the real-time web applicatio...
by pmontra on Tuesday May 01, 2018 @05:38PM
(#16971946)
A separate websocket server is a huge pain in any language. A great feature of Phoenix for Elixir is that the webserver and the websocket server are in the same process tree.
I'll try this new approach for Ruby and see how it scales.
Re:Ruby’s Rack Push: Decoupling the real-time web applicatio...
by jkarneges on Tuesday May 01, 2018 @07:55PM
(#16972863)
I agree separate servers can be a pain, especially in a development environment. But I also believe separate servers can be a useful architecture in production, regardless of whether the web framework being used is thread-per-connection or event-driven.
Using separate servers can make it possible to upgrade/restart the backend process without necessarily disconnecting clients. It can allow managing/scaling the front tier separately from the back tier, which can make sense if you already do this for your request/response stuff (e.g. cache tier separately managed/scaled from web service tier). It's also a sane way to manage long-lived connections from a function backend like AWS Lambda, so the function doesn't have to run for the entire duration of a connection.
I created Pushpin (https://pushpin.org) to attempt to standardize this split-process architecture for all languages. It is a bit of a pain in a development environment, but a lot of fun in production. :)
Re:Ruby’s Rack Push: Decoupling the real-time web applicatio...
by qaq on Tuesday May 01, 2018 @07:59PM
(#16972886)
You bring up a lot of important points none of which apply to Elixir/Phoenix. In Erlang/Elixir world you can even live upgrade a running system to a new release without restart.
Re:Ruby’s Rack Push: Decoupling the real-time web applicatio...
by jkarneges on Tuesday May 01, 2018 @09:08PM
(#16973264)
Can you really live upgrade an Erlang process without disconnecting TCP connections it is using? If so that's really interesting, would be curious to learn more.
Re:Ruby’s Rack Push: Decoupling the real-time web applicatio...
by jeremyjh on Tuesday May 01, 2018 @10:17PM
(#16973556)
Yes, you don't actually restart the Erlang VM; it loads your new application code (byte code) and sends the next message/request it receives to the newly loaded module. The default state for any process is to be blocked on receiving a new message. Processes in the middle of an I/O operation for example, will get the new code after it finishes that operation and waits to receive its next message.
Re:Ruby’s Rack Push: Decoupling the real-time web applicatio...
by bowild on Wednesday May 02, 2018 @07:33AM
(#16975919)
You have great points as far as application architecture is concerned.
However, as far as server architecture goes - even if we separate the application into two different processes (HTTP and WebSockets), the current situation is that the WebSocket server in Ruby will run two IO reactors / "servers" internally (unless you use a custom WebSocket enabled server such as iodine).
This post is more about the way WebSocket servers are implemented using Rack than about the question of application architecture.
Re:Ruby’s Rack Push: Decoupling the real-time web applicatio...
by sametmax on Wednesday May 02, 2018 @06:56AM
(#16975733)
It does have drawbacks, but having use crossbar.io for python/js/java/php, the benefit is huge if it abstract away the transport and gives you well crafted high level primitives such as routed rpc and pubsub out of the box.
Also, you can switch to microservices later for peanuts.
Re:Ruby’s Rack Push: Decoupling the real-time web applicatio...
by lazyloop on Tuesday May 01, 2018 @07:28PM
(#16972705)
One of the reasons i really like Perl is Mojolicious. Thanks to it we don't need separate servers for websockets and HTTP anymore. https://mojolicious.org
Re:Ruby’s Rack Push: Decoupling the real-time web applicatio...
by diminish on Wednesday May 02, 2018 @01:39AM
(#16974360)
It's the first time I hear about new web servers in Ruby after thin, passenger, unicorn, puma. Anyone has real life applications with Rails/Sinatra on iodine or agoo?
Re:Ruby’s Rack Push: Decoupling the real-time web applicatio...
by haffla on Saturday May 05, 2018 @04:14PM
(#17003551)
First time I hear about them, too. Googling Rails + Iodine doesn't yield much information. I'm going to try replacing Puma in one of my Rails apps. The benchmarks suggest that this could be a real win.
I'll try this new approach for Ruby and see how it scales.
Using separate servers can make it possible to upgrade/restart the backend process without necessarily disconnecting clients. It can allow managing/scaling the front tier separately from the back tier, which can make sense if you already do this for your request/response stuff (e.g. cache tier separately managed/scaled from web service tier). It's also a sane way to manage long-lived connections from a function backend like AWS Lambda, so the function doesn't have to run for the entire duration of a connection.
I created Pushpin (https://pushpin.org) to attempt to standardize this split-process architecture for all languages. It is a bit of a pain in a development environment, but a lot of fun in production. :)
However, as far as server architecture goes - even if we separate the application into two different processes (HTTP and WebSockets), the current situation is that the WebSocket server in Ruby will run two IO reactors / "servers" internally (unless you use a custom WebSocket enabled server such as iodine).
This post is more about the way WebSocket servers are implemented using Rack than about the question of application architecture.
Also, you can switch to microservices later for peanuts.