in reply to Re^2: Help finding relevant modules to write a port forwarder from pool
in thread Help finding relevant modules to write a port forwarder from pool
I once wrote a simple-and-stupid protocol-neutral load balancer in Perl and C, where Perl ran as a daemon selecting the best server, and C ran a TCP-to-TCP forwarder.
For each incoming TCP connection, the C code asked the Perl code for the best server (using UDP), connected to that server, and forwarded bytes in both directions until both sides had closed the connection. The perl code had a list of available servers for each TCP port, and a little monitor function that regularily checked that the servers were still alive.
That worked quite well with HTTP, telnet (just to test the code), and a propritary protocol for a native API. So, if your JSON passing protocol opens a new TCP connection for each request, this type of load balancer should work for you. It will probably also work if you stuff a few JSON strings through the connection, but it will not work if you keep the TCP connection open as long as possible.
Unfortunately, I have no permission to publish the code, but feel free to ask for more details.
Alexander
|
|---|