Closed shunsukew closed 1 week ago
What I am thinking is that instead of a Subway instance loading balancing into multiple upstream, we can have multiple Subway each have a stable and persistent connection to RPC nodes directly and we put a LB in front of the Subway instances cluster
I see, that makes sense!
From here, just an idea sharing, so not related to original issue I posted above. But, having backend groups and routes traffic based on rpc methods is interesting, we can separate trace nodes and normal archive nodes, and routing trace rpc method calls to its own backend group. In this case, proxy should come in front of the load balance. This is what Optimism Proxyd can handle.
I guess we can have a middleware that is able to select which upstream to use based on the method call. It will require some refactoring but not too hard to do.
Websocket connection to upstream blockchain nodes is great (As-is implementation). It is more efficient than creating TCP connections each time. However, for practical use, having HTTP Upstream Client would be good (at least as optional) to distribute traffic evenly to backends.
Especially when considering backends scaling and environments where node's IP addresses are dynamically being changed, we generally use a Load Balancer between Subway and Backend nodes. (For example, Kubernetes cluster, Pods IPs are dynamically changed, and virtual LB (called
Service
resource typeClusterIP
) is in charge of backend nodes discovery.)