Load balancing / Chroxy
adamgotterer opened this issue · comments
I was wondering if Chroxy was designed to coordinate requests across multiple physical instances of machines running Chroxy?
In short: Yes is it designed for this (one of the major project objectives), but a No it is not currently implemented - a little work is required around ChromeServer
process registration.
It was, the ChromeServer
which manages the underlying chrome process instance, and these can be running on any machine attached as an Erlang Node and is simply a case of having the ChromeServer
process register so that it can be selected by the ChromeManager
- the ProxyServer
should just work, forwarding the traffic up/down between the client and the chrome process as long as the port in which chrome is running is open on the host machine running the chrome browser.
What is missing from the implementation to enable clustering of Chrome processes is a Process Registry
/ ChromePool
from which connected nodes can register the ChromeServer
processes into. The ChromeServer
processes will then be pulled out of the processes registry, rather than a random selection from the ChromeServer.Supervisor
children which is the current implementation.
See: https://github.com/holsee/chroxy/blob/master/lib/chroxy/chrome_manager.ex#L117
Not a lot of work required to make this multi-node, but the majority of my focus was spent running Chroxy in Docker containers and balancing requests between those rather than a single Chroxy Server with multiple worker (Erlang) Nodes connected each managing a pool of ChromeServer
s and chrome processes - but I still want this to exist! (As Chrome in Docker is very unstable).
Thanks for the clarification and details. I look forward to watching this project develop.