Interesting HAProxy & Lua projects

This post will explore so-called “applets” or “services” to build an URL shortener backend into haproxy itself!

haproxy-auth-request – HTTP access control using subrequests
auth-request allows you to add access control to your HTTP services based on a subrequest to a configured haproxy backend. The workings of this Lua script are loosely based on the ngx_http_auth_request_module module for nginx.

Adding random delay for specific HTTP Requests with HAProxy + Lua
Lately, i wanted to delay specific http requests and i wanted to have a random delay for every of these requests (for example in a range from 1000ms to 2000ms). One possible use case was to absorb and slow down traffic bursts that came from bots/crawlers/spiders or abusers (bad behavior clients in general)...

Integrating systems you have no influence on needs a lot of workarounds. Recently we could not scale Python service consuming SOAP messages with a new hardware. It just didn't benefit from more processing cores. On the other hand (and this happens often with older software) setting up several instances gave almost linear scalability. Only thing left - configure a loadbalancer and we are done...

Selecting a HAProxy backend using Lua
Once you've learned the basics of using Lua in HAProxy, you start to see a lot of places the scripting language could be useful. At Cloudant, one of the places we saw that we could make use of Lua was when selecting from the various backends to which our frontend load balancers direct traffic. We wrote a simple proof of concept, which I wanted to document here along with some of the problems we hit along the way...

ACME domain validation plugin
HAProxy plugin implementing zero-downtime ACME http-01 validation for domains served by HAProxy instances. The plugin leverages HAProxy's Lua API to allow HAProxy to answer validation challenges using token/key-auth files provisioned by an ACME client to a designated directory.

Dynamic config with LUA
This article shows a way for configuring HAProxy dynamically using Lua.

Suggested echo server implementation with HAProxy and Lua
This article gives an example of echo server. This server is benchmarked. he results are quite interesting, but I advise against using HAProxy + Lua as Apache + PHP replacement.

This GIT repository contains some sample scripts and configs for HAProxy with Lua.

No comments:

Post a Comment