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. 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

