Hi,

On Fri, Aug 04, 2017 at 03:18:02PM +0900, [email protected] wrote:
> Hi,
> 
> What is an applet in haproxy? what is it for?

It's a small autonomous entity which communicates via a stream to another
side. It usually behaves exactly like a client or a server and is seen by
the internal code as an external entity. The main purpose is to be able to
plug it where an external connection is normally expected, so as to offer
services without changing the complex (and fragile) internal code.

A few examples :
  - the CLI handler. Haproxy "thinks" it's forwarding incoming connections
    to a remote server except that this remote server is the CLI applet
  - the stats page, it renders HTML code which passes through the HTTP
    response processing exactly as if it came from a server. It may even
    be compressed on the fly thanks to this (very convenient)
  - the peers protocol handler, it initiate connections to other LBs and
    accepts their connections
  - Lua and SPOE also use applets as connection initiators for their external
    communications

HTTP/2 will also use applets, one dedicated to the H2 connection, which
demuxes the requests, and one per stream to write the translated H1 request
into the next stage's buffer. The response processing follows the exact
opposite path. The H2 applet knows a list of the H1 streams and each H1
stream has a link to its parent H2 applet. Together they form sort of a
protocol conversion proxy (one client + one server).

Hoping this helps,
Willy

Reply via email to