Hmm, this is interesting. The size of a frame and its id are at fixed
positions. Bytes 1,2 are length, 3,4 are type and 5,6,7,8 are the id. I'm
just not sure I could get multiple frames received on a single socket to
independently route through different backends, and for response frames to
go back through the correct incoming socket.

On Sun, Jul 10, 2016 at 8:10 AM, Chad Lavoie <[email protected]> wrote:

> Greetings,
>
> On 7/10/16 6:33 AM, Matt Esch wrote:
> > I need to load balance a custom tcp protocol and wonder if HAProxy
> > could be configured or extended for my use case.
> >
> > The protocol is a multiplexed frame-based protocol. An incoming socket
> > can send frames in arbitrary order. The first 2 bytes dictate the
> > frame length entirely (so max 64k per frame). The frame has a type and
> > a header format, followed by a payload.
> >
> > The multiplexing works by assigning long ids in the frame header and
> > pairing the responses based on this id.
>
> Depending on what the id's actually look like this may or may not work,
> but before I started writing a lot of C I'd try something such as
> payload() per
> https://cbonte.github.io/haproxy-dconv/configuration-1.5.html#7.1.5 to
> match an acl for use_backend; or stick on (using a table) via
> https://cbonte.github.io/haproxy-dconv/configuration-1.5.html#stick%20on.
>
> Again, entirely possible that its not usable for your use-case, but if
> it is it sounds much easier than trying to code another format.
>
> - Chad
> >
> > A load balancer would read frames from the socket, parse the frame,
> > select the correct backend from a header and route the request through
> > an available backend peer. The response would be matched to the
> > incoming socket based on the frame id.
> >
> > I expect (a lot of) c code will need to be written to support such a
> > custom protocol. I'm looking for specific pointers about how to add
> > such a protocol to the existing codebase in a way that would fit
> > cleanly, and preferably in a modular fashion.
> >
> > Any hints appreciated
> >
> >
> > ~Matt
> >
> >
>
>

Reply via email to